Understanding and Controlling Repetition Neurons and Induction Heads in In-Context Learning

Nhi Hoai Doan, Takaharu Hiraoka, Kentaro Inui2025 · DOI

Abstract: Nhi Hoai Doan, Tatsuya Hiraoka, Kentaro Inui. Proceedings of the 14th International Joint Conference on Natural Language Processing and the 4th Conference of the Asia-Pacific Chapter of the Association for Computational Linguistics.

2025.

Introduction

Large Language Models (LLMs) possess a remarkable ability for in-context learning (ICL), enabling them to perform tasks based on just a few examples. However, this same mechanism is often a double-edged sword, leading to "repetition degeneration" where models get trapped in redundant output loops. This research investigates the internal mechanics of this phenomenon, identifying a specific "detector-to-executor" circuit involving induction heads and repetition neurons. By understanding this relationship, the authors demonstrate how to surgically suppress repetitive behavior without compromising the model's learning capabilities.

The Repetition Problem in ICL

In-context learning relies heavily on induction heads—attention mechanisms that identify and copy patterns from previous tokens. While essential for following few-shot demonstrations, these heads also drive the degenerate repetitions that plague LLM outputs. Previous attempts to solve this by removing induction heads were too blunt, often destroying the model's ability to learn from context entirely. This paper explores repetition neurons within Feed-Forward Networks (FFNs) as a more precise lever for control.

Methods: Mechanistic Analysis and Ablation

The researchers performed a detailed mechanistic study on models like Llama-3.1-8B. They first identified repetition neurons by monitoring FFN activations during repetitive vs. normal generation and flagged induction heads using prefix-matching scores.

Conceptual overview of the intervention: deactivating specific neurons can resolve repetitive generation while preserving pattern recognition.

The model's architecture was segmented into early, middle, and late layers to observe how these components interact across the depth of the network. Through systematic ablation studies, the team measured the causal impact of silencing these units on both synthetic pattern-matching benchmarks (like Recursion and Centre-embedding) and real-world tasks like translation and sentiment analysis.

Key Insights: The Detector-to-Executor Cascade

The study reveals that pattern recognition is not a localized event but a multi-stage process:

  1. Detectors: Induction heads (primarily in earlier layers) act as detectors that recognize structural patterns in the input.
  2. Executors: These detectors then trigger repetition neurons in the late layers, which act as executors to produce the final repetitive output.

Crucially, the researchers found a "Middle Layer Sweet Spot." Repetition neurons in the middle layers contribute to repetitive loops but are not strictly necessary for ICL, as their absence can be compensated for by subsequent layers. In contrast, induction heads are "master switches"; ablating even 3% of them leads to a catastrophic collapse in performance.

Key Results: Surgical Control of Repetition

The experiments yielded several breakthrough findings regarding model control:

  • Surgical Precision: By deactivating 250 repetition neurons in the middle layers, the researchers reduced repetitive loops by up to 40% while maintaining nearly 100% of the original ICL performance.
  • Layer Sensitivity: As shown in the ablation results, late-layer neurons are far more critical. Silencing them causes ICL recall to drop by as much as 60%.
  • Task Stability: On downstream tasks like WMT19 translation, middle-layer ablation successfully suppressed degenerate repetitions with negligible impact on translation quality metrics (BLEU/ROUGE).
Pattern and non-pattern recall across different layer segments. Late-layer neurons (green) are critical for pattern recognition, while middle-layer neurons (orange) offer a safer target for intervention.

Limitations and Future Directions

While this work provides a clearer map of the LLM's internal repetition circuitry, some questions remain. The current study used "hard" ablation (zeroing out neurons); future work could explore "graded" scaling for even finer control. Additionally, while late-layer neurons are clearly executors, it is still debated whether they encode semantic meaning or merely amplify signals. Extending these findings to long-form creative writing and complex multi-step reasoning will be essential for broader application.

Summary updated

BibTeX
@misc{doan2025understanding,
  author = {Nhi Hoai Doan and Takaharu Hiraoka and Kentaro Inui},
  title = {{Understanding and Controlling Repetition Neurons and Induction Heads in In-Context Learning}},
  year = {2025},
  doi = {10.18653/v1/2025.ijcnlp-long.153},
}
Figure