arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2610.13895cs.CLcs.AI

任务上下文塑造语言模型中的组件角色

Task Context Shapes Component Roles in Language Models

University of Pennsylvania(宾夕法尼亚大学);Yale University(耶鲁大学)

Sovesh Mohapatra, Dani S Bassett

AI总结:

本研究发现任务上下文会改变语言模型共享组件响应的图事实及输出对后续计算的影响,通过干预实验揭示了不同模型中注意力头的任务依赖影响力,为理解模型共享参数的功能及指导干预提供了网络视角。

摘要:

大型语言模型会在不同任务中复用相同的注意力头,但仅识别这些共享的注意力头无法解释它们在每个任务中的功能差异。一个自然的灵感来源是大脑共享区域间的任务依赖交互,这为语言模型计算的网络视角提供了动机。本研究使用相同的图事实(即指定哪些有向连接存在的陈述),比较不同任务下固定模型组件的表现。我们测量了干预措施对注意力头和后续层激活状态的影响(影响力),以及对模型答案的影响(重要性)。任务变化会重新分配五个开放权重模型的影响力,这些模型涵盖四个系列,参数规模在15亿到140亿之间。在Gemma-2-9B和Qwen3-14B模型中,激活编辑会改变早期内部激活向量,并切换模型读取的图事实,而书面指令保持不变。相同的注意力头随后会对不同的图事实做出响应,并以不同方式影响后续组件。对于每个提示,我们构建两个线性响应图,一个在编辑前,一个在编辑后,每个图通过测量早期注意力头的变化来预测后续注意力头的响应。在一项独立的事实干预中,与两个图的平均值相比,对应条件下的图使Gemma的均方预测误差降低了53.6%,Qwen的均方预测误差降低了5.0%。这些发现表明,任务上下文既改变了共享组件响应的图事实,也改变了它们的输出对后续计算的影响。网络视角可能有助于解释模型如何使用共享参数执行不同的计算,而任务依赖影响力的测量也可指导旨在改变一种行为同时保留其他行为的干预措施。

英文摘要:

Large language models reuse the same attention heads across tasks, but identifying these shared heads does not explain what they do differently in each task. A natural source of inspiration is task-dependent interactions among shared brain regions, which motivate a network view of language-model computation. Here, we compare fixed model components across tasks using identical graph facts, statements specifying which directed connections are present. We measure how interventions affect attention heads and the activation state in later layers (influence), as well as the answer (importance). Task changes redistribute the influence in five open-weight models spanning four families and 1.5-14 billion parameters. In Gemma-2-9B and Qwen3-14B, an activation edit changes an early internal activation vector and switches which fact the model reads while the written instruction stays fixed. The same heads then respond to different graph facts and influence later components differently. For each prompt, we construct two linear response maps, one before the edit and one after it. Each map predicts a later head's response from a measured change in an earlier head. For a separate factual intervention, the map for the corresponding condition reduces mean squared prediction error by 53.6% in Gemma and 5.0% in Qwen compared with the average of the two maps. These findings show that task context changes both which graph facts the shared components respond to and how their outputs affect later computation. A network account may help explain how models use shared parameters to perform different computations. Measurements of task-dependent influence could also guide interventions intended to alter one behavior while preserving others.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