Introduction
Large Language Models (LLMs) like Llama-7B demonstrate impressive arithmetic capabilities, yet the underlying mechanisms remain largely opaque. While previous research has identified specific attention heads crucial for mathematical tasks, the interaction between these heads and Feed-Forward Network (FFN) layers—the model's primary knowledge repository—has been poorly understood. This paper introduces Comparative Neuron Analysis (CNA) to reconstruct the full information flow from input prompt to numerical answer.
Methodology: Comparative Neuron Analysis (CNA)
The CNA framework identifies the "logic chain" by comparing neuron behavior in a standard model against a "broken" version where critical attention heads are disabled. The process involves four key steps:
- Head Intervention: Systematically zeroing out attention heads to identify "arithmetic heads" whose removal significantly degrades accuracy.
- Importance Scoring: Calculating the contribution of every FFN neuron to the log probability of the correct mathematical answer.
- CNA Comparison: Mapping which FFN neurons are activated by specific arithmetic heads.
- Vocabulary Projection: Projecting high-importance neurons into vocabulary space to interpret their semantic meaning (e.g., mapping a neuron to the digit "8").
The Arithmetic Logic Chain
The researchers uncovered a consistent four-stage pipeline that LLMs use to process arithmetic queries like 3 + 5 =.
- (a) Feature Enhancing: Shallow FFN neurons extract latent features from input numbers.
- (b) Feature Transferring: Shallow attention layers transform these latent features into interpretable numerical concepts and move them to the final token position.
- (c) Feature Predicting: Specialized "arithmetic heads" activate deep FFN neurons corresponding to the correct result.
- (d) Prediction Enhancing: These deep neurons trigger a cascade, where lower-layer neurons activate higher-layer neurons to solidify the final prediction.
Experimental Results
The study reveals that arithmetic ability is highly localized. In Llama-7B, only three out of 1,024 attention heads caused a performance drop greater than 10% when removed.
As shown in the data, Head $17^{22}$ (Layer 17, Head 22) is a critical bottleneck for addition. Removing it causes 2-digit addition accuracy to plummet from 96.8% to 42.9%.
Beyond localization, CNA enables efficient model pruning. By identifying the top 500 FFN neurons, the authors pruned 95% of neurons in deep layers (17-31). After minimal fine-tuning, this sparse model achieved 82.3% accuracy, significantly outperforming a baseline model of equivalent size (17.1%). Furthermore, the method proved effective for bias mitigation; editing just 18 "gender-biased" neurons reduced model bias by 35.7%.
Discussion and Limitations
While CNA provides a powerful lens into LLM internals, it relies on vocabulary projection, a technique with incomplete theoretical foundations. Additionally, the sensitivity of results to different intervention methods suggests a need for standardized attribution benchmarks. The authors also highlight a potential security risk: the ability to pinpoint critical neurons could allow for precise, malicious "poisoning" of model behaviors with minimal intervention. Future research will explore how these mechanisms evolve during pre-training and across larger model scales.
Summary updated