Papers
Topics
Authors
Recent
Gemini 2.5 Flash
Gemini 2.5 Flash
102 tokens/sec
GPT-4o
59 tokens/sec
Gemini 2.5 Pro Pro
43 tokens/sec
o3 Pro
6 tokens/sec
GPT-4.1 Pro
50 tokens/sec
DeepSeek R1 via Azure Pro
28 tokens/sec
2000 character limit reached

How Large Language Models Encode Context Knowledge? A Layer-Wise Probing Study (2402.16061v2)

Published 25 Feb 2024 in cs.CL

Abstract: Previous work has showcased the intriguing capability of LLMs in retrieving facts and processing context knowledge. However, only limited research exists on the layer-wise capability of LLMs to encode knowledge, which challenges our understanding of their internal mechanisms. In this paper, we devote the first attempt to investigate the layer-wise capability of LLMs through probing tasks. We leverage the powerful generative capability of ChatGPT to construct probing datasets, providing diverse and coherent evidence corresponding to various facts. We employ $\mathcal V$-usable information as the validation metric to better reflect the capability in encoding context knowledge across different layers. Our experiments on conflicting and newly acquired knowledge show that LLMs: (1) prefer to encode more context knowledge in the upper layers; (2) primarily encode context knowledge within knowledge-related entity tokens at lower layers while progressively expanding more knowledge within other tokens at upper layers; and (3) gradually forget the earlier context knowledge retained within the intermediate layers when provided with irrelevant evidence. Code is publicly available at https://github.com/Jometeorie/probing_llama.

