从习语看“Transformer”的形象记忆
Understanding Transformer Memorization Recall Through Idioms
摘要:
为了产生准确的预测,语言模型(LM)必须在泛化和记忆之间取得平衡。然而,很少有人知道的机制,其中Transformer LM运用他们的记忆能力。什么时候模型决定输出一个记住的短语,然后如何从记忆中检索这个短语?在这项工作中,我们提供了第一个方法论的框架探测和表征回忆记忆序列的Transformer LM。首先,我们列出了检测触发记忆回忆的模型输入的标准,并提出了通常满足这些标准的输入习语。接下来,我们构建了一个英语习语数据集,并使用它来比较记忆与非记忆输入的模型行为。具体来说,我们通过将模型的隐藏表示解释为输出概率分布的逐步细化来分析内部预测构建过程。我们发现,在不同的模型大小和架构中,记忆预测是一个两步的过程:早期层将预测的令牌提升到输出分布的顶部,上层增加模型的置信度。这表明记忆的信息是在网络的早期层存储和检索的。最后,我们展示了我们的方法的实用性,超越成语记忆的事实陈述。总的来说,我们的工作为理解记忆回忆迈出了第一步,并为今后的Transformer记忆研究提供了方法论基础。
英文摘要:
To produce accurate predictions, language models (LMs) must balance between generalization and memorization. Yet, little is known about the mechanism by which transformer LMs employ their memorization capacity. When does a model decide to output a memorized phrase, and how is this phrase then retrieved from memory? In this work, we offer the first methodological framework for probing and characterizing recall of memorized sequences in transformer LMs. First, we lay out criteria for detecting model inputs that trigger memory recall, and propose idioms as inputs that typically fulfill these criteria. Next, we construct a dataset of English idioms and use it to compare model behavior on memorized vs. non-memorized inputs. Specifically, we analyze the internal prediction construction process by interpreting the model's hidden representations as a gradual refinement of the output probability distribution. We find that across different model sizes and architectures, memorized predictions are a two-step process: early layers promote the predicted token to the top of the output distribution, and upper layers increase model confidence. This suggests that memorized information is stored and retrieved in the early layers of the network. Last, we demonstrate the utility of our methodology beyond idioms in memorized factual statements. Overall, our work makes a first step towards understanding memory recall, and provides a methodological basis for future studies of transformer memorization.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。