Elamur Research⌕
☰
home / papers / 2026 / TPA: Next Token Probability Attribution for Detecting Hallucinations in RAG

TPA: Next Token Probability Attribution for Detecting Hallucinations in RAG

Paper · 2026 · Pengqian Lu, Jie Lu, Anjin Liu et al.

Summary

The paper addresses hallucination detection in retrieval-augmented generation, where a hallucination is an answer that contradicts a relevant, correct retrieved context. Earlier mechanistic work, notably ReDeEP, reduced the problem to a tug-of-war between parametric knowledge in FFN layers and the retrieved passage. The authors argue that this picture leaves out other parts of the transformer. Their method, TPA, runs one teacher-forced pass over a generated response. A logit-lens-style probe on the residual stream breaks each token's probability exactly into seven additive parts, attributed respectively to the user's query, the retrieved passage, previously generated tokens, the token itself, the FFN, the final LayerNorm and the initial embedding. Attention contributions are divided among the input segments according to attention weights. The scores are then pooled per POS tag, and a classifier is trained on these features. Across five open models evaluated on RAGTruth and Dolly, TPA reports state-of-the-art detection. SHAP analysis shows signals that go beyond the FFN-vs-RAG view, such as LayerNorm effects on numerals. These signals also differ between architectures, which supports using a learned detector instead of fixed rules.

Key points

  • Backbones tested: Llama2-7B, Llama2-13B, Llama3-8B, Mistral-7B and Qwen3-8B; evaluation data include RAGTruth and Dolly.
  • In the ablations, removing the Final LayerNorm features lowers F1 by 5.83% on Llama-3-8B, and removing RAG features lowers it by 3.01% on Llama-2-7B.
  • POS-conditioned aggregation (TPA-POS) gives the best F1 in all seven backbone–dataset settings:
    • It beats simple averaging (TPA-Mean) by 1.8–4.6% F1 on RAGTruth.
    • It beats TPA-Mean by up to 22.5% on Dolly with LLaMA2-13B.
  • Hallucination signals depend on the model:
    • The LN_NUM feature indicates hallucination in Llama2-7B but indicates factuality in Llama2-13B.
    • The top grounding feature is RAG_ADP in Llama3-8B, compared with RAG_NOUN in Llama2.
  • Practical limits:
    • TPA needs white-box access to the model.
    • Feature extraction takes about 20 s per response, roughly 17 GPU-hours per model and dataset.
    • It relies on an English POS tagger (spaCy).

Our summary of the paper, in our own words — not its text. The work belongs to its authors; read it at the links above.

 Institutions

 Fields, topics and concepts

Cite

Cite as Pengqian Lu, Jie Lu, Anjin Liu and Guangquan Zhang. 2026. TPA: Next Token Probability Attribution for Detecting Hallucinations in RAG. Proceedings of the 64th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers).

The paper itself, not this page. BibTeX from the library's record of the work. DOI 10.18653/v1/2026.acl-long.1159

@inproceedings{lu2026tpa,
  title = {{TPA: Next Token Probability Attribution for Detecting Hallucinations in RAG}},
  author = {Pengqian Lu, Jie Lu, Anjin Liu and Guangquan Zhang},
  booktitle = {Proceedings of the 64th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)},
  year = {2026},
  doi = {10.18653/v1/2026.acl-long.1159},
  url = {https://doi.org/10.18653/v1/2026.acl-long.1159}
}

References

