Detecting and Pruning Prominent but Detrimental Neurons in Large Language Models

Ameen Ali Ali, Shahar Katz, Lior Wolf, Ivan Titov

TL;DR

This paper introduces a novel method to improve the generalization of Large Language Models (LLMs) by identifying and pruning "detrimental neurons" that rely on dataset-specific shortcuts rather than robust reasoning. By using Integrated Gradients to pinpoint these neurons and then selectively removing them, the authors demonstrate significant performance gains on various benchmarks, outperforming existing adaptation methods.

What Problem Does This Paper Address?

Large Language Models (LLMs) are incredibly powerful, but they often exhibit a phenomenon called "shortcut learning." This means they learn to perform well on their training data by exploiting superficial patterns or correlations that aren't indicative of true understanding. While these shortcuts can lead to high confidence in familiar scenarios, they severely degrade performance when the model encounters new, out-of-distribution data or tasks. Essentially, the model learns to "cheat" by relying on easy-to-spot cues rather than developing genuine reasoning capabilities. This paper tackles the problem of identifying and mitigating these detrimental, shortcut-driven mechanisms within LLMs to improve their generalization and robustness.

Methods

The core of this paper's contribution lies in its method for detecting and pruning these "Domain-Specific Mechanisms" (DSMs). The approach is built on three key ideas:

  1. Focus on MLPs: The authors hypothesize that detrimental neurons are likely found within the Multi-Layer Perceptron (MLP) sub-layers of transformer architectures, as these are responsible for processing and encoding knowledge.
  2. Integrated Gradients (IG) for Neuron Attribution: They adapt the Integrated Gradients technique, typically used for input feature attribution, to quantify the influence of individual neurons on the model's output. Specifically, they calculate IG with respect to the maximum logit (the model's most confident prediction) for a given input, ignoring the actual ground truth label. This allows them to identify neurons that disproportionately contribute to high-confidence, potentially shortcut-based, predictions.
  3. Selective Pruning: Once neurons are ranked by their IG attribution scores, the method selectively prunes a small subset of the most influential ones within a single MLP layer. This pruning is done by zeroing out the weights of these identified neurons.

The process involves a few-shot approach, using a minimal set of samples (around 10) to identify these DSM neurons and determine the optimal layer and pruning percentage through a grid search on a validation set.

Datasets

The paper evaluates its method on several standard NLP benchmarks, primarily focusing on multiple-choice tasks:

  • Balanced COPA: For commonsense reasoning.
  • XNLI: For multilingual natural language inference.
  • MMLU: For broad knowledge assessment across various subjects.
  • SST-2 and SST-5: For sentiment analysis (binary and multi-class, respectively).
  • BoolQ: For question answering.

The authors also conducted experiments on the XCOPA dataset for multilingual generalization, covering eight diverse languages.

Key Insights and Ideas

  • "Detrimental Neurons" are a Real Phenomenon: The research strongly suggests that LLMs develop specific neurons that are highly influential for confident predictions on training data but hinder generalization. These aren't just random neurons; they are actively contributing to shortcut learning.
  • Integrated Gradients Can Pinpoint Neuron Influence: Adapting IG from input features to internal neurons proves effective in identifying which neurons are driving high-confidence, potentially spurious, predictions.
  • Pruning is More Than Just Compression: Unlike traditional pruning that aims to reduce model size or complexity, this method deliberately targets and removes neurons that are "making the most noise" by exploiting shortcuts, thereby revealing underlying reasoning abilities.
  • Single-Layer Pruning is Sufficient and Efficient: The method demonstrates that pruning within a single MLP layer (specifically the gate_proj layer) is enough to achieve significant performance improvements, making it computationally efficient.
  • Few-Shot Adaptation is Powerful: The approach requires only a handful of samples (around 10) to identify and prune these detrimental neurons, making it highly practical for scenarios with limited labeled data.

Key Results

The proposed DSM neuron pruning method consistently improved performance across various LLM architectures (LLAMA2-7B-CHAT, LLAMA3.1-8B-Instruct, Mistral-7B-Instruct-v0.3, and Qwen2.5-7B-Instruct) and tasks.

  • Significant Accuracy Gains: For example, on LLAMA2-7B-CHAT, the method achieved absolute gains of up to 7.60% on BoolQ and 3.6% on Balanced COPA. On MMLU, accuracy increased from 44.90% to 49.68%.
  • Outperforms Baselines and Other Methods: The pruning approach consistently surpassed random pruning and other parameter-efficient adaptation methods like ITI, CAA, and SADI variants.
  • Robustness to Few Samples: The method showed high stability and performance even with as few as 10 adaptation samples, with minimal variance across random seeds.
  • Transferability: The optimal pruning configuration identified on a small adaptation set effectively transferred to unseen test data, demonstrating robustness.
  • Computational Efficiency: The overhead for computing IG and pruning is negligible compared to traditional fine-tuning, taking only about 37-47 seconds per task.

Limitations and Future Work

  • Focus on Multiple-Choice Tasks: While the paper shows promise, the primary evaluation is on multiple-choice tasks. Extending this to other task types (e.g., generation) could be a future direction.
  • Single-Layer Pruning: The current method focuses on pruning within a single layer. Investigating multi-layer pruning strategies could potentially yield further improvements.
  • Task-Specific Optimization: While the method is robust, the paper notes that optimal sample selection might be task-specific, suggesting avenues for more tailored adaptation.
  • Understanding Neuron Function: While the method identifies detrimental neurons, further work could delve deeper into the specific functions these neurons serve and how their removal truly enables more robust reasoning.

Summary updated

BibTeX
@inproceedings{ali2025detecting,
  author = {Ameen Ali Ali and Shahar Katz and Lior Wolf and Ivan Titov},
  title = {{Detecting and Pruning Prominent but Detrimental Neurons in Large Language Models}},
  booktitle = {COLM},
  year = {2025},
  url = {https://openreview.net/forum?id=cRE1XrHf1h},
}
Figure