Reading Who-Did-What-to-Whom from an LLM's Hidden States to Catch Role-Swap Hallucinations

Language models often produce sentences in which every entity is real and every word is fluent, but the relations between them are wrong. A summary says the donor had the condition when it was the patient, or credits a film to the wrong director. Current internal-state hallucination detectors read the generating model's hidden vectors one token at a time, or collapse a whole response into a single vector. Both views can miss an error that exists only in how two correct words are linked. Decades of parsing research supply a tool for scoring such links: the biaffine scorer, a small bilinear function that takes the contextual vectors of two words and scores whether one is the argument of the other, and in what role. We propose attaching this kind of scorer to the frozen middle-layer states of the generating model, so that relational hallucinations are detected as pairs rather than as tokens.

The second half of the idea addresses the best-documented weakness of hidden-state probes, which is that they do not transfer across tasks. We first train the pairwise scorer to recover predicate–argument structure, using standard semantic-role-labeling data passed through the generating model. This step needs no hallucination labels. We then calibrate it on a small amount of hallucination data. Our bet is that "which argument binds to which predicate" is a property of the model's representations that does not depend on the task. If so, a detector anchored to that structure should move from summarization to dialogue far better than probes trained only on one task's hallucination labels. Put in two sentences: hallucinations about relations live between tokens, so the detector should score token pairs, as dependency parsers do. Teaching that pair scorer general linguistic structure first should make it transfer across tasks where current probes break.

What prior work establishes and leaves open

Three papers motivate the proposal by showing that the generator's own hidden states carry hallucination signal. Do Androids Know They're Only Dreaming of Electric Sheep? trains linear, attention-pooling and ensemble probes on Llama-2-13b states. Its ensemble probe reaches 0.75 F1 on CNN/DailyMail summarization, above an expert annotator's 0.55, and most of the signal is already present by layer 4. The same paper reports that these probes generalize poorly from summarization to dialogue and from synthetic to organic errors; that negative result is the one we target. INSIDE measures how spread out middle-layer embeddings are across 10 to 20 sampled answers (EigenScore). This works without labels, but it judges whole responses and needs many generations. ICR Probe tracks how much each layer's update follows attention to context versus content injected by the feed-forward blocks, and reports AUROC between 0.76 and 0.84 on HaluEval-style data. All three treat each hidden state as an isolated point or a scalar trajectory. None scores a relation between two positions, and that pairwise view is what we add.

Two papers constrain the design. HalluEntity finds that likelihood and entropy flag many valid but rare entities, giving high recall and poor precision. Its context-aware Focus method reaches AUROC 0.78 and AUPRC 0.40 on Llama3-8B. The authors conclude that the field should probe internal states, and they find that errors concentrate on proper nouns, numbers and sentence endings. MASSIVE Multilingual AMR tests whether explicit semantic graphs help detect relation hallucinations in SPARQL generation. GPT-4 catches disallowed relations only about 24% of the time even with an oracle list. That result rules out asking the model to verify its own relations through prompting, and it pushes us toward reading structure from activations instead of from generated graphs.

The method itself comes from the contextual-embedding parsing literature. Deep Biaffine Attention for Neural Dependency Parsing projects contextual vectors into small "head" and "dependent" spaces and scores word pairs with a bilinear form. Dependency or Span, End-to-End Uniform Semantic Role Labeling applies the same scorer over ELMo vectors to predicate–argument structure, reaching 86.3 F1 on CoNLL 2005 spans and 90.4 on CoNLL 2009. Results such as HIT-SCIR at MRP 2019, where DM semantic-graph F1 rose from 87.1 to 94.3 when BERT replaced GloVe, show that contextual vectors already hold most of the relational information and that a light scorer suffices to read it out. We reuse this scorer, but feed it a generator's internal states instead of an encoder's outputs.

The closest external-encoder precedent is HADES, from A Token-level Reference-free Hallucination Detection Benchmark. It labels individual tokens with RoBERTa or XLNet, reaching roughly 72% accuracy. It runs outside the generator and scores single tokens, so it differs from our proposal on both counts.

Core Claim

We make two separable claims. First, on hallucinations defined by a wrong relation between individually valid spans, a pairwise bilinear probe on the generator's middle-layer states will beat token-level and pooled probes given the same number of parameters and the same labels. Second, pretraining that probe on predicate–argument structure, with no hallucination labels, will reduce the cross-task transfer gap reported by Do Androids Know?. Either claim can fail independently, and the experiments are designed to tell us which, if either, holds.

Research Program

The generator is frozen throughout. We use Llama-2-13b so that results compare directly with the published probes, and Llama-3-8B for the HalluEntity comparison.

Stage one: structural pretraining. We pass CoNLL 2005/2012 sentences through the generator and collect states from a band of middle layers. Following the early-layer finding, we sweep layers 4 through 24. A biaffine head, with roughly the parameter budget of the ICR probe's 16k-parameter MLP after low-rank projection, learns to predict, for each candidate argument token, which predicate it attaches to and in what role.

