Large Language Models (LLMs) have the capacity to store and recall facts. Through experimentation with open-source models, we observe that this ability to retrieve facts can be easily manipulated by changing contexts, even without altering their factual meanings. These findings highlight that LLMs might behave like an associative memory model where certain tokens in the contexts serve as clues to retrieving facts. We mathematically explore this property by studying how transformers, the building blocks of LLMs, can complete such memory tasks. We study a simple latent concept association problem with a one-layer transformer and we show theoretically and empirically that the transformer gathers information using self-attention and uses the value matrix for associative memory.
翻译:大型语言模型(LLMs)具备存储与提取事实的能力。通过对开源模型的实验研究,我们发现这种事实提取能力极易受到语境变化的操控,即使语境调整并未改变其事实含义。这些发现表明,LLMs可能表现出类似联想记忆模型的行为,其中语境中的特定标记可作为提取事实的线索。我们通过研究构成LLMs基础架构的transformer如何完成此类记忆任务,从数学角度深入探讨了这一特性。针对简单的潜在概念关联问题,我们以单层transformer为研究对象,通过理论分析与实验验证表明:transformer通过自注意力机制收集信息,并利用值矩阵实现联想记忆功能。