35 references, 11 of them with a card of ours. ↗ leads to the work, «find» searches for one we have no id for yet.

  1. Amos Azaria and Tom Mitchell. 2023. The internal state of an llm knows when it’s lying. In Findings of the Association for Computational Linguistics: EMNLP 2023, pages 967–976.
  2. Collin Burns, Haotian Ye, Dan Klein, and Jacob Steinhardt. 2022. Discovering latent knowledge in language models without supervision. arXiv preprint arXiv:2212.03827. find
  3. Chao Chen, Kai Liu, Ze Chen, Yi Gu, Yue Wu, Mingyuan Tao, Zhihang Fu, and Jieping Ye. 2024. Inside: Llms’ internal states retain the power of hallucination detection. find
  4. Tianqi Chen and Carlos Guestrin. 2016. Xgboost: A scalable tree boosting system. In Proceedings of the 22nd acm sigkdd international conference on knowledge discovery and data mining, pages 785– 794. find
  5. Yuyan Chen, Zehao Li, Shuangjie You, Zhengyu Chen, Jingwen Chang, Yi Zhang, Weinan Dai, Qingpei Guo, and Yanghua Xiao. 2025. Attributive reasoning for hallucination diagnosis of large language models. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 39, pages 23660–23668. find
  6. Roi Cohen, May Hamri, Mor Geva, and Amir Globerson. 2023. Lm vs lm: Detecting factual errors via cross examination. In Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing, pages 12621–12640.
  7. Shahul Es, Jithin James, Luis Espinosa Anke, and Steven Schockaert. 2024. Ragas: Automated evaluation of retrieval augmented generation. In Proceedings of the 18th Conference of the European Chapter of the Association for Computational Linguistics: System Demonstrations, pages 150–158.
  8. Robert Friel and Atindriyo Sanyal. 2023. Chainpoll: A high efficacy method for llm hallucination detection. arXiv preprint arXiv:2310.18344. — [arXiv:2310.18344](https://arxiv.org/abs/2310.18344) find
  9. Aaron Grattafiori, Abhimanyu Dubey, Abhinav Jauhri, Abhinav Pandey, Abhishek Kadian, Ahmad Al-Dahle, Aiesha Letman, Akhil Mathur, Alan Schelten, Alex Vaughan, and 1 others. 2024. The llama 3 herd of models. arXiv preprint arXiv:2407.21783.
  10. Nuno M Guerreiro, Elena Voita, and André FT Martins. 2023. Looking for a needle in a haystack: A comprehensive study of hallucinations in neural machine translation. In Proceedings of the 17th Conference of the European Chapter of the Association for Computational Linguistics, pages 1059–1075.
  11. Jiatong Han, Jannik Kossen, Muhammed Razzak, Lisa Schut, Shreshth A Malik, and Yarin Gal. 2024. Semantic entropy probes: Robust and cheap hallucination detection in llms. In ICML 2024 Workshop on Foundation Models in the Wild. find
  12. Zheng Yi Ho, Siyuan Liang, Sen Zhang, Yibing Zhan, and Dacheng Tao. 2025. Novo: Norm voting off hallucinations with attention heads in large language models. In The Thirteenth International Conference on Learning Representations. find
  13. Matthew Honnibal, Ines Montani, Sofie Van Lan-deghem, Adriane Boyd, and 1 others. 2020. spacy: Industrial-strength natural language processing in python. find
  14. Xiangkun Hu, Dongyu Ru, Lin Qiu, Qipeng Guo, Tianhang Zhang, Yang Xu, Yun Luo, Pengfei Liu, Yue Zhang, and Zheng Zhang. 2024. Refchecker: Reference-based fine-grained hallucination checker and benchmark for large language models. arXiv preprint arXiv:2405.14486. — [arXiv:2405.14486](https://arxiv.org/abs/2405.14486) find
  15. Lei Huang, Weijiang Yu, Weitao Ma, Weihong Zhong, Zhangyin Feng, Haotian Wang, Qianglong Chen, Weihua Peng, Xiaocheng Feng, Bing Qin, and 1 others. 2025. A survey on hallucination in large language models: Principles, taxonomy, challenges, and open questions. ACM Transactions on Information Systems,…
  16. Saurav Kadavath, Tom Conerly, Amanda Askell, Tom Henighan, Dawn Drain, Ethan Perez, Nicholas Schiefer, Zac Hatfield-Dodds, Nova DasSarma, Eli Tran-Johnson, and 1 others. 2022. Language models (mostly) know what they know. arXiv preprint arXiv:2207.05221. find
  17. Hakyung Lee, Keon-Hee Park, Hoyoon Byun, Jeyoon Yeom, Jihee Kim, Gyeong-Moon Park, and Kyungwoo Song. 2024. Ced: Comparing embedding differences for detecting out-of-distribution and hallucinated text. In Findings of the Association for Computational Linguistics: EMNLP 2024, pages 14866– 14882. find
  18. Patrick Lewis, Ethan Perez, Aleksandra Piktus, Fabio Petroni, Vladimir Karpukhin, Naman Goyal, Heinrich Küttler, Mike Lewis, Wen-tau Yih, Tim Rocktäschel, and 1 others. 2020. Retrieval-augmented generation for knowledge-intensive nlp tasks. Advances in neural information processing systems, 33:9459–…
  19. Kenneth Li, Oam Patel, Fernanda Viégas, Hanspeter Pfister, and Martin Wattenberg. 2023. Inference-time intervention: Eliciting truthful answers from a language model. Advances in Neural Information Processing Systems, 36:41451–41530.
  20. Weitang Liu, Xiaoyun Wang, John Owens, and Yixuan Li. 2020. Energy-based out-of-distribution detection. Advances in neural information processing systems, 33:21464–21475. find
  21. Andrey Malinin and Mark Gales. 2021. Uncertainty estimation in autoregressive structured prediction. In International Conference on Learning Representations. find
  22. Potsawee Manakul, Adian Liusie, and Mark Gales. 2023. Selfcheckgpt: Zero-resource black-box hallucination detection for generative large language models. In Proceedings of the 2023 conference on empirical methods in natural language processing, pages 9004– 9017. find
  23. Grégoire Montavon, Alexander Binder, Sebastian Lapuschkin, Wojciech Samek, and Klaus-Robert Müller. 2019. Layer-wise relevance propagation: an overview. Explainable AI: interpreting, explaining and visualizing deep learning, pages 193–209. find
  24. Cheng Niu, Yuanhao Wu, Juno Zhu, Siliang Xu, Kashun Shum, Randy Zhong, Juntong Song, and Tong Zhang. 2024. Ragtruth: A hallucination corpus for developing trustworthy retrieval-augmented language models. In Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volu…
  25. Tianhang Zhang, Lin Qiu, Qipeng Guo, Cheng Deng, Yue Zhang, Zheng Zhang, Chenghu Zhou, Xinbing Wang, and Luoyi Fu. 2023. Enhancing uncertainty-based hallucination detection with stronger focus. In Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing, pages 915– 932.… find
  26. A Seongheon Park, Xuefeng Du, Min-Hsuan Yeh, Haobo Wang, and Yixuan Li. 2025. Steer LLM latents for hallucination detection. In Forty-second International Conference on Machine Learning. find
  27. We expand the right-hand side (RHS) of Eq. 8 by substituting the definitions of each term. First, consider the summation term. By substitut-(l) (l) ing ∆P att and ∆P ffn , the intermediate probe value (l) Φ(h mid ) cancels out within each layer: Jie Ren, Jiaming Luo, Yao Zhao, Kundan Krishna, Mohamm… find
  28. Yakir Yehuda, Itzik Malkiel, Oren Barkan, Jonathan Weill, Royi Ronen, and Noam Koenigstein. 2024. Interrogatellm: Zero-resource hallucination detection in llm-generated answers. In Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages… find
  29. (l)  (l) L X (l) (l) − Φ(h (l−1) )] + [Φ(h (l) ) − Φ(h mid )]) L   X = Φ(h (l) ) − Φ(h (l−1) ) l=1 This summation forms a telescoping series where adjacent terms cancel: L X (Φ(h (l) ) − Φ(h (l−1) )) l=1 = (Φ(h (1) ) − Φ(h (0) )) + . . . + (Φ(h (L) ) − Φ(h (L−1) )) = Φ(h (L) ) − Φ(h (0) ) Now, su… find
  30. An Yang, Anfeng Li, Baosong Yang, Beichen Zhang, Binyuan Hui, Bo Zheng, Bowen Yu, Chang Gao, Chengen Huang, Chenxu Lv, and 1 others. 2025. Qwen3 technical report. arXiv preprint arXiv:2505.09388.
  31. Zhongxiang Sun, Xiaoxue Zang, Kai Zheng, Jun Xu, Xiao Zhang, Weijie Yu, Yang Song, and Han Li. 2025. Redeep: Detecting hallucination in retrieval-augmented generation via mechanistic interpretability. In ICLR. find
  32. Hugo Touvron, Louis Martin, Kevin Stone, Peter Albert, Amjad Almahairi, Yasmine Babaei, Nikolay Bashlykov, Soumya Batra, Prajjwal Bhargava, Shruti Bhosale, and 1 others. 2023. Llama 2: Open foundation and fine-tuned chat models. arXiv preprint arXiv:2307.09288.
  33. Adi Simhi, Itay Itzhak, Fazl Barez, Gabriel Stanovsky, and Yonatan Belinkov. 2025. Trust me, i’m wrong: Llms hallucinate with certainty despite knowing the answer. In Findings of the Association for Computational Linguistics: EMNLP 2025, pages 14665– 14688. find
  34. Hsuan Su, Ting-Yao Hu, Hema Swetha Koppula, Kundan Krishna, Hadi Pouransari, Cheng-Yu Hsieh, Cem Koc, Joseph Yitan Cheng, Oncel Tuzel, and Raviteja Vemulapalli. 2025. Learning to reason for hallucination span detection. arXiv preprint arXiv:2510.02173. — [arXiv:2510.02173](https://arxiv.org/abs/2510.02173) find
  35. Proof of Theorem 1 ∆P initial + (Φ(h \| (L) ∆P LN (0) ) − Φ(h {z Summation )) = P final } The RHS simplifies exactly to P final (y), which completes the proof. find

Updated

↑ back to top

This page in Markdown → https://md.research.elamur.ai/free/en/papers/lu-2026-tpa-next-token-probability-attribution/