Hypothesis
Most language-based mental-health models are trained as population-level classifiers. Given a message or a session, they predict a label such as elevated depressive symptoms, and they judge every input against the same decision boundary. This works poorly for individuals. Between-person variance in expressed affect is large, and most of it is not clinically meaningful. Someone who is usually terse and flat is not in crisis because they are terse and flat today.
Our hypothesis is that clinically relevant signal lives mostly in within-person change. If a model has seen enough of one person’s history, it can tell apart a new pattern, an ordinary bad week, and that person’s normal. A population model cannot draw these distinctions.
This changes the modeling problem. Classification becomes state estimation, and thresholding becomes change-point inference. Evaluation has to measure detection of within-subject change, not accuracy on held-out users.
Architecture
PAM has four learned components and one policy layer. A session encoder maps each conversation to an embedding, conditioned on a persistent user embedding and on retrieved memory. PAM-State filters these embeddings into a latent state with uncertainty. PAM-Shift infers whether that state has departed from the user’s baseline. An escalation policy decides whether to ask, wait, or recommend human support.
Fig. 2. Solid edges run every session. Dashed edges update on slower timescales. The baseline is deliberately decoupled from the state so that a gradual change is not absorbed into “normal.”
Internally we sometimes call a user’s fitted PAM an emotional digital twin. We avoid the term in product because it overstates fidelity. The model is a compressed, uncertain summary of what someone has chosen to tell us, not a simulation of them.
Latent state estimation
We model each user as a low-dimensional latent state that evolves over time. We observe it only through conversations. Let \(x_{u,t}\) be user \(u\)’s session at time \(t\), and let \(e_u\) be a user embedding that is learned jointly and updated slowly.
Here \(\Delta_t\) is the irregular gap between sessions. Users don’t talk to us on a schedule, and the transition model has to account for that. We use a neural state-space model with a learned transition and a user-conditioned emission \(C_u\). Inference uses an amortized filter that outputs a mean \(\hat z_t\) and covariance \(P_t\). We keep \(\dim z = 16\). Two leading components are loosely aligned with valence and activation through a weak auxiliary loss on self-report, but we don’t treat any dimension as a validated construct.
The session encoder is a frozen pretrained language model with a lightweight adapter. The adapter is trained to predict the next session’s embedding and the user’s self-reported state. Conditioning on \(e_u\) matters most in the encoder. The same sentence carries different information from different people.
Personalized baselines
A baseline is a distribution over a user’s latent state during a reference period, \(\mathcal{N}(\mu_u, \Sigma_u)\). It is estimated with exponential forgetting and shrinks toward a population prior when data are scarce. We measure deviation as a Mahalanobis distance under the filter’s own uncertainty:
Baselines need data. Before about \(n_0 = 21\) sessions, the error is too large for deviations to mean much. Until then, the app only reflects and never flags. Internal evaluation suggests baseline error falls roughly as \(1/\sqrt{n}\) in session count. It plateaus at a floor set mostly by how much users share in each session.
Fig. 3. Normalized RMSE of \(\hat\mu_u\) against a held-out reference, stratified by disclosure-depth tercile. Disclosure depth is an annotator-rated score of how much personal information a session contains. PAM-24 cohort, n = 214.
The dependence on disclosure is the strongest effect we’ve measured. More sessions help. Sessions where people say more about what is actually going on help much more.
Change detection
PAM-Shift runs Bayesian online change-point detection over the filtered state. It maintains a posterior over the run length \(r_t\), the time since the last regime change:
The hazard \(H\) is learned per user from a population prior. A single low session should not count as a change, so we flag only when the posterior mass on a recent change stays above \(\alpha\) for a minimum persistence window \(w\). The default is 7 days.
Fig. 4. Top: \(\hat z_t\) against the baseline band. Bottom: \(p(r_t \le w)\) per session. The spike near week 11 does not persist and does not trigger a flag.
Uncertainty-aware inference
Every output of PAM carries uncertainty, and the escalation policy uses it directly. We calibrate change-point probabilities with split conformal prediction on held-out participant-weeks. When the model is uncertain, it abstains:
When Baseline is unsure, it asks rather than infers. A clarifying question is cheap. A confident, wrong statement about someone’s mental state is not.
Explicit risk language skips this policy entirely. It routes to crisis resources through deterministic rules, not a learned model.
Retrieval-based memory
Stable facts about a person, such as relationships, recurring stressors, and past coping strategies, are stored as episodic memory entries rather than packed into model weights. At each session the encoder retrieves the top-\(k\) entries:
The score combines semantic similarity, recency, and a learned salience term \(\sigma_m\). Memory lets Baseline ask about things that matter to you without making you explain them again. Users can inspect, edit, and delete any memory entry. A deletion also removes the entry’s contribution to \(e_u\) at the next slow update.
Therapist retrieval and ranking
When the policy returns refer, or when a user asks, we recommend clinicians in two stages. Hard filters come first: licensure in the user’s state, insurance or cost constraints, accepting new clients, and age focus. A learned ranker then orders the candidates that remain:
The style term compares a projection of the user embedding with a clinician embedding. The clinician embedding comes from clinician-authored profile text, not from session content. Stated preferences, such as a therapist’s gender, identity, or approach, act as constraints rather than soft features, and always take priority over the model. Clinicians see nothing from a user’s Baseline history unless the user explicitly shares it.
We plan to train the ranker on early-retention signals: whether a user attends a second and a third session. These are imperfect proxies for alliance, but they are available and hard to game.
Within-subject evaluation
Standard held-out-user accuracy rewards a model for sorting people, not for noticing change. PAM-24 is our internal protocol. Consenting participants aged 18–29 use Baseline for 24 weeks and complete the PHQ-9 and GAD-7 every two weeks. A reference change point is a sustained shift of ≥5 points on either instrument across two consecutive assessments. The window for a correct detection is ±7 days.
| Model | CP-F1 ↑ | Delay (d) ↓ | False alerts/yr ↓ | ECE ↓ |
|---|---|---|---|---|
| Population classifier, per session | 0.31±.05 | 19.0 | 6.8 | .142 |
| Population + 30-day context | 0.42±.05 | 14.5 | 4.9 | .118 |
| PAM-State, no user embedding | 0.51±.04 | 11.0 | 3.1 | .087 |
| PAM-State + PAM-Shift | 0.64±.04 | 8.5 | 1.7 | .049 |
| PAM-State + PAM-Shift + memory | 0.68±.04 | 7.0 | 1.4 | .046 |
Table 1. CP-F1 is change-point F1 within ±7 days. Delay is median days from the reference change to the first flag. False alerts are per user-year. ± shows 95% bootstrap intervals over participants. These results have not been independently validated or published.
| Disclosure-depth tercile | Sessions / wk | Median words / session | CP-F1 ↑ |
|---|---|---|---|
| Low | 2.1 | 180 | 0.44 |
| Mid | 3.8 | 410 | 0.67 |
| High | 6.2 | 960 | 0.81 |
Table 2. Full model, stratified by participant. Engagement and disclosure are confounded with baseline symptom severity. We have not yet separated these effects.
Limitations and open questions
- Performance depends on engagement. Users who share less are modeled less well (Table 2). This may widen the gap between people who are already comfortable seeking help and people who aren’t.
- Self-report ground truth. PHQ-9 and GAD-7 are screening instruments, not diagnoses. Change points defined on them are a proxy.
- Small, self-selected cohort. PAM-24 participants chose to use a mental-health app for six months. They are not representative of young adults in general.
- Baseline drift. A slow decline over many months can still be absorbed into the baseline. We are testing multi-timescale baselines to address this.
- Matching outcomes. We don’t yet have enough referral outcomes to evaluate the ranker beyond offline relevance judgments from clinicians.