揭示注意力层如何像人类记忆一样通过关键词检索信息。
Memory Retrieval in Transformers: Insights from The Encoding Specificity Principle
- 将注意力机制类比为人类记忆的线索检索,关键词作为初始线索
- 发现注意力层中特定神经元专用于编码关键线索
- 结果可应用于模型遗忘与透明性增强
尽管大语言模型(LLMs)的可解释人工智能(XAI)仍处于发展初期,但日益增长的监管压力推动了其在透明度、问责制和隐私保护型机器遗忘中的作用研究。尽管近期在XAI方面取得进展,但基于Transformer的LLMs中注意力层的具体作用仍缺乏深入探索。本研究基于心理学与计算心理语言学的已有成果,将Transformer注意力机制与人类记忆中的线索依赖性检索相联系:查询编码检索上下文,键索引候选记忆痕迹,注意力权重衡量线索与记忆的相似度,值承载编码内容,共同构建前置的上下文表征以支持记忆检索。依据编码特异性原则,我们假设检索初期的线索由关键词体现,并提供了多方证据支持‘关键词即线索’假说。此外,我们识别出注意力层中对特定上下文关键词具有选择性激活的神经元。这些神经元可提取关键词,进一步服务于下游应用如模型遗忘。
原文摘要 · Abstract (English)
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.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。