Understanding the inner workings of large language models (LLMs) is crucial for advancing their theoretical foundations and real-world applications. While the attention mechanism and multi-layer perceptrons (MLPs) have been studied independently, their interactions remain largely unexplored. This study investigates how attention heads and next-token neurons interact in LLMs to predict new words. We propose a methodology to identify next-token neurons, find prompts that highly activate them, and determine the upstream attention heads responsible. We then generate and evaluate explanations for the activity of these attention heads in an automated manner. Our findings reveal that some attention heads recognize specific contexts relevant to predicting a token and activate a downstream token-predicting neuron accordingly. This mechanism provides a deeper understanding of how attention heads work with MLP neurons to perform next-token prediction. Our approach offers a foundation for further research into the intricate workings of LLMs and their impact on text generation and understanding.
MLP-SRGAN: A Single-Dimension Super Resolution GAN using MLP-Mixer
Toronto Metropolitan University(多伦多都会大学);University of Toronto(多伦多大学);Institute of Biomedical Engineering, Science and Technology (iBEST)(生物医学工程科学与技术研究所)
Interpreting and Improving Large Language Models in Arithmetic Calculation
University of Science and Technology of China(中国科学技术大学);Alibaba Cloud(阿里云);Hong Kong Baptist University(香港浸会大学);Institute of Artificial Intelligence, Hefei Comprehensive National Science Center(合肥综合性国家科学中心人工智能研究院)
Approximation Theory for Lipschitz Continuous Transformers
Faculty of Life and Medical Sciences, Department of Biomedical Engineering, Doshisha University, RIKEN AIP(生命与医学科学学院,生物医学工程系,大原大学,RIKEN AIP);Department of Applied Mathematics and Theoretical Physics, University of Cambridge(应用数学与理论物理系,剑桥大学)
Merging Multi-Task Models via Weight-Ensembling Mixture of Experts
National Engineering Research Center for Multimedia Software(国家多媒体软件工程技术研究中心);School of Computer Science, Wuhan University(武汉大学计算机学院);Hubei Luojia Laboratory(湖北珞珈实验室);Sun Yat-sen University(中山大学);JD Explore Academy(京东探索研究院);Mohamed bin Zayed University of Artificial Intelligence(穆罕默德·本·扎耶德人工智能大学);Nanyang Technological University(南洋理工大学)