arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2605.22005cs.LGcs.AIcs.CL
收藏

检查你的大语言模型的秘密词典!五行代码揭示你的大语言模型学到了什么(包括它不应该学到的)

Check Your LLM's Secret Dictionary! Five Lines of Code Reveal What Your LLM Learned (Including What It Shouldn't Have)

Mgnite Inc.(Mgnite公司)

Hisashi Miyashita

AI总结:

通过对lm_head权重矩阵进行奇异值分解(仅需五行PyTorch代码且无需模型推理),直接从模型权重中揭示可解释的语义子空间,并发现模型训练数据组成和策展哲学。

摘要:

我们展示了基于Transformer的大语言模型的lm_head权重矩阵的奇异值分解——仅需五行PyTorch代码且无需模型推理——直接从模型权重中揭示可解释的语义子空间。每个左奇异向量识别出当隐藏状态与相应奇异方向对齐时最容易被选中的词汇标记;检查这些聚类揭示了模型的训练数据组成和策展哲学。 分析GPT-OSS-120B、Gemma-2-2B和Qwen2.5-1.5B,我们发现奇异值谱和词汇聚类结构在不同模型间存在系统性差异:GPT呈现出功能分化子空间的渐进层次;Gemma以19世纪前的英语正字法为主,形成阶梯式聚类结构,这可能有助于高输出可控性;Qwen展现出广泛的多语言覆盖,同时其子空间的词汇被作者认为在伦理上不适合直接发表。 基础-指令对比表明,伦理上令人担忧的子空间源自预训练,并且不会被后训练对齐移除。我们引入词汇聚类得分(VCS)来量化子空间一致性,以及加权投影得分(WPS)作为静态故障标记检测器;将WPS应用于GPT-OSS-120B,无需任何模型推理即可恢复shokubutsu-hyakka-tsu(ID 137606),这是CJK语言社区中广泛报道的一个著名故障标记。我们提出了问题词汇内容根本原因的分类法,并呼吁将lm_head SVD分析作为标准发布前安全审计步骤。我们的发现进一步指出了SVD引导的分词器优化和更可控的大语言模型设计方向。

英文摘要:

We show that singular value decomposition of the lm_head} weight matrix of a transformer-based large language model -- requiring only five lines of PyTorch and no model inference -- reveals interpretable semantic subspaces directly from the model weights. Each left singular vector identifies the vocabulary tokens most readily selected when the hidden state aligns with the corresponding singular direction; inspecting these clusters exposes the model's training data composition and curation philosophy. Analysing GPT-OSS-120B, Gemma-2-2B, and Qwen2.5-1.5B, we find that singular value spectra and vocabulary cluster structures differ systematically across models: GPT exhibits a graduated hierarchy of functionally differentiated subspaces; Gemma is dominated by pre-nineteenth-century English orthography, forming a stepwise clustering structure that may contribute to high output controllability; and Qwen exhibits broad multilingual coverage alongside subspaces whose vocabulary the authors have determined to be ethically inappropriate for direct publication. Base-instruct comparison reveals that ethically concerning subspaces originate in pretraining and are not removed by post-training alignment. We introduce the Vocabulary Cluster Score (VCS) to quantify subspace coherence, and the Weighted Projection Score (WPS) as a static glitch token detector; applying WPS to GPT-OSS-120B recovers shokubutsu-hyakka-tsu (ID 137606), a well-known glitch token widely reported in the CJK language community, without any model inference. We propose a taxonomy of root causes for problematic vocabulary content and call for lm_head} SVD analysis to be adopted as a standard pre-release safety auditing step. Our findings further suggest directions toward SVD-guided tokenizer optimisation and more controllable LLM design.

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

↑