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

首个令牌广播者:Transformer中语言身份与分布式鲁棒性的机制起源

First-Token Broadcasters: Mechanistic Origins of Language Identity and Distributed Robustness in Transformers

Irvington High School(欧文顿高中);GenAI4E;Mapua University(马普阿大学)

Arjun Pillai, Christian Hoang, Anjelo Jann Laroza

AI总结:

通过因果干预方法LIHA,发现Transformer中少量注意力头(如GPT-2的L6H1)持续关注首个令牌并广播语言信号,且消融后补偿呈现层级前馈模式;指令微调将语言身份电路重组至早期层。

摘要:

为什么多语言语言模型有时会生成错误语言,为什么这很难修复?我们引入语言身份头消融(LIHA),这是一种因果干预方法,逐个将每个注意力头归零,并在涵盖七种语言的2,700个提示-语言对的平行数据集中测量由此产生的语言切换率。应用于GPT-2时,LIHA识别出一小组首个令牌广播者头——以L6H1为首(切换率0.32,高于总体均值3.23σ)——这些头持续关注首个提示令牌,并在整个生成过程中传播其语言信号。当头被消融时,补偿性重新分布具有统计显著性(p < 10^{-5}),并遵循方向性、层次性模式:补偿总是招募被消融头上方的层中的头,表明是前馈级联而非全局扩散。为了探究训练机制如何塑造这些电路,我们将LIHA应用于一个受控对——Qwen2.5-1.5B-Base和Qwen2.5-1.5B-Instruct——两者架构和大小相同,仅训练不同。基础模型几乎平坦(最大SR=0.016,336个头中有200个SR=0.0);指令模型将因果影响急剧集中在第0层,以L0H5为首(SR=0.224,高于均值8.93σ),所有其他层接近零。这种受控比较提供了直接因果证据,表明指令微调将语言身份电路重组为早期层定位。使用中文和俄语的扩展实验证实,在GPT-2中,首个令牌广播是脚本特定的,非拉丁语言在第0层处理——与指令微调模型相同的位置。代码和数据将在发表后发布。

英文摘要:

How is language identity represented and causally maintained in transformers, and to what extent do the mechanisms identified in one language set transfer to other languages and training regimes? We introduce Language Identity Head Ablation (LIHA), a causal intervention that zeros each attention head individually and measures the resulting language switch rate. Across our multilingual evaluation sets, LIHA identifies heads whose ablation has disproportionate effects on output language. In GPT-2, a small set of first-token broadcaster heads---led by L6H1 (switch rate 0.32, 3.23$σ$ above the population mean)---attend persistently to the first prompt token across query positions. The combination of persistent first-token attention and causal sensitivity suggests that these heads participate in maintaining output language. Following ablation, first-token attention increases in heads above the ablated layer for the ablations tested (permutation test against random five-head sets, $p < 10^{-5}$). We do not test whether these heads functionally compensate for the ablated head. We also compare Qwen2.5-1.5B-Base and Qwen2.5-1.5B-Instruct, which are matched in architecture and parameter count but differ in training history. The base model is nearly flat (max SR$=$0.016, 200/336 heads at SR$=$0.0), whereas the instruct model concentrates causal influence at layer~0, led by L0H5 (SR$=$0.224, 8.93$σ$ above the mean). Finally, GPT-2 heads identified from the European-language experiments show no observed switch effects on the tested Chinese and Russian prompts, while other early-layer heads do show effects. Because script, typology, and tokenization vary together in this comparison, these results do not isolate a specifically script-driven mechanism. Repository is available at https://github.com/ajlrza/First-Token-Broadcasters.

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

↑