Definition Search Book Streamline Icon: https://streamlinehq.com
References (44)
  1. A review on language models as knowledge bases. CoRR, abs/2204.06031.
  2. Zeyuan Allen-Zhu and Yuanzhi Li. 2023. Physics of language models: Part 3.2, knowledge manipulation. CoRR, abs/2309.14402.
  3. A multitask, multilingual, multimodal evaluation of chatgpt on reasoning, hallucination, and interactivity. CoRR, abs/2302.04023.
  4. Yonatan Belinkov. 2022. Probing classifiers: Promises, shortcomings, and advances. Comput. Linguistics, 48(1):207–219.
  5. Pythia: A suite for analyzing large language models across training and scaling. In International Conference on Machine Learning, ICML 2023, 23-29 July 2023, Honolulu, Hawaii, USA, volume 202 of Proceedings of Machine Learning Research, pages 2397–2430. PMLR.
  6. Language models can explain neurons in language models. https://openaipublic.blob.core.windows.net/neuron-explainer/paper/index.html.
  7. Towards monosemanticity: Decomposing language models with dictionary learning. Transformer Circuits Thread. Https://transformer-circuits.pub/2023/monosemantic-features/index.html.
  8. A survey on evaluation of large language models. CoRR, abs/2307.03109.
  9. Palm: Scaling language modeling with pathways. CoRR, abs/2204.02311.
  10. What you can cram into a single \$&!#* vector: Probing sentence embeddings for linguistic properties. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics, ACL 2018, Melbourne, Australia, July 15-20, 2018, Volume 1: Long Papers, pages 2126–2136. Association for Computational Linguistics.
  11. Toxicity in chatgpt: Analyzing persona-assigned language models. CoRR, abs/2304.05335.
  12. Understanding dataset difficulty with V-usable information. In International Conference on Machine Learning, ICML 2022, 17-23 July 2022, Baltimore, Maryland, USA, volume 162 of Proceedings of Machine Learning Research, pages 5988–6008. PMLR.
  13. Mathematical capabilities of chatgpt. CoRR, abs/2301.13867.
  14. Wes Gurnee and Max Tegmark. 2023. Language models represent space and time.
  15. John Hewitt and Percy Liang. 2019. Designing and interpreting probes with control tasks. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing, EMNLP-IJCNLP 2019, Hong Kong, China, November 3-7, 2019, pages 2733–2743. Association for Computational Linguistics.
  16. C-eval: A multi-level multi-discipline chinese evaluation suite for foundation models. CoRR, abs/2305.08322.
  17. Large language models struggle to learn long-tail knowledge. In International Conference on Machine Learning.
  18. Diederik P. Kingma and Jimmy Ba. 2015. Adam: A method for stochastic optimization. In 3rd International Conference on Learning Representations, ICLR 2015, San Diego, CA, USA, May 7-9, 2015, Conference Track Proceedings.
  19. Internet-augmented language models through few-shot prompting for open-domain question answering. CoRR, abs/2203.05115.
  20. When not to trust language models: Investigating effectiveness and limitations of parametric and non-parametric memories. CoRR, abs/2212.10511.
  21. When not to trust language models: Investigating effectiveness of parametric and non-parametric memories. In Annual Meeting of the Association for Computational Linguistics.
  22. Locating and editing factual associations in GPT. In NeurIPS.
  23. Exploring the role of BERT token representations to explain sentence probing results. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, EMNLP 2021, Virtual Event / Punta Cana, Dominican Republic, 7-11 November, 2021, pages 792–806. Association for Computational Linguistics.
  24. Webgpt: Browser-assisted question-answering with human feedback. ArXiv, abs/2112.09332.
  25. OpenAI. 2022. Introducing chatgpt. https://openai.com/blog/chatgpt.
  26. OpenAI. 2023. Gpt-4 technical report. ArXiv, abs/2303.08774.
  27. Linguistic ambiguity analysis in chatgpt. CoRR, abs/2302.06426.
  28. Information-theoretic probing for linguistic structure. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, ACL 2020, Online, July 5-10, 2020, pages 4609–4622. Association for Computational Linguistics.
  29. Is chatgpt a general-purpose natural language processing task solver? CoRR, abs/2302.06476.
  30. Language models are unsupervised multitask learners. OpenAI blog, 1(8):9.
  31. A primer in bertology: What we know about how BERT works. Trans. Assoc. Comput. Linguistics, 8:842–866.
  32. What do you learn from context? probing for sentence structure in contextualized word representations. In 7th International Conference on Learning Representations, ICLR 2019, New Orleans, LA, USA, May 6-9, 2019. OpenReview.net.
  33. Scan and snap: Understanding training dynamics and token composition in 1-layer transformer. CoRR, abs/2305.16380.
  34. Joma: Demystifying multilayer transformers via joint dynamics of mlp and attention.
  35. Llama 2: Open foundation and fine-tuned chat models. CoRR, abs/2307.09288.
  36. Jesse Vig and Yonatan Belinkov. 2019. Analyzing the structure of attention in a transformer language model. In Proceedings of the 2019 ACL Workshop BlackboxNLP: Analyzing and Interpreting Neural Networks for NLP, BlackboxNLP@ACL 2019, Florence, Italy, August 1, 2019, pages 63–76. Association for Computational Linguistics.
  37. Resolving knowledge conflicts in large language models.
  38. Adaptive chameleon or stubborn sloth: Unraveling the behavior of large language models in knowledge clashes. CoRR, abs/2305.13300.
  39. A theory of usable information under computational constraints. In 8th International Conference on Learning Representations, ICLR 2020, Addis Ababa, Ethiopia, April 26-30, 2020. OpenReview.net.
  40. Do large language models know what they don’t know? In Findings of the Association for Computational Linguistics: ACL 2023, Toronto, Canada, July 9-14, 2023, pages 8653–8665. Association for Computational Linguistics.
  41. OPT: open pre-trained transformer language models. CoRR, abs/2205.01068.
  42. Explainability for large language models: A survey. CoRR, abs/2309.01029.
  43. Context-faithful prompting for large language models. CoRR, abs/2303.11315.
  44. Representation engineering: A top-down approach to ai transparency.
User Edit Pencil Streamline Icon: https://streamlinehq.com
Authors (6)
  1. Tianjie Ju (16 papers)
  2. Weiwei Sun (93 papers)
  3. Wei Du (124 papers)
  4. Xinwei Yuan (3 papers)
  5. Zhaochun Ren (117 papers)
  6. Gongshen Liu (37 papers)
Citations (13)
Youtube Logo Streamline Icon: https://streamlinehq.com