Stage two: the detector. In grounded generation, the source and response sit in one context window. We run the same head across the source–response boundary. For each argument span in the response, it produces a distribution over source predicates and spans, describing where the model's own states "think" this argument came from. The detection feature has two parts: how sharp that distribution is, and whether the source binding it selects is consistent with the role the head assigns in the response. In closed-book settings there is no source, so we use only the within-response binding sharpness. A small logistic layer, trained on a few hundred hallucination labels from one task, turns these features into a span score.

Diagnostic set. To isolate relational errors, we build role-swap minimal pairs from CNN/DailyMail and Conv-FEVER references. Each pair exchanges two argument spans that both occur in the source, so every token remains locally plausible. We complement these with ERBench relational questions (ERBench) and organic outputs annotated at span level.

Baselines

The naive reference point is token log-likelihood and predictive entropy of the generator, aggregated over each span. HalluEntity shows this has high recall and low precision. Every method must clear it, and on role-swap pairs we expect it to sit near chance.

The strongest existing competitor is the ensemble probe of Do Androids Know?. It is the best reported white-box detector on grounded tasks: 0.75 F1 on CNN/DailyMail, and over 90% response-level F1 on Conv-FEVER and E2E. It also already does span-level detection, so it is the method our pairwise claim must beat. We retrain it on the same Llama-2-13b states, with the same labeled examples and an equal hyperparameter search budget. Beating it in-domain means a statistically reliable F1 gain on role-swap pairs and no loss on its own CDM setting. Beating it on transfer means a smaller drop when we train on CDM and test on Conv-FEVER and E2E.

ICR Probe is the strongest single-pass dynamic method, at 0.76–0.84 AUROC on HaluEval-related data. We run it on Llama-3-8B with its released parameter budget. On HalluEntity the target is Focus at AUROC 0.78 and AUPRC 0.40. Because positives are rare, AUPRC is the metric that matters, and we count a gain there as the win. EigenScore from INSIDE is reported with K=10 sampled responses as a multi-sample upper reference. Its 81.5% AUROC on SQuAD with LLaMA-7B anchors the QA comparison. We do not require our single-pass method to beat it outright, only to come within a few points at roughly a tenth of the generation cost.

The external-encoder baseline is a RoBERTa-large token tagger in the HADES style. The reported figure for that setup is roughly 72% accuracy on HaDeS, from Liu et al., and we retrain it on our labels. The external-parser baseline runs an off-the-shelf span SRL system, the ELMo-based model of Li et al., on the source and the response, then flags arguments whose roles disagree.

Three ablations isolate the key ingredients. The first is a concatenation MLP that takes the same two hidden states with matched parameters, which tests whether the bilinear form matters. The second is the biaffine head without SRL pretraining, which tests whether structure supervision matters. The third is SRL multitask pretraining applied to a linear token probe, which tests whether pairwise scoring is needed to benefit from structure.

Why not just…?

Why not just use token entropy or likelihood? On role-swap pairs, both swapped arguments are copied from the source and receive high probability. Liu et al. and INSIDE also report that hallucinated tokens are often more probable than correct ones. We expect entropy to perform near chance on the diagnostic set, and we report this directly rather than assuming it.

Why not just train the existing span probe on more data? This is the most serious alternative. The attention-pooling probe from Do Androids Know? can, in principle, learn pairwise interactions through its attention. If, with equal labels, it matches our head on role swaps, the pairwise claim fails. The transfer matrix then decides whether structural pretraining is still worth keeping as a separate contribution. We run a label-scaling curve, from 100 to 5,000 labels, for both methods so that "more data" is tested rather than argued about.

Why not just parse the source and output with an external SRL system and compare? For grounded role swaps this could genuinely work, because the errors show up in the text. Its weaknesses are parser errors on noisy model output (the survey A Survey of Syntactic-Semantic Parsing documents domain fragility), extra inference cost, and no closed-book signal. If it matches our method on grounded data, we will say so and narrow our claim to closed-book binding uncertainty and single-pass cost. The ERBench closed-book condition is where the two methods should separate.

Why not just prompt the model to check its relations? HaluEval reports ChatGPT at 58.53% accuracy on summarization hallucinations, and MASSIVE-AMR reports GPT-4 detecting relation errors only about 24% of the time even with an oracle list. We include a GPT-4-free prompted self-check using the same open generator as a sanity reference.

Decisive Checks

Four results settle the proposal.

The first is the role-swap minimal-pair test. The pairwise head must beat both the attention-pooling probe and the matched concatenation MLP. If the concatenation MLP ties it, we drop the bilinear claim.

The second is the transfer matrix across CNN/DailyMail, Conv-FEVER and E2E, with train and test tasks crossed. SRL-pretrained heads must lose less F1 off-diagonal than the published probe design. If pretraining does not shrink the gap, the second claim fails.

The third is organic span detection on HalluEntity, measured by AUPRC against Focus's 0.40, together with closed-book ERBench, where the external-SRL baseline has no signal to use.

The fourth is a layer sweep. We check whether binding accuracy on CoNLL and detection accuracy peak in the same middle layers. Coinciding peaks would support the mechanistic story that relational hallucination appears where the model's argument binding weakens, while a mismatch would suggest the detector works for other reasons.