Table of Contents
Fetching ...

CircuitSeer: Mining High-Quality Data by Probing Mathematical Reasoning Circuits in LLMs

Shaobo Wang, Yongliang Miao, Yuancheng Liu, Qianli Ma, Ning Liao, Linfeng Zhang

TL;DR

CircuitSeer shifts data selection for LLM reasoning from external heuristics to internal model signals by identifying a sparse set of attention heads that form core reasoning circuits. Through ablation, it discovers reasoning heads and uses their collective activations to score and softly sample training data, yielding stronger multi-step reasoning performance across 4 models and 9 benchmarks. The method achieves state-of-the-art data efficiency, with training on ~10% of CircuitSeer-selected data outperforming full-dataset fine-tuning on key metrics, and it generalizes across model sizes and architectures. This mechanism-driven approach bridges mechanistic interpretability with practical data curation, enabling scalable, transparent, and domain-agnostic improvements in mathematical reasoning tasks.

Abstract

Large language models (LLMs) have demonstrated impressive reasoning capabilities, but scaling their performance often relies on massive reasoning datasets that are computationally expensive to train on. Existing data selection methods aim to curate smaller, high-quality subsets but often rely on costly external models or opaque heuristics. In this work, we shift the focus from external heuristics to the model's internal mechanisms. We find that complex reasoning tasks consistently activate a sparse, specialized subset of attention heads, forming core reasoning circuits. Building on this insight, we propose CircuitSeer, a novel data selection method that quantifies the reasoning complexity of data by measuring its influence on these crucial circuits. Extensive experiments on 4 models and 9 datasets demonstrate CircuitSeer's superiority. Notably, fine-tuning Qwen2.5-Math-7B on just 10% of data selected by our method achieves a 1.4-point gain in average Pass@1 over training on the full dataset, highlighting its efficiency and effectiveness.

CircuitSeer: Mining High-Quality Data by Probing Mathematical Reasoning Circuits in LLMs

TL;DR

CircuitSeer shifts data selection for LLM reasoning from external heuristics to internal model signals by identifying a sparse set of attention heads that form core reasoning circuits. Through ablation, it discovers reasoning heads and uses their collective activations to score and softly sample training data, yielding stronger multi-step reasoning performance across 4 models and 9 benchmarks. The method achieves state-of-the-art data efficiency, with training on ~10% of CircuitSeer-selected data outperforming full-dataset fine-tuning on key metrics, and it generalizes across model sizes and architectures. This mechanism-driven approach bridges mechanistic interpretability with practical data curation, enabling scalable, transparent, and domain-agnostic improvements in mathematical reasoning tasks.

Abstract

Large language models (LLMs) have demonstrated impressive reasoning capabilities, but scaling their performance often relies on massive reasoning datasets that are computationally expensive to train on. Existing data selection methods aim to curate smaller, high-quality subsets but often rely on costly external models or opaque heuristics. In this work, we shift the focus from external heuristics to the model's internal mechanisms. We find that complex reasoning tasks consistently activate a sparse, specialized subset of attention heads, forming core reasoning circuits. Building on this insight, we propose CircuitSeer, a novel data selection method that quantifies the reasoning complexity of data by measuring its influence on these crucial circuits. Extensive experiments on 4 models and 9 datasets demonstrate CircuitSeer's superiority. Notably, fine-tuning Qwen2.5-Math-7B on just 10% of data selected by our method achieves a 1.4-point gain in average Pass@1 over training on the full dataset, highlighting its efficiency and effectiveness.
Paper Structure (24 sections, 14 equations, 5 figures, 5 tables)

This paper contains 24 sections, 14 equations, 5 figures, 5 tables.

Figures (5)

  • Figure 1: Heatmaps of attention-head importance during on probe reasoning dataset across four models: (a) Qwen2.5-Math-1.5B, (b) Llama3.2-3B, (c) Llama3.2-1B-Instruct. Brighter cells indicate higher contribution to reasoning; each model exhibits a sparse set of specialized reasoning heads, supporting our finding that only a subset of heads is for reasoning.
  • Figure 2: Overview of the CircuitSeer pipeline for reasoning-aware data selection. Stage 1: Detecting Heads. The reference LLM is evaluated on a probe set while ablating each attention head by scaling its attention weights; heads whose ablation yield a significant increase in loss are retained as reasoning heads. Stage 2: Data Selection. For each problem, we compute token-level attention distributions using only the detected heads and score samples with the formulation in Section \ref{['sec:scores']} (Eq. \ref{['score']}. Scores parameterize soft sampling to form a compact, diverse subset enriched with reasoning-heavy examples.
  • Figure 3: Pass@1 Performance comparison of CircuitSeer against baseline methods across 9 benchmark datasets on Qwen2.5-Math-7B-Base. Our method consistently outperforms all baselines, demonstrating the effectiveness of leveraging internal reasoning circuits for data selection.
  • Figure 4: Comparison of the source data distribution for subsets selected by Soft Sampling versus the Top-k Selection baseline. To enhance visual clarity, less frequent categories (Amc_Aime, Inequalities, Olympiads_Ref, and Number_Theory) are aggregated into a single group, accounting for 2.51% and 2.92% of the Top-k and Soft Sampling subsets, respectively.
  • Figure 5: Comparison of the example length distribution between subsets selected by Top-K ranking and Random sampling. Top-K ranking demonstrates a clear preference for longer examples, resulting in significantly higher mean and median lengths, with the respective means marked by dashed lines.