arXiv:2504.15471cs.CL2025-04NeurIPS被引 5

发现语言模型中仅用前一个词预测下一个词的极简子网络

Bigram Subnetworks: Mapping to Next Tokens in Transformer Language Models

  • 定位出仅依赖当前词预测下一个词的最小参数子网络
  • 该子网络不足总参数0.2%,却对模型性能至关重要
  • 适合研究模型内部机制与可解释性的人参考

在 Transformer 语言模型中,激活向量从当前词嵌入逐步转化为下一个词预测。为探究这一转换的最小形式,我们识别出能够进行大词频(bigram)预测的子网络——即仅基于当前词进行下一个词预测的简单模型。实验发现,即使在高达10亿参数的完整训练模型中也能找到这类子网络,且其规模通常小于模型总参数的0.2%,但对模型性能极为关键。这些子网络主要集中于首个 Transformer MLP 层,且与最优剪枝子网络高度重叠。机制上,这些子网络常复现全模型中第一层引起的显著变化:将激活对齐至下一个词预测,而非当前词表示。结果表明,大词频子网络是语言模型实现基本下一个词预测的必要且充分的最小参数集合,并驱动了残差流中从当前到下一个词激活的转化。它们可作为构建更复杂模型电路的基础,推动对语言模型内部机制的研究。

原文摘要 · Abstract (English)

In Transformer language models, activation vectors transform from current token embeddings to next token predictions as they pass through the model. To isolate a minimal form of this transformation, we identify language model subnetworks that make bigram predictions, naive next token predictions based only on the current token. We find that bigram subnetworks can be found in fully trained language models up to 1B parameters, and these subnetworks are critical for model performance even when they consist of less than 0.2% of model parameters. Bigram subnetworks are concentrated in the first Transformer MLP layer, and they overlap significantly with subnetworks trained to optimally prune a given model. Mechanistically, the bigram subnetworks often recreate a pattern from the full models where the first layer induces a sharp change that aligns activations with next token predictions rather than current token representations. Our results demonstrate that bigram subnetworks comprise a minimal subset of parameters that are both necessary and sufficient for basic next token predictions in language models, and they help drive the transformation from current to next token activations in the residual stream. These subnetworks can lay a foundation for studying more complex language model circuits by building up from a minimal circuit.

语言模型子网络可解释性机制分析

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。