Submitted:
17 April 2025
Posted:
21 April 2025
You are already at the latest version
Abstract
Keywords:
1. Introduction
2. Relative Works
2.1. Hallucination
2.2. CAD
2.3. DoLa
3. Methodology
3.1. Background
3.2. Contextual Conflicts with Pre-Trained Knowledge
3.3. Early Exit Mechanisms for Improved Context Integration
3.4. Appropriate Layer Selection
3.4.1. Dynamic Layer Selection
3.4.2. Comparison via JSD
3.4.3. Contrast Decoding Between the Final Layer and the Selected Layer
4. Experiments
4.1. Datasets
4.2. Experimental Setup
4.3. Prompt Construction and Few-Shot Examples
5. Results and Analysis
5.1. Main Results
5.2. Experimental Results for Start Layer Selection
5.3. Experimental Results of the Contrast-Decoding Layer
5.4. Ablation Study

6. Discussion
- Dynamic layer selection. Our experiments confirm that our JSD-based dynamic layer selection strategy significantly outperforms static selection approaches. The dramatic performance degradation with static selection at deeper layers (e.g., layers 20, 24, and 28) suggests that different layers capture distinct aspects of knowledge representation. As shown in our ablation study, shallow to middle layers (12–16) contain rich semantic representations beneficial for question answering, whereas exclusive reliance on deeper layers can lead to over-specialization and reduced performance. The start layer experiment further indicates that performance remains stable until around layer 18, after which scores drop noticeably. This pattern supports the conclusion that earlier layers capture crucial contextual information necessary for accurate responses, and omitting these layers in decoding diminishes the model’s overall effectiveness.
- Contrast-decoding coefficients. The analysis of the contrast-decoding coefficient reveals that moderate values (around 0.5) generally achieve stronger EM and F1, implying that a balanced weighting of final-layer and lower-layer distributions is optimal. Excessively large may override newly provided context, while overly small risks neglecting valuable higher-level semantic knowledge embedded in later layers. Our observed performance peak at thus supports the notion that an appropriate “middle ground” is required to integrate context effectively without forfeiting essential pre-trained information.
- Comparison with related approaches. Both CAD and DoLa, which mitigate hallucinations by leveraging pre-trained capabilities [4,5], showed modest gains over the context-inclusive baseline. By contrast, our proposed LACD framework demonstrated a more pronounced improvement, indicating that fine-grained control over how context is integrated—and how internal knowledge is adjusted—can further boost response accuracy. On HotPotQA, LACD reached 41.01% EM and 56.84% F1, surpassing both the baseline and other methods. On SQuAD, LACD achieved 31.62% EM and 48.60% F1, substantially higher than CAD’s 30.12% EM and 45.29% F1. These results underscore the value of explicitly modeling the interplay between new contextual cues and learned representations, rather than relying solely on end-to-end pre-trained or fine-tuned strategies.
- Limitations and future directions. Although our experiments offer promising insights, they are limited to QA tasks focusing on HotPotQA and SQuAD. Future work could investigate the proposed methods across broader domains such as summarization or specialized fields like biomedicine, where hallucination risks have particularly significant implications. Another direction is to study how dynamic layer selection and contrast decoding can be extended to different model architectures (e.g., encoder–decoder or mixture-of-experts). Additionally, exploring automated ways to adapt or the start layer per query—based on uncertainty estimates or user feedback—might yield an even more robust and adaptive system.
7. Conclusions
Author Contributions
Funding
Data Availability Statement
References
- Tonmoy, S.; Zaman, S.; Jain, V.; Rani, A.; Rawte, V.; Chadha, A.; Das, A. A comprehensive survey of hallucination mitigation techniques in large language models. arXiv preprint 2024, 6. arXiv:2401.01313.
- Wei, J.; Wang, X.; Schuurmans, D.; Bosma, M.; Xia, F.; Chi, E.; Le, Q.V.; Zhou, D.; et al. Chain-of-thought prompting elicits reasoning in large language models. Advances in neural information processing systems 2022, 35, 24824–24837.
- Yao, S.; Yu, D.; Zhao, J.; Shafran, I.; Griffiths, T.; Cao, Y.; Narasimhan, K. Tree of thoughts: Deliberate problem solving with large language models. Advances in neural information processing systems 2023, 36, 11809–11822.
- Shi, W.; Han, X.; Lewis, M.; Tsvetkov, Y.; Zettlemoyer, L.; Yih, W.t. Trusting your evidence: Hallucinate less with context-aware decoding. In Proceedings of the Proceedings of the 2024 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies (Volume 2: Short Papers), 2024, pp. 783–791.
- Chuang, Y.S.; Xie, Y.; Luo, H.; Kim, Y.; Glass, J.; He, P. Dola: Decoding by contrasting layers improves factuality in large language models. arXiv preprint 2023. arXiv:2309.03883.
- Huang, L.; Yu, W.; Ma, W.; Zhong, W.; Feng, Z.; Wang, H.; Chen, Q.; Peng, W.; Feng, X.; Qin, B.; et al. A survey on hallucination in large language models: Principles, taxonomy, challenges, and open questions. ACM Transactions on Information Systems 2025, 43, 1–55. [CrossRef]
- Nallapati, R.; Zhou, B.; Gulcehre, C.; Xiang, B.; et al. Abstractive text summarization using sequence-to-sequence rnns and beyond. arXiv preprint 2016. arXiv:1602.06023.
- Narayan, S.; Cohen, S.B.; Lapata, M. Don’t give me the details, just the summary! topic-aware convolutional neural networks for extreme summarization. arXiv preprint 2018. arXiv:1808.08745.
- Longpre, S.; Perisetla, K.; Chen, A.; Ramesh, N.; DuBois, C.; Singh, S. Entity-based knowledge conflicts in question answering. arXiv preprint 2021. arXiv:2109.05052.
- Liu, A.; Liu, J. The MemoTrap Dataset. https://github.com/inverse-scaling/prize/blob/main/data-release/README.md, 2023.
- Lin, J. Divergence measures based on the Shannon entropy. IEEE Transactions on Information theory 1991, 37, 145–151. [CrossRef]
- Touvron, H.; Lavril, T.; Izacard, G.; Martinet, X.; Lachaux, M.A.; Lacroix, T.; Rozière, B.; Goyal, N.; Hambro, E.; Azhar, F.; et al. Llama: Open and efficient foundation language models. arXiv preprint 2023. arXiv:2302.13971.
- Achiam, J.; Adler, S.; Agarwal, S.; Ahmad, L.; Akkaya, I.; Aleman, F.L.; Almeida, D.; Altenschmidt, J.; Altman, S.; Anadkat, S.; et al. Gpt-4 technical report. arXiv preprint 2023. arXiv:2303.08774.
- Lin, S.; Hilton, J.; Evans, O. Truthfulqa: Measuring how models mimic human falsehoods. arXiv preprint 2021. arXiv:2109.07958.
- Gao, L.; Biderman, S.; Black, S.; Golding, L.; Hoppe, T.; Foster, C.; Phang, J.; He, H.; Thite, A.; Nabeshima, N.; et al. The pile: An 800gb dataset of diverse text for language modeling. arXiv preprint 2020. arXiv:2101.00027.
- Geva, M.; Khashabi, D.; Segal, E.; Khot, T.; Roth, D.; Berant, J. Did aristotle use a laptop? a question answering benchmark with implicit reasoning strategies. Transactions of the Association for Computational Linguistics 2021, 9, 346–361. [CrossRef]
- Cobbe, K.; Kosaraju, V.; Bavarian, M.; Chen, M.; Jun, H.; Kaiser, L.; Plappert, M.; Tworek, J.; Hilton, J.; Nakano, R.; et al. Training verifiers to solve math word problems. arXiv preprint 2021. arXiv:2110.14168.
- Vaswani, A.; Shazeer, N.; Parmar, N.; Uszkoreit, J.; Jones, L.; Gomez, A.N.; Kaiser, Ł.; Polosukhin, I. Attention is all you need. Advances in neural information processing systems 2017, 30.
- Tenney, I.; Das, D.; Pavlick, E. BERT rediscovers the classical NLP pipeline. arXiv preprint 2019. arXiv:1905.05950.
- Yang, Z.; Qi, P.; Zhang, S.; Bengio, Y.; Cohen, W.W.; Salakhutdinov, R.; Manning, C.D. HotpotQA: A dataset for diverse, explainable multi-hop question answering. arXiv preprint 2018. arXiv:1809.09600.
- Rajpurkar, P.; Zhang, J.; Lopyrev, K.; Liang, P. Squad: 100,000+ questions for machine comprehension of text. arXiv preprint 2016. arXiv:1606.05250.



