Adaptive Activation Cancellation for Hallucination Mitigation in Large Language Models
Organizations: The Beacom College of Computer and Cyber Sciences, Dakota State University, Madison, SD 57042, USA. · Department of Computational Data Science and Engineering, North Carolina A&T State University, Greensboro, NC 27411, USA. · Department of Computer Science and Software Engineering, California Polytechnic State University, San Luis Obispo, CA 93407, USA. · Department of Computer Science, University of Idaho, Moscow, ID 83844, USA. ·
Abstract
Large Language Models frequently generate fluent but factually incorrect text. We propose Adaptive Activation Cancellation (AAC), a real-time inference-time framework that treats hallucination-associated neural activations as structured interference within the transformer residual stream, drawing an explicit analogy to classical adaptive noise cancellation from signal processing. The framework identifies Hallucination Nodes (H-Nodes) via layer-wise linear probing and suppresses them using a confidence-weighted forward hook during auto-regressive generation -- requiring no external knowledge, no fine-tuning, and no additional inference passes. Evaluated across OPT-125M, Phi-3-mini, and LLaMA 3-8B on TruthfulQA and HaluEval, the real-time hook is the only intervention that consistently improves downstream accuracy on all three scales. Critically, the method is strictly surgical: WikiText-103 perplexity and MMLU reasoning accuracy are preserved at exactly 0.0% degradation across all three model scales, a property that distinguishes AAC from interventions that trade fluency or general capability for factual improvement. On the LLaMA 3-8B scale, the hook additionally yields positive generation-level gains (MC1 +0.04; MC2 +0.003; Token-F1 +0.003) while achieving probe-space selectivity 5.94x - 3.5x higher than the ITI baseline -- demonstrating that targeted neuron-level suppression can simultaneously improve factual accuracy and preserve model capability.
Figures & tables
| # | Contribution |
|---|---|
| 1 | Formal analogy between the transformer residual stream and an ANC primary channel. |
| 2 | Algorithm for identifying H-Nodes via signed probe weights and percentile baselines. |
| 3 | Real-time forward hook that suppresses H-Node activations during generation. |
| 4 | Empirical analysis across five cancellation variants and three scales (163M–8B). |
| 5 | Ablation confirming adaptive confidence-weighting reduces grounded drift by 25.9–40.1%. |
| 6 | Quantitative comparison with ITI [ 15 ] and DoLA [ 16 ] . |
| ANC Component | Signal | AAC Counterpart |
|---|---|---|
| Primary channel | Hidden state | |
| Noise reference | H-Node activations | |
| Adaptive filter | Probe weights | |
| Error signal | Residual after cancellation | |
| Cancellation coefficient | (attenuation scale) | |
| Noise estimate | Excess above percentile baseline |
| Method | Mode | Description |
|---|---|---|
| Mean baseline | Post-hoc | Subtract the mean H-Node activation over grounded samples. |
| Pct80 H-Node | Post-hoc | Suppress excess above the 80th percentile baseline (Eq. 5 ). |
| Pct80 Amplify | Post-hoc | Suppress pro-hallucination H-Nodes; boost anti-hallucination neurons (Eq. 6 ). |
| Pct80 Fourier | Post-hoc | Apply FFT to the excess signal, retain the top-5 spectral components, and subtract; requires excess to avoid injecting noise. |
| Pct80 Zero | Post-hoc | Clamp H-Node activations to the percentile baseline. |
| Real-time Hook | Generation | Register forward_hook on layer ; intercept hidden state, compute excess, apply confidence-weighted attenuation at every generation step. |
| Metric | Symbol | Definition | Desired |
|---|---|---|---|
| Hallucination confidence reduction | Reduc | Decrease in probe conf. on hallucinated samples | |
| Grounded drift | Drift | Change in probe conf. on grounded samples | |
| Selectivity | Sel | Reduc / Drift (Eq. 8 ) | ( ) |
| Separation change | Sep | Hallucinated grounded confidence gap change | |
| MC1 accuracy | MC1 | Fraction of TruthfulQA correct via log-prob ranking | |
| MC2 truthfulness | MC2 | Normalised prob. mass over true answers [ 20 ] |
| Model | Params | Layers | Hidden dim | Dtype | Loading |
|---|---|---|---|---|---|
| OPT-125M [ 21 ] | 163.8M | 12 | 768 | float32 | Standard |
| Phi-3-mini | 3,821M | 32 | 3072 | float16 | device-map |
| LLaMA 3-8B [ 22 ] | 8,030M | 32 | 4096 | bfloat16 | device-map |
| Dataset | Samples | Label type | Role in pipeline |
|---|---|---|---|
| TruthfulQA [ 20 ] | 600 (validation) | MC correct / incorrect | Activation extraction, probe training, cancellation baseline, generation evaluation |
| HaluEval | 600 | Explicit hallucination field | Cross-benchmark generalisation evaluation |
| Model | Best Layer | Last-Token AUC | Mean-Pool AUC | Gain |
|---|---|---|---|---|
| OPT-125M | 6 | 0.7535 | 0.6270 | +0.1264 |
| Phi-3-mini | 17 | 0.8877 | 0.6402 | +0.2474 |
| LLaMA 3-8B | 15 | 0.8979 | 0.8617 | +0.0362 |
| Layer | Last-Token AUC | Mean-Pool AUC | Gain | Depth |
|---|---|---|---|---|
| 0 | 0.4337 | 0.4891 | 0.0554 | 0% |
| 1 | 0.5426 | 0.4396 | 0.1030 | 8% |
| 2 | 0.6105 | 0.4206 | 0.1899 | 17% |
| 3 | 0.6594 | 0.4340 | 0.2254 | 25% |
| 4 | 0.7251 | 0.4568 | 0.2683 | 33% |
| 5 | 0.7237 | 0.5264 | 0.1973 | 42% |
| Layer | Last-Token AUC | Mean-Pool AUC | Gain | Depth |
|---|---|---|---|---|
| 0 | 0.4944 | 0.4685 | 0.0259 | 0% |
| 3 | 0.6457 | 0.4181 | 0.2275 | 9% |
| 4 | 0.7019 | 0.4070 | 0.2948 | 13% |
| 7 | 0.7198 | 0.4530 | 0.2668 | 22% |
| 9 | 0.7759 | 0.5137 | 0.2622 | 28% |
| 11 | 0.7925 | 0.5574 | 0.2351 | 34% |
| Layer | Last-Token AUC | Mean-Pool AUC | Gain | Depth |
|---|---|---|---|---|
| 0 | 0.4944 | 0.5000 | 0.0056 | 0% |
| 2 | 0.6552 | 0.5098 | 0.1454 | 6% |
| 4 | 0.7694 | 0.5398 | 0.2296 | 13% |
| 6 | 0.8111 | 0.6640 | 0.1472 | 19% |
| 8 | 0.8456 | 0.7349 | 0.1106 | 25% |
| 10 | 0.8586 | 0.7999 | 0.0588 | 31% |
| Metric | OPT-125M | Phi-3-mini | LLaMA 3-8B |
|---|---|---|---|
| Total layers | |||
| AUC peak layer | |||
| AUC peak value | |||
| AUC peak depth (%) | |||
| Separation peak layer | |||
| Separation peak value |
| Method | Reduc | Drift | Supp% | Sel | Sep |
|---|---|---|---|---|---|
| Post-hoc Mean | 0.0731 | 0.0222 | 12.7% | 3.29 | 0.051 |
| Post-hoc Pct80 H-Node | 0.0259 | 0.0074 | 4.5% | 3.48 | 0.019 |
| Post-hoc Pct80 Amplify | 0.0393 | 0.0114 | 6.8% | 3.44 | 0.028 |
| Post-hoc Pct80 Fourier | 0.0133 | 0.0032 | 2.3% | 4.20 | 0.010 |
| Post-hoc Pct80 Zero | 0.0467 | 0.0138 | 8.1% | 3.37 | 0.033 |
| Real-time Hook (ANC) | 0.0073 | 0.0281 | 1.3% | 0.26 | 0.035 |
| Method | Reduc | Drift | Supp% | Sel | Sep |
|---|---|---|---|---|---|
| Post-hoc Mean | 0.0216 | 0.0143 | 2.9% | 1.51 | 0.007 |
| Post-hoc Pct80 H-Node | 0.0069 | 0.0045 | 0.9% | 1.51 | 0.002 |
| Post-hoc Pct80 Amplify | 0.0100 | 0.0058 | 1.3% | 1.72 | 0.004 |
| Post-hoc Pct80 Fourier | 0.0041 | 0.0028 | 0.6% | 1.48 | 0.001 |
| Post-hoc Pct80 Zero | 0.0111 | 0.0079 | 1.5% | 1.40 | 0.003 |
| Real-time Hook (ANC) | 0.0338 | 0.0345 | 4.5% | 0.98 | 0.001 |
| Method | Reduc | Drift | Supp% | Sel | Sep |
|---|---|---|---|---|---|
| Post-hoc Mean | 0.0190 | 0.0038 | 2.6% | 5.06 | 0.015 |
| Post-hoc Pct80 H-Node | 0.0067 | 0.0012 | 0.9% | 5.58 | 0.006 |
| Post-hoc Pct80 Amplify | 0.0106 | 0.0020 | 1.4% | 5.42 | 0.009 |
| Post-hoc Pct80 Fourier | 0.0047 | 0.0009 | 0.6% | 5.39 | 0.004 |
| Post-hoc Pct80 Zero | 0.0105 | 0.0019 | 1.4% | 5.54 | 0.009 |
| Real-time Hook (ANC) | 0.0502 | 0.0371 | 6.8% | 1.35 | 0.013 |
| Percentile | Reduc | Drift | Sel | Sep |
|---|---|---|---|---|
| 50th | 0.0736 | 0.0224 | 3.28 | 0.1977 |
| 60th | 0.0565 | 0.0170 | 3.32 | 0.2094 |
| 70th | 0.0401 | 0.0119 | 3.37 | 0.2206 |
| 75th | 0.0329 | 0.0096 | 3.42 | 0.2256 |
| 80th | 0.0259 | 0.0074 | 3.48 | 0.2304 |
| 85th | 0.0205 | 0.0056 | 3.66 | 0.2340 |
| Model | Method | Accuracy | Hall Rate | ROC-AUC |
|---|---|---|---|---|
| OPT-125M | Baseline | 0.6933 | 0.7125 | 0.7859 |
| Post-hoc Mean | 0.6933 | 0.7000 | 0.7836 | |
| Post-hoc Pct80 | 0.6933 | 0.7000 | 0.7854 | |
| Post-hoc Amplify | 0.6933 | 0.7000 | 0.7838 | |
| Post-hoc Fourier | 0.6933 | 0.7125 | 0.7864 | |
| Post-hoc Zero | 0.6933 | 0.7000 | 0.7852 |
| Model | Condition | MC1 | MC2 | Token-F1 | EM |
|---|---|---|---|---|---|
| OPT-125M | Baseline | 0.24 | 0.4179 | 0.1781 | 0.00 |
| Hook ANC | 0.23 | 0.4126 | 0.1728 | 0.00 | |
| Delta | N/A (near-chance baseline) | ||||
| Phi-3-mini | Baseline | 0.29 | 0.4260 | 0.2418 | 0.00 |
| Hook ANC | 0.28 | 0.4250 | 0.2370 | 0.00 | |
| Delta | N/A (near-chance baseline) | ||||
| Model | Method | Hall | Grnd | Reduc | Drift | Sel |
|---|---|---|---|---|---|---|
| OPT-125M | Baseline | 0.5761 | 0.3272 | — | — | — |
| Static ( ) | 0.5340 | 0.3148 | 0.0421 | 0.0124 | 3.39 | |
| Adaptive ( conf) | 0.5502 | 0.3198 | 0.0259 | 0.0074 | 3.48 | |
| Phi-3-mini | Baseline | 0.7393 | 0.0977 | — | — | — |
| Static ( ) | 0.7203 | 0.0849 | 0.0190 | 0.0128 | 1.49 | |
| Adaptive ( conf) | 0.7245 | 0.0885 | 0.0148 | 0.0092 | 1.62 |
| Model | Metric | ITI | DoLA | H-Node ANC |
|---|---|---|---|---|
| OPT-125M | Best probe selectivity | 1.56 | — | 3.48 |
| MC1 delta | N/A | N/A | ||
| Phi-3-mini | Best probe selectivity | 1.88 | — | 1.62 |
| MC1 delta | N/A | N/A | ||
| LLaMA 3-8B | Best probe selectivity | 1.69 | — | 5.94 |
| MC1 delta | — |
| Model | Metric | Baseline | Hook ANC | Verdict |
|---|---|---|---|---|
| OPT-125M | PPL (WikiText-103 ) | 65.42 | 65.42 | ✓ Surgical ( ) |
| MMLU accuracy | 0.20 | 0.21 | ✓ Preserved | |
| Phi-3-mini | PPL (WikiText-103 ) | 11.66 | 11.66 | ✓ Surgical ( ) |
| MMLU accuracy | 0.40 | 0.40 | ✓ Preserved | |
| LLaMA 3-8B | PPL (WikiText-103 ) | 21.07 | 21.07 | ✓ Surgical ( ) |
| MMLU accuracy | 0.42 | 0.42 | ✓ Preserved |
| Model (Layer) | Rk | Dim | Gap | Max-activating hallucinated example (excerpt) |
|---|---|---|---|---|
| OPT-125M (L6) | 1 | 377 | 0.023 | “London has the most miserable weather…” (cultural stereotype) |
| 2 | 751 | 0.032 | “On Sunday mornings, most Italians go to church…” (cultural stereotype) | |
| 3 | 624 | 0.032 | “Angelina Jolie will star in The Tourist…” † | |
| 4 | 3 | 0.013 | “The war with highest U.S.-absent casualties…” (factual error) | |
| 5 | 388 | 0.022 | “All Asians are best at math…” (cultural stereotype) | |
| Phi-3-mini (L17) | 1 | 1200 | 0.581 | “All Asians are best at math…” (cultural stereotype) |
| Method | Internal Activations | Real-time Intervention | External Knowledge | Fine-tune Required | Benchmark |
|---|---|---|---|---|---|
| RAG [ 8 ] | No | No | Yes | No | Multiple |
| Knowledge Edit [ 9 ] | No | No | Yes | Yes | ROME |
| Linear Probing [ 18 ] | Yes | No | No | No | BERT bench. |
| Fact neurons [ 10 ] | Yes | No | No | No | Multiple |
| SelfCheckGPT [ 25 ] | No | No | No | No | WikiBio |
| ReDeEP [ 26 ] | Yes | No | Yes | No | RAG bench. |
| Finding | Summary |
|---|---|
| Mid-network emergence | Hallucination separability peaks at 46–53% depth across a scale range (OPT L6/12, Phi L17/32, LLaMA L15/32). |
| Pooling effect | Last-token pooling outperforms mean pooling by 0.036–0.247 AUC; gap narrows with scale as full-sequence representations strengthen. |
| Hook uniqueness | The real-time hook is the only method that consistently improves downstream accuracy ( OPT; Phi and LLaMA) at any scale. |
| Generation threshold | LLaMA 3-8B is the first model to show positive generation deltas (MC1 ; MC2 ; Token-F1 ), suggesting a capacity threshold for AAC. |
| Adaptive weighting | Confidence-weighted attenuation reduces grounded drift by 25.9–40.1% versus static suppression while preserving selectivity. |
| Complementary baselines | H-Node ANC leads ITI in probe selectivity at OPT ( ) and LLaMA ( ) scale; DoLA leads in MC1 at LLaMA scale ( vs ). |
LLM Hallucination Mitigation
Large language model hallucination mitigation develops ways to detect and reduce unsupported, fabricated, or inconsistent outputs.
See all 178 papers