LEMON: attention-graph equivariant learning for zero-shot misbehavior monitoring of new LLMsLEMON: Equivariant Learning over Attention Maps for Zero-Shot Misbehavior Monitoring on New LLMs
LEMON zero-shot monitors hallucination and jailbreak on unseen LLMs; on 10 shards in the wild, the mean W-per-cell AUC is 67.7.
The monitor reads the attention maps and token probabilities of the monitored decoder-only LLM, with no task labels for unseen LLMs. During generation it scores per token or per window and can stop midway. In the jailbreak setting it looks only at the prompt and predicts whether the attack will succeed before the response is generated.
- Whenever a new model comes out, monitors tied to internal representations must be re-labeled and retrained; external LLM judges require additional inference, which the authors consider unsuitable for online monitoring. The goal is to learn from attention maps an online monitor that can transfer zero-shot to unseen LLMs.
- Cross-model layer-head misalignment is written as a wreath-product group symmetry, equivariant message passing is done on the directed token graph built by attention, and scoring is per token or per window at generation time. LEMON-W mixes across layer-heads, and LEMON-W-per-cell updates each layer-head cell individually.
- Hallucination is evaluated with RAGTruth leave-one-out, and in the wild with Mu-SHROOM and PsiloQA, 10 unseen LLMs in total; jailbreak uses RedBench. The authors state that LEMON is higher than the baselines: leave-one-out W-per-cell mean 69.4, in-the-wild 67.7, jailbreak W mean 65.0. On individual cells the baselines are higher.
- Future directions listed in the Conclusion include more tasks (machine-generated text detection, memorization), selective generation, use together with model-specific monitors, extension to vision-language models, and use as a tool for finding layer-head coordinates. The paper has no dedicated limitations section and does not report statistical significance tests.
- Evaluated models
- Llama-2-7BLlama-2-13BMistral-7BMistral-Nemo-12BQwen2.5-3BQwen2.5-7BMistral-7B-v0.2Pythia-Chat-7BTinyLlama-1.1BZephyr-7B-βPhi-4-miniHermes-2-Mistral-7BSmolLM2-1.7BSmolLM2-360MSmolLM2-135M
- Benchmarks
- RAGTruthMu-SHROOMPsiloQARedBench
- Metrics
- ROC-AUCAURCselective risktoken-coveragecoveragetoken-savings
Researchers propose LEMON, a graph neural network monitor based on attention graphs that can detect misbehavior such as hallucination and jailbreak zero-shot on unseen new LLMs. The method characterizes differences in attention head function, order and layer depth across models as algebraic symmetries, making predictions invariant to these transformations, and processes attention graphs token by token, outputting a score per token or per window of W tokens. On 16 LLMs and six datasets, in the zero-shot cross-model setting, LEMON outperforms all baselines on hallucination and jailbreak monitoring tasks, improving by up to 14 ROC-AUC points over the strongest baseline.
Paper analysis
What problem does this paper attempt to solve?
The authors aim to build an online misbehavior monitor that does not depend on labels for a new LLM and can transfer zero-shot across models.
Whether a monitoring signal shared across LLMs and independent of layer-head coordinates can be learned from attention maps, so as to be used zero-shot on unseen LLMs.
- Scenario: the authors consider that LLMs hallucinate, get jailbroken, memorize training data, or make reasoning errors; high-risk use requires lightweight, online monitoring. Using an external LLM as a judge requires additional inference, which the authors consider unsuitable for online use.
- Existing shortcomings: activation probes and attention-based monitors are usually tied to the model they were trained on, and a new LLM requires relabeling and retraining. The authors use LookbackLens as an example: the same hallucinated token is uncorrelated across the 32×32 layer-head grids of Llama-2-7B and Mistral-7B (Pearson r=0.04, Figure 2).
- Hypothesis: the attention features of misbehavior are shared across models, and the difference is mainly that layer and head coordinates differ. These misalignments can be written as algebraic symmetries of multi-head attention, and the monitor should be invariant to this symmetry.
- Approach: the paper proposes LEMON, an online GNN monitor. It scores per token or per W tokens, and can stop before the response is complete. The evaluated tasks are hallucination and jailbreak.
- Threat model
- Goal: flag hallucination- and jailbreak-related behavior; the paper emphasizes hallucination.
- Signal: the monitored LLM's attention maps and token probabilities. In the zero-shot setting, the unseen LLM has no labels for that task.
- Capability: score online during generation, and can stop midway, providing only the prefix. In jailbreak experiments the monitor sees only the prompt, and predicts whether the attack succeeds before any response token is generated.
- Target: unseen decoder-only LLMs. The paper does not name this access as white-box or black-box.
What related research exists?
The paper connects monitoring, equivariant networks, and cross-model representations to zero-shot attention monitoring.
The paper discusses this in Related Work along three lines, and gives comparable baselines in the experiments section.
Misbehavior and its monitoring
- The authors define misbehavior as outputs or actions that deviate from expected operation, and list hallucination, jailbreak and harmful assistance, reward hacking, sycophancy, and reasoning shortcuts; this paper only does hallucination and jailbreak, with an emphasis on hallucination.
- Internal signal monitoring includes activation probes (Belinkov, 2022; Azaria and Mitchell, 2023), LookbackLens (Chuang et al., 2024), and methods that learn on more holistic internal computations (Bar-Shalom et al., 2025; 2026; Frasca et al., 2026).
- The line that does not look at internal states requires multiple samples or running a separate judge model (Manakul et al., 2023; Kadavath et al., 2022; Farquhar et al., 2024; Kuhn et al., 2023; Zheng et al., 2023, etc.). The authors consider this unsuitable for online monitoring. A cheaper class directly uses the target model's token probabilities (Guerreiro et al., 2022; Varshney et al., 2023; Huang et al., 2023).
Equivariant networks
- Equivariant design writes rotation, translation, and permutation into the architecture, so the model does not have to relearn these symmetries from data (Cohen and Welling, 2016; Zaheer et al., 2017; Maron et al., 2018).
- Message-passing GNNs aggregate neighbors in a permutation-equivariant way (Gilmer et al., 2017). The paper uses this principle to handle layer-head symmetry.
Cross-model representations
- On the activation side there are model stitching, representation similarity, the platonic representation hypothesis, and neurons reproduced across seeds and model families (Bansal et al., 2021; Kornblith et al., 2019; Huh et al., 2024; Gurnee et al., 2024).
- On the attention side, roles such as induction heads and retrieval heads recur across models (Olsson et al., 2022; Wu et al., 2025; Elhelo and Geva, 2025). The authors consider the computation similar, only the coordinates differ.
- The authors state that to their knowledge, prior work stopped at manually recovering these coordinates; this paper instead learns permutation-equivariant functions, in order to extract monitoring signals zero-shot for unseen LLMs.
Baselines and benchmarks
- The hallucination baselines are LookbackLens, token probability Prob, hidden-state probe HS, CHARM, and LB+Align, which first aligns layer-head features and then classifies. Jailbreak additionally has Attn→Sys. CHARM also runs a GNN on the attention graph, but the paper states that it does not handle this paper's equivariance.
- The data are the three RAGTruth tasks, Mu-SHROOM, PsiloQA, and RedBench; the jailbreak suffix is one universal GCG from HarmBench.
The authors place this paper at the intersection of internal monitoring and equivariant learning: rather than retraining for a new LLM or manually aligning layer-heads, they make the monitor invariant to layer-head relabeling.
How does the paper address this problem?
Formulates layer-head misalignment as the wreath product group W, and uses an equivariant GNN to read attention online and score.
LEMON formulates cross-model layer-head misalignment as a group symmetry, then performs message passing on a directed graph derived from attention that is equivariant to this group, thereby reading unseen LLMs zero-shot.
Data and objective
- Samples: query, optional context, response, and token-level or whole-sentence-level binary labels. The internal signal is the attention map, with values from 0 to 1 and shape N×N×L×H.
- Training: labeled samples from K LLMs are merged. The goal is to extract a model-agnostic signal that transfers to an unseen LLM without labels for that task.
- Questions to answer: whether the attention signature of misbehavior is shared across LLMs under relabeling of heads and layers, and whether the monitor can read it on unseen LLMs.
Layer-head and token symmetry
- Head permutation: permuting heads within a layer and correspondingly permuting the value and output projections leaves the function computed by that layer unchanged; the permutation can differ across layers. Figure 3 draws H=2.
- Layers: layers are composed sequentially, and there is no exact interchange identity. The authors still use the cyclic group C_L as a modeling prior rather than an exact symmetry, to remove absolute layer numbers.
- Joint group: the joint symmetry is the wreath product
W = S_H \wr C_L. It pairs the cyclic relabeling of layers with independent head permutations per layer. In Figure 4, rows are reordered by π, and heads within a row are reordered by σ_ℓ. - Token axis: token order is meaningful, and there is no exact symmetry. Absolute indices have no shared meaning across tokenizers and lengths, so the authors treat translation along the token axis as an approximate symmetry. They do not enforce exact invariance across the whole network, and draw an analogy to ViTs with positional encoding being able to outperform CNNs that preserve translation symmetry. A footnote states that permutations of grouped attention must fall within the shared group.
From attention to LEMON
- Graph: tokens are ordered nodes, self-attention is a node attribute, cross-attention is a directed edge attribute, and attributes keep L×H without first flattening into a vector. Compared with CHARM, the difference is preserving this structure, and the graph is sequential.
- Preprocessing: prompt-to-prompt edges are dropped, edges below δ=0.1 are removed, and prompt nodes are pooled into a supernode. Hallucination experiments group the response into windows of W=8, and a window is positive if any token is hallucinated. Jailbreak looks only at the prompt, the system span is pooled into a supernode, and W=1.
- Updates: edges are mapped by a shared linear layer independently for each layer-head. Nodes concatenate self-attention with token probability; response tokens use the model probability, prompt tokens use 0. Aggregation follows the GINE style, and the update function is equivariant to W. LEMON-W uses an equivariant Transformer to mix across layers and heads; LEMON-W-per-cell applies the same MLP independently to each layer-head cell.
- Readout: after the equivariant layers, each layer-head coordinate separately passes through a causal cross-token Transformer with fixed sinusoidal positional encoding. The prediction head averages over layers and heads and then passes through an MLP, and is therefore invariant to W. Jailbreak is a single label for the whole graph, read out at the last prompt token.
Online properties
- Causal: edges only point forward, cross-token attention only looks at the past, and the prediction head is independent per token. Node scores depend only on the prefix generated so far.
- Deployment: new nodes are added linearly with prefix length, without recomputing the whole graph. The authors state that the online score of a prefix is the same as its score in the full response, and that offline training and online deployment are the same computation.
- Stopping: the online score can stop when misbehavior becomes likely, providing only the preceding prefix. Definitions of coverage and risk are in Section H.
What experiments did the paper conduct?
Under leave-one-out and in-the-wild zero-shot, the authors state that LEMON is higher than the baselines; Table 1 mean is 69.4, Table 2 is 67.7.
Experimental setup
- Models tested: the training pool is Llama-2-7B, Llama-2-13B, Mistral-7B, Mistral-Nemo-12B, Qwen2.5-3B, Qwen2.5-7B. In the wild there are 10 additional unseen models (Table 8). The authors state 16 LLMs in total, 135M to 13B, release years 2023 to 2025, six architecture families.
- Data: the main hallucination experiments are RAGTruth's Data2Text, Natural Questions, and Summarization, trained jointly and reported separately. Native annotations cover the first three Llama/Mistral models; the other three were annotated by Qwen2.5-32B following the RAGTruth template. The SUM training set after deduplication is 2514 examples. In the wild are the English official test splits of Mu-SHROOM and PsiloQA. Jailbreak is RedBench, 3000 examples per model, split by prompt into 1800/450/750, with the split shared across the six models.
- Protocol: default leave-one-out: train on K−1 models, test on the held-out model, with each model serving as the test target exactly once. Model selection uses only the validation ROC-AUC of the training LLMs. Seed 42, at most 100 epochs. Hallucination batch size 16, jailbreak 8.
- Baselines: hallucination has Prob, LookbackLens, HS, CHARM, LB+Align. HS takes layer 24 hidden states of each LLM, zero-pads to 5120 dimensions, then reduces to 128 dimensions with PCA fitted only on training data. Jailbreak additionally has Attn→Sys. Learnable baselines and LEMON use the same cross-LLM protocol.
- Metrics and labels: the main metric is ROC-AUC (×100). Jailbreak is scored by StrongREJECT on 0 to 1, binarized at 0.5; the paper does not state its internal judge model. Generation is greedy. Selective generation reports coverage, token-coverage, selective risk, token-savings, and AURC.
- Annotation spot check: Section F spot-checks the first 10 test examples of each of three tasks for the three new models, 90 examples and 220 spans in total; offset matching is 220/220. The authors state the main error is over-labeling, concentrated in QA and Data2Text; 49/2967 (1.7%) of spans may be retracted in the explanation text but are still kept by the parser. Responses of the three new models have a 256-token limit.
Main results
The table below is the ROC-AUC (×100) averaged over the three tasks under the RAGTruth leave-one-out setting, according to Table 1.
| Held-out LLM | Prob | CHARM | LEMON-W | W-per-cell | | Llama-2-7B | 57.8 | 45.5 | 71.4 | 74.9 | | Llama-2-13B | 52.3 | 57.3 | 73.8 | 75.5 | | Mistral-7B | 67.6 | 42.2 | 68.2 | 68.5 | | Mistral-Nemo-12B | 58.3 | 44.2 | 63.9 | 64.8 | | Qwen2.5-3B | 61.6 | 41.9 | 66.0 | 66.2 | | Qwen2.5-7B | 61.1 | 57.8 | 63.6 | 66.3 | | 18 shards mean | 59.8 | 48.1 | 67.8 | 69.4 |
- The authors state that the two variants are best on 16/18 model-task combinations, and that W-per-cell is roughly 10 ROC-AUC points higher than the strongest baseline, Prob. In the same table, the LB mean is 51.5, HS is 51.4, and LB+Align is 57.1.
- The exceptions are in Table 10: on Mistral-7B's Summarization, Prob is 71.1, higher than W's 66.8 and W-per-cell's 64.1; on Data2Text, Prob is 64.8, higher than W-per-cell's 60.8. On Qwen2.5-3B's Data2Text, all three are 65.0.
- The authors state that the learnable baselines are close to random under the leave-one-out setting, and consider that even equivariant layer-head mixing is not always beneficial, because W-per-cell is slightly higher than W.
In-the-wild hallucination monitoring
- What was measured: the six leave-one-out checkpoints from Table 1 are directly evaluated on 10 unseen LLMs on Mu-SHROOM and PsiloQA. Both are open-domain question answering, without the given context of RAGTruth. The comparison is Prob. Numbers are the mean ± standard deviation over the six checkpoints.
- Results: the 10-shard mean for Prob is 53.8, for LEMON-W is 67.4, and for W-per-cell is 67.7. The Mu-SHROOM means are 60.3, 68.2, 68.4 respectively; PsiloQA is 52.1, 67.1, 67.5. In Table 2 the highest cell for W-per-cell is SmolLM2-1.7B's 79.4±2.3.
- Authors' interpretation and exceptions: the authors state that transfer has essentially no drop, and is roughly 14 AUC points higher than Prob; the abstract instead writes up to 14 ROC-AUC points higher than the strongest baseline. The median standard deviation across the six checkpoints is 1.7. The exception is Phi-4-mini: Prob is 59.7, higher than W's 56.5±1.6 and W-per-cell's 55.1±0.6.
Jailbreak monitoring
- Setup: the same universal GCG suffix is appended to each RedBench request, fixed for all requests and the six LLMs. The monitor sees only the prompt. In Table 9, the attack success rate of this suffix ranges from 7.8% on Llama-2-13B to 51.6% on Mistral-Nemo-12B; the authors state that the label depends on the target LLM rather than the prompt.
- Means: in Table 3, Attn→Sys is 58.5, CHARM is 50.1, HS is 47.2, LEMON-W is 65.0, W-per-cell is 63.3. The authors state that W is 6.5 AUC points higher than the strongest baseline, and W-per-cell 4.8; and state that on this task W is roughly 2 AUC points higher, so sharing across layer-heads is beneficial.
- Exceptions: on Qwen2.5-3B, Attn→Sys is 67.6, higher than W's 63.9 and W-per-cell's 64.8. On Llama-2-13B, CHARM is 73.7, higher than W's 69.5. On Llama-2-7B, HS is 73.1, close to W's 75.1, but the same HS is only 26.4 on Llama-2-13B. The authors state that LEMON ranks first or second on all six LLMs; according to Table 3, this corresponds to the higher variant in each row.
Selective generation
- What was measured: because LEMON is causal, generation stops when the score during generation falls below a threshold τ, providing only the preceding prefix. Sweeping τ gives a risk-coverage curve, summarized by AURC.
- Results: the authors state that AURC is lowest on 17 of 18 shards. The Table 11 means are LEMON-W 9.10, W-per-cell 8.91, Prob 12.26; the main text writes 8.9, 9.1 versus 12.3. On Qwen2.5-3B's Data2Text, W-per-cell and Prob are both 19.81, and LEMON-W is 19.87.
- Single curve: Figure 14 is NQ, held-out Llama-2-13B. The labeled AURC is LEMON-W 2.04, W-per-cell 1.72, Prob 7.08. The authors state that at 90% token-coverage, the hallucination rate drops 43% (6.1% to 3.5%), and the coverage of full provision is 73%; and state that on this figure Prob does not decrease monotonically.
Other ablations and analyses
- Table 4 three-task means: without probability features, W is 64.6 and W-per-cell is 65.6; without cross-token mixing, 68.0 and 68.9; non-equivariant Dense is 58.7; without graph structure is 64.5. The main variants are 67.8 and 69.4.
- The authors state that except for no-cross, which is still invariant to W, the main variants are higher than each ablation; Dense is worst.
- Table 12 leave-one-in (trained on only one LLM) 18-shard means: Prob 59.8, LB+Align 53.1, LEMON-W 65.1, W-per-cell 66.9. The authors state that even after training diversity decreases, it is still higher than all baselines.
- Figure 16: with Nadapt=10, W-per-cell's non-invariant head plus logistic regression is 2.2 ROC-AUC higher than LB; at larger budgets the authors state it is comparable to LB. The authors state that with α≤0.75 the zero-shot performance of the invariant head is stable, and at α=1 it drops toward random.
- Figure 7: Llama-2-13B, first sample of RAGTruth NQ. Unmonitored is 39.6 ms/token; LEMON-W is 42.7 (+8%), W-per-cell is 42.1 (+6%). The authors state that of the 2.6 ms added by W-per-cell, the critic accounts for 0.3 ms. The introduction states total overhead is under 8%, and the conclusion states under 10%.
- Section A: on 104 hallucinated tokens shared by the two models, the correlation of LookbackLens's 32×32 maps is at most 0.19 (mean 0.07, median 0.07, minimum −0.03).
What are some points that can be further explored?
The paper does not list limitations separately; the Conclusion proposes more tasks, multimodality, and interpretability uses.
Limitations and future directions noted by the authors
The paper has no separate Limitations section. The Conclusion states that many directions remain open and lists the following future work.
- More tasks: LEMON could also be evaluated on tasks such as machine-generated text detection and memorization (Conclusion).
- Selective generation: selective generation combined with LEMON could be further studied (Conclusion).
- Use with specialized monitors: it could also be used together with other, model-specific monitors (Conclusion).
- Multimodality: extending to multimodal models such as vision-language models is called a future research direction by the authors (Conclusion).
- Interpretability: using LEMON as a tool to automatically find important layer-head coordinates is considered worthwhile by the authors (Conclusion).
Scope of experiments
- The models tested are open-weight, instruction-tuned decoder-only LLMs: a training pool of 6 for leave-one-out, plus 10 more in the wild, 16 in total; scale from 135M to 13B (Section 4, G.2, Table 8).
- The tasks are hallucination and jailbreak. Hallucination data are the three RAGTruth tasks, Mu-SHROOM, and PsiloQA; jailbreak is one fixed universal GCG suffix on RedBench, greedy generation, with StrongREJECT binarized at 0.5. The paper does not state the judge model inside StrongREJECT.
- The main protocol is leave-one-model-out zero-shot. There is also leave-one-in trained on a single model (Section G.7), adaptation with a small amount of labels (Section G.6), and selective generation (Table 11, 18 shards).
- New annotations for three training-pool models were done by Qwen2.5-32B, with a spot check of 90 examples (Section F). Latency numbers come from the first sample of RAGTruth NQ on Llama-2-13B (Figure 7).
- The paper reports no statistical significance tests, and no multi-seed repetition of the leave-one-out main results. The standard deviations in Table 2 are across the six leave-one-out checkpoints.
Summarize the main content of the paper
LEMON uses a layer-head equivariant GNN to monitor hallucination and jailbreak online, and transfers zero-shot to unseen LLMs.
LEMON is an online monitor that reads attention maps, used to flag hallucination and jailbreak when there are no target-model labels.
- Problem: internal probes are tied to the model they were trained on, so a new LLM requires relabeling; external judges require additional inference. The authors formulate cross-model layer-head misalignment as an algebraic symmetry and learn monitors invariant to these symmetries.
- Method: message passing on the token graph that is equivariant to the wreath product group W, scoring per token or per window. LEMON-W mixes across layer-heads; LEMON-W-per-cell updates per cell. Scores can trigger a stop mid-generation.
- Hallucination leave-one-out: six LLMs, three RAGTruth tasks. In Table 1, the 18-shard mean for W-per-cell is 69.4, and for Prob is 59.8. The authors state it is best on 16/18 combinations, and state roughly 10 ROC-AUC points higher. On Mistral-7B's Summarization and Data2Text, Prob is higher.
- In the wild and jailbreak: on the 10 unseen-LLM shards in Table 2, the mean for W-per-cell is 67.7, and for Prob is 53.8; on Phi-4-mini, Prob is higher. In the jailbreak Table 3, the mean for LEMON-W is 65.0, and for Attn→Sys is 58.5; on Qwen2.5-3B and Llama-2-13B there are cells where the baseline is higher.
- Online cost: in Table 11, the mean AURC for W-per-cell is 8.91, and for Prob is 12.26; the authors state it is lower on 17 of 18 shards. Figure 7 on Llama-2-13B labels LEMON-W as +8% and W-per-cell as +6%. The authors plan to release code, checkpoints, and annotations after publication.
- Authors' conclusion: the authors consider that after handling layer-head symmetry, the monitor can be used zero-shot on unseen decoder-only LLMs, and can flag misbehavior during generation at small overhead.