动态权重嫁接:在Transformer中本地化微调的事实知识
Dynamic Weight Grafting: Localizing Finetuned Factual Knowledge in Transformers
AI总结:
研究提出动态权重嫁接技术,揭示Transformer在生成过程中通过两种路径检索微调事实知识:增强残差流与即时回忆信息。
摘要:
当LLM在微调过程中学习到新事实(例如新电影上映、新当选的教皇等)时,这些信息会去向哪里?实体是否在增强关系信息时立即被丰富,还是模型在预测前即时回忆信息?或者,所有上述情况都成立,LLM通过多种冗余启发式方法实现?现有的本地化方法(例如激活修补)不适用于这种分析,因为它们通常替换残差流的一部分,从而覆盖先前的信息。为了填补可解释性缺口,我们提出了动态权重嫁接,这是一种分析技术,可以有选择地将微调模型的子集权重嫁接到预训练模型上。使用这种技术,我们展示了两种不同的检索微调关系信息的路径:1)在处理与实体对应的token时,通过增强残差流来引入关系信息(例如“Zendaya”在“Zendaya与蒂莫西·查拉梅合演”中);2)在生成目标事实前,在最终token位置回忆此信息。在某些情况下,模型需要从这两种路径中获取信息以正确生成微调事实,而在其他情况下,仅需“增强”或“回忆”路径即可。我们本地化了“回忆”路径到模型组件——发现“回忆”通过任务特定的注意力机制和最终层的feed-forward网络中的实体特定提取步骤发生。通过针对模型组件和参数,而不是仅仅激活,我们能够理解在生成过程中微调知识是如何被检索的。
英文摘要:
When an LLM learns a new fact during finetuning (e.g., new movie releases, newly elected pope, etc.), where does this information go? Are entities enriched with relation information immediately, or do models recall information just-in-time before a prediction? Or, are "all of the above" true, with LLMs implementing multiple redundant heuristics? Existing localization approaches (e.g., activation patching) are ill-suited for this analysis because they usually replace parts of the residual stream, thus overriding previous information. To fill this interpretability gap, we propose dynamic weight grafting, an analysis technique that selectively grafts subsets of weights from a finetuned model onto a pretrained model. Using this technique, we show two separate pathways for retrieving finetuned relation information: 1) "enriching" the residual stream with relation information while processing the tokens that correspond to an entity (e.g., "Zendaya" in "Zendaya co-starred with Timothée Chalamet" and 2) "recalling" this information at the final token position before generating a target fact. In some cases, models need information from both of these pathways to correctly generate finetuned facts while, in other cases, either the "enrichment" or "recall" pathway alone is sufficient. We localize the "recall" pathway to model components -- finding that "recall" occurs via both task-specific attention mechanisms and an entity-specific extraction step in the feedforward networks of the final layers before prediction. By targeting model components and parameters, as opposed to just activations, we are able to understand the mechanisms by which finetuned knowledge is retrieved during generation.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。