← RESEARCH

PRISM-MAE

A masked autoencoder that learns from whichever questionnaire items a person happened to answer

Stanford Center for Precision Mental Health · Aug 2025 – Present

ML engineering lead · Research with Leanne Williams and Teddy Akiki

01 · Items

A session is a set of item-level answers

Every participant session is a set of answers to whichever items that person actually saw, drawn from many item-level psychiatric symptom questionnaires and rating scales across many studies. No one answers everything. The model treats the answers as a set, with no implied order.

Schematic. Showing 52 of about 500 items from 5 of the instruments. Click an instrument name to isolate it.
Hover or focus an item to see its wording and license. Click an instrument name to pin it and dim the others.

Item wording is from the published forms. PHQ-9, GAD-7, DASS-42, and PCL-C may be reproduced without permission; SWLS is used with attribution to Diener, Emmons, Larsen, and Griffin (1985). PCL-C wording is abridged. Three of the instruments in the corpus are rated by someone other than the respondent: HAM-D and YMRS by a clinician, SOFAS by a staff or coordinator rater. The rest are self-report or mostly self-report.

02 · Masking

Hide 65% of each row's observed answers

For every session, 65% of the items that person actually answered are hidden at random, with at least one hidden and one visible per row. The encoder sees only the visible answers. The decoder is asked to predict every item in the vocabulary, and the loss is computed on the items the person answered, hidden and visible.

Masking is a universal operation across instruments, so the dashed state looks the same regardless of color. No positional encoding: items are a set, not a sequence. And no placeholder for missingness: items a participant never saw are simply absent from the encoder input, with padding masked out of attention.

03 · Encoder

Eight transformer layers read the visible answers

Each visible answer becomes a token: the item's identity embedding plus a linear projection of the standardized answer value. A learned [CLS] session marker is prepended. The stack is 8 layers, 8 heads, width d = 128, pre-norm, GELU, with a feed-forward width of four times the model width. A residual stream runs end to end.

PRISM-MAE encoderInput tokens of CLS plus visible items flow into an eight-layer pre-norm transformer with a residual stream running through it. One layer is shown expanded to reveal multi-head self-attention and the feed-forward sub-block.Input tokens[CLS]visible-item tokens · identity + valueresidual stream8 × encoder layerlayer 1layer 2layer 3layer 4layer 5layer 6layer 7layer 8layer 4, expandedLayerNorm8-head self-attention⊕LayerNormfeed-forward · 4d · GELU⊕residualresidualEncoder outputscontextualized visible-item vectors · d = 128

One of the eight encoder layers is shown expanded. The other seven follow the same block. The [CLS] token is a learned session marker. It is not presented here as the person embedding.

04 · Decoder

Query every item in the vocabulary, not only the hidden ones

The decoder is 4 layers, 4 heads. For each session, it issues one query token per item in the shared vocabulary: a learned mask token summed with that item's identity embedding. The decoder reads the encoder's visible-item outputs together with those queries, and a linear head maps each query to a predicted answer value.

PRISM-MAE decoderA full-row band of query tokens, one per item in the vocabulary, feeds a four-layer decoder stack that attends to the encoder's visible-item outputs. The decoder emits one predicted value per item.Query tokens · one per item in the full vocabulary... of ~500encoderoutputskeys · valuesdecoder layer 1 · attention + FFdecoder layer 2 · attention + FFdecoder layer 3 · attention + FFdecoder layer 4 · attention + FFPredicted values · one per item in the vocabulary

Hover a predicted square to trace a schematic attention path back to the encoder memory and a few query tokens. Full-row design: the decoder reconstructs items the encoder saw alongside items it did not, which anchors the consistency side of the loss. Colors mark the five example instruments; the other instruments in the vocabulary are not drawn.

05 · Reconstruction and dual loss

Predicted values against held-out and visible answers

PHQ-9Little interest or pleasureΔ 0.3
Truth2.0
Pred2.3
GAD-7Nervous or on edgeΔ 0.2
Truth2.0
Pred1.8
DASS-42Down-hearted and blueΔ 0.4
Truth1.0
Pred0.6
PCL-CDisturbing memories or imagesΔ 0.1
Truth1.0
Pred1.1
SWLSLife is close to my idealΔ 0.6
Truth4.0
Pred3.4

Illustrative standardized values on a 0 to 4 display scale. Grey bar is the true answer, colored bar is the model's prediction, Δ is the absolute residual. Not real model output.

Hidden-item MSE · imputation

L_hidden = mean( (y_pred − y_true)² )

Measured only on items the encoder did not see. This is the classic masked-autoencoder objective: can the model recover answers it was denied?

Visible-item MSE · consistency

L_visible = mean( (y_pred − y_true)² )

Measured on the items the encoder did see. Weighted 1.0 against the hidden-item loss. Pushes the decoder to reconstruct the full row, so it stays honest about what it was given.

Total loss: L_hidden + 1.0 · L_visible.

The Problem

Psychiatric studies use different questionnaires, with overlapping constructs and uneven item coverage, and a total severity score can hide very different symptom patterns. PRISM-MAE learns from the item-level answers that are available, with the aim of transferring across questionnaires and studies.

What I Built

I led the ML engineering of the masked-autoencoder stack. I built and compared three transformer approaches (a masked autoencoder, TransTab, and masked-language modeling), ran regularization and architecture experiments, tuned with Optuna, and built the shared training and evaluation pipeline that every experiment runs through. The work also included harmonizing symptom data across studies.

How the Model Works

Each visible answer becomes one token: an embedding for the item plus a projection of its value. There is no positional encoding, because a set of answers has no order, and unanswered items are simply absent. In training, 65% of a session's answers are hidden, and the decoder is asked for every item in the vocabulary. The loss scores hidden and visible answers equally.

An Open Question: Does Item Wording Help?

Questionnaire wording carries meaning that could link items across instruments. In an earlier version I conditioned the model on frozen text embeddings of each item's wording and tested it against a matched model without them. Later experiments used a learnable gated additive attention bias, after a fixed version degraded performance. The current model uses plain learned item embeddings, and whether text helps remains an open question.

What Counts as Useful Generalization?

I built separate held-out probes for reconstruction within a questionnaire and for transfer to a whole unseen questionnaire, with Ridge and MissForest baselines, matched ablations, and bootstrap confidence intervals. Later evaluation work added leakage-safe cross-cohort splits. These tests separate fitting observed data from recovering information the encoder never saw.

Evidence & Scope

Preliminary results from an earlier version of the model were presented at the Wu Tsai Neuroscience Institute Retreat in May 2026. That version outperformed Ridge and MissForest baselines on held-out reconstruction, and its embeddings showed diagnostic and severity structure in exploratory plots. The model has changed since, and those results should not be read as an evaluation of the current model or as a clinically validated diagnostic system.

10,309sessions in May 2026 poster
574items in the poster
29questionnaires in the poster
11studies in the poster

Related Work