LLM Interpretability: Tracing How LLMs Answer Factual Queries and Math Questions
In this paper, we study how LLMs like GPT store and retrieve facts to answer factual queries. Using a pretrained GPT-2 model, we evaluate factual accuracy on knowledge datasets, math questions, and hand-crafted prompts, employing metrics such as weighted first token accuracy, F1 score for token overlap, perplexity, and BLEU. We leverage interpretability techniques like attention visualization, logit-lens analysis, and causal tracing to identify layers responsible for knowledge retrieval. To enhance the model's factual and mathematical capabilities, we implement prompt engineering, retrieval-augmented generation (RAG), and fine-tuning, comparing their impact on accuracy and fact retrieval mechanisms.
Authors
- He Nan Tony Li
- Shweta Agrawal (ORCID: https://orcid.org/0000-0002-1463-5555)
- Lucas Lu
Institutions
- Google (United States) (US)
- Stanford University (US)
Publication Details
- Published
- 2025-05-05
- DOI
- https://doi.org/10.1109/cai64502.2025.00151
- Primary Topic
- Natural Language Processing Techniques
- Type
- article
- Field-Weighted Citation Impact
- 0.00