Memory Retrieval in Transformers: Insights from The Encoding Specificity Principle
On the map: LLM safety and security → Machine unlearning
Abstract (arXiv)
While explainable artificial intelligence (XAI) for large language models (LLMs) remains an evolving field with many unresolved questions, increasing regulatory pressures have spurred interest in its role in ensuring transparency, accountability, and privacy-preserving machine unlearning. Despite recent advances in XAI have provided some insights, the specific role of attention layers in transformer based LLMs remains underexplored. This study investigates the memory mechanisms instantiated by attention layers, drawing on prior research in psychology and computational psycholinguistics that links Transformer attention to cue based retrieval in human memory. In this view, queries encode the retrieval context, keys index candidate memory traces, attention weights quantify cue trace similarity, and values carry the encoded content, jointly enabling the construction of a context representation that precedes and facilitates memory retrieval. Guided by the Encoding Specificity Principle, we hypothesize that the cues used in the initial stage of retrieval are instantiated as keywords. We provide converging evidence for this keywords-as-cues hypothesis. In addition, we isolate neurons within attention layers whose activations selectively encode and facilitate the retrieval of context-defining keywords. Consequently, these keywords can be extracted from identified neurons and further contribute to downstream applications such as unlearning.
Key facts. No citing papers in the map yet (data through 14 Oct 2026). Placed in Machine unlearning, one of 12 directions in LLM safety and security. Builds on 42 of its 68 references that are in the map. First posted on arXiv 28 Jan 2026.
Builds on
42 of 68 references.
Closest ancestors · 4
Same direction, newest first
- 2024Machine Unlearning of Pre-trained Large Language Models23 Feb
- 2024TOFU: A Task of Fictitious Unlearning for LLMs11 Jan
- 2023Who's Harry Potter? Approximate Unlearning in LLMs3 Oct
- 2022Knowledge Unlearning for Mitigating Privacy Risks in Language Models4 Oct
Other references · 38
- 2017Attention Is All You Needcited by 60,361
- 2017A Unified Approach to Interpreting Model Predictionscited by 6,555
- 2019BERTScore: Evaluating Text Generation with BERTcited by 5,512
- 2016"Why Should I Trust You?": Explaining the Predictions of Any Classifiercited by 5,070
- 2014Neural Machine Translation by Jointly Learning to Align and Translatecited by 4,548
- 2022Locating and Editing Factual Associations in GPTcited by 2,691
- 2013Deep Inside Convolutional Networks: Visualising Image Classification Models and Saliency Mapscited by 2,371
- 2017Learning Important Features Through Propagating Activation Differencescited by 1,458
- 2020Transformer Feed-Forward Layers Are Key-Value Memoriescited by 1,336
- 2019What Does BERT Look At? An Analysis of BERT's Attentioncited by 1,003
- 2019Attention is not Explanationcited by 929
- 2019Analyzing Multi-Head Self-Attention: Specialized Heads Do the Heavy Lifting, the Rest Can Be Prunedcited by 856
26 more
- 2020Quantifying Attention Flow in Transformerscited by 775
- 2022Quantifying Memorization Across Neural Language Modelscited by 763
- 2022GPT-NeoX-20B: An Open-Source Autoregressive Language Modelcited by 713
- 2019Attention is not not Explanationcited by 636
- 2017Interpretable Explanations of Black Boxes by Meaningful Perturbationcited by 612
- 2022Transformer Feed-Forward Layers Build Predictions by Promoting Concepts in the Vocabulary Spacecited by 532
- 2020Efficient Content-Based Sparse Attention with Routing Transformerscited by 471
- 2023Explainability for Large Language Models: A Surveycited by 333
- 2019A Multiscale Visualization of Attention in the Transformer Modelcited by 292
- 2023Does Localization Inform Editing? Surprising Differences in Causality-Based Localization vs. Knowledge Editing in Language Modelscited by 243
- 2020Synthesizer: Rethinking Self-Attention in Transformer Modelscited by 205
- 2020When Machine Unlearning Jeopardizes Privacycited by 198
- 2020The elephant in the interpretability room: Why use attention as explanation when we have saliency methods?cited by 122
- 2024AttnLRP: Attention-Aware Layer-Wise Relevance Propagation for Transformerscited by 120
- 2019Augmenting Self-attention with Persistent Memorycited by 93
- 2022MAUVE Scores for Generative Models: Theory and Practicecited by 36
- 2023AtMan: Understanding Transformer Predictions Through Memory Efficient Attention Manipulationcited by 31
- 2023Causal Interpretation of Self-Attention in Pre-Trained Transformerscited by 30
- 2021Accounting for Agreement Phenomena in Sentence Comprehension with Transformer Language Models: Effects of Similarity-based Interference on Surprisal and Attentioncited by 27
- 2025Key-value memory in the braincited by 24
- 2023A Language Model with Limited Memory Capacity Captures Interference in Human Sentence Processingcited by 22
- 2022Entropy- and Distance-Based Predictors From GPT-2 Attention Patterns Predict Reading Times Over and Above GPT-2 Surprisalcited by 14
- 2024Attention Meets Post-hoc Interpretability: A Mathematical Perspectivecited by 11
- 2024Attention Mechanisms Don't Learn Additive Models: Rethinking Feature Importance for Transformerscited by 8
- 2024Mechanism and Emergence of Stacked Attention Heads in Multi-Layer Transformerscited by 7
- 2025If Attention Serves as a Cognitive Model of Human Memory Retrieval, What is the Plausible Memory Representation?cited by 4
Built on by
Not cited yet.
Similar, not cited
Close in wording, no citation either way
- 2025Disentangling Recall and Reasoning in Transformer Models through Layer-wise Attention and Activation Analysis
- 2024Self-Attention Limits Working Memory Capacity of Transformer-Based Models
- 2024Talking Heads: Understanding Inter-layer Communication in Transformer Language Models
- 2025Beyond Semantics: How Temporal Biases Shape Retrieval in Transformer and State-Space Models
- 2025Some Attention is All You Need for Retrieval
- 2026In-context superposition: human-like working memory interference in large language models
- 2026Positional versus Symbolic Attention Heads: Learning Dynamics, RoPE Geometry, and Length Generalization
- 2024Rethinking Associative Memory Mechanism in Induction Head