Skip to yearly menu bar Skip to main content


Oral
in
Workshop: New Frontiers in Associative Memories

How Linearly Associative are Memories in Large Language Models?

Akshat Gupta · Nehal Sindhu · Gopala Anumanchipalli


Abstract:

Large Language Models (LLMs) exhibit remarkable capacities to store and retrieve factual knowledge, yet the precise mechanisms by which they encode and recall this information remain under debate. Two main frameworks have been proposed to explain how memory storage arises within transformer feed-forward layers: (1) a key-value memory view, and (2) linear associative memories (LAMs). In this paper, we investigate the extent to which the second MLP matrix in LLMs (GPT-2 XL, Pythia, Llama2-7B) behaves as a linear associative memory. By measuring pairwise angles among activation vectors, we find that the second MLP matrix exhibits relatively high orthogonality across randomly selected tokens, suggesting minimal crosstalk and supporting the LAM interpretation for generic retrieval. However, we also discover that subject-token representations used in factual recall are significantly less orthogonal, indicating greater interference and entanglement. This implies that editing factual “memories” within these matrices may trigger unintended side effects in other related knowledge. Our results highlight both the promise and the pitfalls of viewing feed-forward layers as linear associative memories, underscoring the need for careful strategies when modifying factual representations in LLMs.

Chat is not available.