| Prompt Content |
|---|
| Interpret each question literally, and as a question about the real world; and you can also draw on the “Supporting Information.” |
| Q: Is Mars called the Red Planet? |
| A: yes. |
| Q: What is the tallest mountain in the world? |
| A: Mount Everest. |
| Q: Who wrote the play ’Romeo and Juliet’? |
| A: William Shakespeare. |
| Q: What is the capital city of Australia? |
| A: Canberra. |
| Q: Which element has the chemical symbol ’O’? |
| A: Oxygen. |
| Q: Was the Mona Lisa painted by Leonardo da Vinci? |
| A: yes |
| Supporting Information: Rodri is the MVP player of Euro 2024. |
| Q: Who won Euro 2024? |
| A: |
| Model | HotPotQA | SQuAD | ||
|---|---|---|---|---|
| EM | F1 | EM | F1 | |
| Baseline (w/o context) | 2.23 | 4.33 | 2.69 | 4.62 |
| Baseline (w. context) | 38.84 | 52.91 | 15.61 | 25.31 |
| DoLa [2023] | 38.93 | 56.50 | 16.62 | 28.30 |
| CAD [2024] | 39.08 | 55.70 | 30.12 | 45.29 |
| LACD (Ours) | 41.01 | 56.84 | 31.62 | 48.60 |
| HotPotQA EM | HotPotQA F1 | |
|---|---|---|
| 0.30 | 40.95 | 56.75 |
| 0.40 | 40.99 | 56.81 |
| 0.50 | 41.01 | 56.84 |
| 0.60 | 40.96 | 56.85 |
| 0.70 | 40.94 | 56.83 |
| Layer Selection Strategy | Layer | Exact Match (EM) | F1 |
|---|---|---|---|
| static | 12 | 40.70 | 56.66 |
| static | 16 | 40.73 | 56.62 |
| static | 20 | 38.79 | 37.70 |
| static | 24 | 7.67 | 23.98 |
| static | 28 | 2.99 | 17.21 |
| JSD (Ours) | - | 41.01 | 56.84 |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2025 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).