To perform few-shot learning, language models extract signals from a few input-label pairs, aggregate them into a learned prediction rule, and apply this rule to new inputs. How is this implemented in the forward pass of modern transformer models? To explore this question, we study a structured family of few-shot learning tasks for which the true prediction rule is to add an integer $k$ to the input. We introduce a novel method that localizes the model's few-shot learning ability to only a few attention heads. This method and the findings generalize to four additional task families spanning arithmetic and semantic tasks. We then perform an in-depth analysis of individual heads via dimensionality reduction and decomposition of the heads' output spaces. For example, in Llama-3-8B-Instruct, we reduce the mechanism underlying these tasks to just three attention heads with six-dimensional subspaces, in which four dimensions track the units digit using trigonometric functions with periods $2$, $5$, and $10$, while two dimensions track magnitude using low-frequency components. To deepen our understanding of this mechanism, we also derive a mathematical identity relating the ''aggregator'' and ''extractor'' subspaces of attention heads, allowing us to track the flow of information from individual examples to a final aggregated concept. Our results demonstrate how tracking low-dimensional subspaces of localized heads throughout a forward pass can provide insight into fine-grained computational structures in language models. Our code is available at https://github.com/xyVickyHu/addition-subspaces.
PASs-MoE: Mitigating Misaligned Co-drift among Router and Experts via Pathway Activation Subspaces for Continual Learning
Institute of Automation, Chinese Academy of Sciences(中国科学院自动化研究所);University of Chinese Academy of Sciences(中国科学院大学);National University of Singapore(新加坡国立大学);Southeast University, Nanjing, China(南京东南大学);Wuhan AI Research, Wuhan, China(武汉人工智能研究院)
Safety Subspaces are Not Linearly Distinct: A Fine-Tuning Case Study
Mohamed bin Zayed University of Artificial Intelligence(莫扎德·本·扎耶德人工智能大学);University of California San Diego(加州大学圣地亚哥分校);Massachusetts Institute of Technology(麻省理工学院)
OffQ: Taming Structured Outliers in LLM Quantization by Offsetting
School of Computer and Communication Sciences, EPFL, Switzerland(瑞士联邦理工学院计算机与通信科学学院);Huawei, Switzerland(华为公司);Swiss Data Science Center, ETHZ & EPFL, Switzerland(瑞士数据科学中心,苏黎世联邦理工学院与联邦理工学院)
Interpretable Steering of Large Language Models with Feature Guided Activation Additions
Raffles Science Institute(莱佛士科学学院);Raffles Institution(莱佛士书院);Nous Research(努斯研究机构);Centre for Frontier AI Research (CFAR)(前沿人工智能研究中心);Agency for Science Technology and Research (A*STAR)(新加坡科技研究局)
Merging Beyond: Streaming LLM Updates via Activation-Guided Rotations
City University of Hong Kong, Hong Kong SAR(香港城市大学);Tsinghua University(清华大学);Huawei Noah’s Ark Lab, Hong Kong SAR(华为诺亚实验室(香港));University of Hong Kong(香港大学);Hong Kong University of Science and Technology (Guangzhou)(香港理工大学(广州))
Is Inference Mediated by Distinct Semantic Structures in LLMs? A Mechanistic Interpretation
University of Manchester(曼彻斯特大学);University of Sheffield(谢菲尔德大学);Idiap Research Institute(Idiap研究所);CRUK National Biomarker Centre, University of Manchester(CRUK国家生物标志物中心,曼彻斯特大学)
Learning Functional Subspaces for Neural Network Compression
Helmholtz Munich(亥姆霍兹慕尼黑研究中心);Technical University of Munich(慕尼黑工业大学);MCML(慕尼黑机器学习中心);Orbital Industries(轨道工业公司);LTCI, Télécom Paris, Institut Polytechnique de Paris(巴黎高等电信学院LTCI实验室,巴黎综合理工学院);Columbia University(哥伦比亚大学);University of Copenhagen(哥本哈根大学);Technical University of Denmark(丹麦技术大学);New York University(纽约大学)
Dimensional Collapse in Transformer Attention Outputs: A Challenge for Sparse Dictionary Learning
Shanghai Innovation Institute, Shanghai, China(上海创新研究院);OpenMOSS Team, School of Computer Science, Fudan University, Shanghai, China(开放MOSS团队,计算机科学学院,复旦大学)
Activation-Space Personality Steering: Hybrid Layer Selection for Stable Trait Control in LLMs
Network Analysis and Social Influence Modelling (NASIM) Lab(网络分析与社会影响建模实验室);School of Physics Maths and Computing, The University of Western Australia(西澳大学物理数学与计算学院);School of Psychological Science, The University of Western Australia(西澳大学心理学科学学院);School of Computing, Macquarie University(麦考瑞大学计算机学院)
AIM-ZO: Activation-Informed Subspace Maintenance for Zeroth-Order LLM Fine-Tuning
Southern University of Science and Technology(南方科技大学);National University of Singapore(新加坡国立大学);Huawei Technologies Ltd.(华为技术有限公司);City University of Hong Kong(香港城市大学)
Beyond Variance: Knowledge-Aware LLM Compression via Fisher-Aligned Subspace Diagnostics
Department of Computer Science, Iowa State University(计算机科学系,爱荷华州立大学);Department of Civil, Construction & Environmental Engineering, Iowa State University(土木、建设与环境工程系,爱荷华州立大学)