Introduction
Large Language Models (LLMs) demonstrate remarkable versatility across a vast array of tasks. However, the internal mechanisms enabling this multi-task capability remain opaque. Specifically, the field faces two critical challenges: understanding why learning one task can improve performance on another (generalization) and preventing the loss of previous knowledge when learning new tasks (catastrophic forgetting). This research investigates whether LLMs manage these tasks through specialized "circuits" at the neuron level, specifically within the Feed-Forward Network (FFN) layers.
Methodology: Detecting Task-Specific Neurons
The researchers propose a three-stage framework to identify and utilize task-specific neurons.
- Identification via Gradient Attribution: Using a first-order Taylor expansion, the model calculates a relevance score for each neuron by measuring the impact on loss when a neuron's output is zeroed. The top $k\%$ (typically 10%) of neurons are designated as "task-specific."
- Verification: The significance of these neurons is validated by deactivating them and observing performance degradation. Results show that deactivating task-specific neurons leads to a significantly sharper drop in accuracy compared to deactivating random neurons.
- Neuron-level Continuous Fine-Tuning (NCFT): A novel training method is introduced where only the identified task-specific neurons for a given task are updated, while the rest of the model remains frozen.
Understanding Generalization and Specialization
The study reveals that generalization is fundamentally linked to neuron overlap. When two tasks share a high proportion of task-specific neurons, learning one task naturally benefits the other. Interestingly, the research found that "over-training" too many neurons can be counterproductive; specialization performance typically peaks when only 50-70% of task-specific neurons are updated, suggesting that excessive parameter updates can lead to internal interference.
Furthermore, knowledge transfer is not uniform across the model's architecture. Parameter similarity is lowest in the initial layers, peaks in the middle-to-deep layers, and decreases in the final layers. This suggests that LLMs develop a shared conceptual representation in the middle layers before specializing for specific task outputs.
Exploration and Continual Learning
To address catastrophic forgetting, the authors explored the application of these neurons in sequential task learning. By isolating updates to task-specific neurons, the model can acquire new skills without overwriting the "hardware" used by previous tasks. This is extended into W-NCFT, which incorporates task similarity weighting during inference to further boost performance.
Experimental Results
The framework was evaluated across diverse benchmarks, including classification (e.g., SST-2, AmazonFood) and generation (e.g., Xsum, CNN/DailyMail).
- Impact of Deactivation: In Llama-2-7b, deactivating 10% of task-specific neurons dropped classification accuracy from 87.7% to 76.0%, compared to 84.8% for random deactivation.
- Mitigating Forgetting: In continual learning scenarios, the W-NCFT method maintained 72.0% average accuracy across eight tasks, whereas standard sequential fine-tuning (SeqFT) dropped to 34.6%.
- Efficiency: High performance is achievable by updating only a small fraction of the model, provided those parameters are correctly identified as task-relevant.
Conclusion and Future Directions
This work provides a granular view of how LLMs organize task-specific knowledge. While focusing on FFNs, future research should investigate similar structures in Multi-Head Attention (MHA) modules. Additionally, developing dynamic methods for determining neuron capacity ($k$) and weighting task similarities during training could further enhance model efficiency and generalization.
Summary updated