Mechanistic Circuit Identification for Controllable Data Generation

Nakyung Lee, Sangwoo Hong, Jungwoo Lee

TL;DR

Instead of relying on black-box prompt engineering to generate synthetic data, this paper introduces a white-box framework that identifies internal neural circuits responsible for key data utility metrics (learnability, challenge, and alignment). By directly steering these internal circuits using representation engineering, the authors generate highly targeted synthetic datasets and introduce a stage-aware scheduling curriculum (SAMS) that significantly improves downstream model performance and calibration.

What Problem Does This Paper Address?

Synthetic data generation has become essential for training modern language models, yet current pipelines remain fundamentally "black-box." Developers typically rely on heuristic prompt engineering (e.g., asking a model to "generate a harder question") to control data quality. This approach offers no insight into how data points interact with a model's underlying learning dynamics.

Furthermore, traditional data valuation methods collapse data quality into a single scalar score, ignoring its multi-dimensional nature. To address this, the authors break data quality down into three distinct training utility axes:

  1. Learnability: Is the sample consistently learnable with a stable margin?
  2. Challenge: Does the sample provide informative difficulty that pushes the optimization boundary?
  3. Alignment: Is the optimization pressure aligned with the ultimate target objective?

The core question this paper answers is: Can we find specific internal computational pathways (circuits) that govern these utility axes, and can we use them as a direct interface to steer data generation?

Figure 1: Overview of the proposed framework. We first discover and causally validate internal circuits tied to specific training-utility metrics (Section 3). We then leverage these circuits to steer the generation process, curating distinct data pools with targeted optimization profiles (Section 4). Finally, our SAMS framework dynamically schedules these utility-targeted datasets according to the model’s evolving learning phases during downstream fine-tuning (Section 5).

Methods

The authors propose a circuit-grounded framework consisting of three main phases:

  1. Circuit Discovery & Validation: They use three established training-dynamics metrics to score data samples: Area Under the Margin (AUM) for learnability, Error L2-Norm (EL2N) for challenge, and Gradient Alignment (GradAlign) for alignment. Using a contrastive variant of Edge Attribution Patching with Integrated Gradients (EAP-IG), they isolate the top-K internal model edges that causally govern these metrics.
  2. Circuit-Steered Data Generation: Moving beyond text prompts, they intervene directly in the model's internal activations during generation. They combine Activation Addition (shifting hidden states along utility-specific directions) and Attention Steering (modulating token-level routing through circuit-specific attention heads) to curate distinct data pools ($D_{learnable}$, $D_{challenging}$, $D_{aligned}$).
  3. Stage-Aware Mechanistic Scheduling (SAMS): Recognizing that a model's optimization needs change during training, the authors introduce a curriculum that dynamically adjusts the mixture of these circuit-steered datasets across three progressive phases:
  4. Warm-up Stage: Emphasizes $D_{learnable}$ to stabilize early pattern recognition.
  5. Transition Stage: Gradually injects $D_{challenging}$ to introduce optimization pressure.
  6. Challenge Stage: Shifts weight toward $D_{challenging}$ and $D_{aligned}$ for deeper reasoning.

Datasets

  • SciQ: A multiple-choice science QA benchmark used as the primary dataset for training-utility scoring, circuit discovery, data filtering, and in-domain evaluation.
  • ARC-Easy: Used as an out-of-domain evaluation benchmark to test the generalization and robustness of the fine-tuned models.

Key Insights and Ideas

  • Mid-Layer Functional Divergence: Structural analysis reveals that while all utility circuits share a common backbone in the earliest and latest layers, they diverge dramatically in the middle layers. Learnability relies on shallow "Canonical Anchors," challenge routes through mid-layer "Informative Rerouting" attention pathways and deeper MLPs, and alignment utilizes late-stage "Target-Aligned Control" modules.
  • Gradient-Space Diversity: Circuit-steered generation doesn't just increase lexical or semantic variety (standard text diversity); it actively broadens the model-induced gradient space (measured via G-Vendi score). This means the generated data provides structurally richer optimization signals directly tied to downstream robustness.
  • MI as an Active Interface: This work marks a paradigm shift for Mechanistic Interpretability (MI). Instead of using MI purely as a post-hoc analytical tool to understand model behavior, it transforms discovered circuits into actionable, causal control handles for data engineering.

Key Results

  • Causal Bottlenecks Verified: Deactivating the discovered top-250 circuits via zero-ablation completely collapsed the high/low score separation by over 98% for both AUM and EL2N, proving these subgraphs are causally essential for utility processing.
Figure 2: Absolute Circuit Performance Ratio (Abs-CPR) of discovered circuits versus random baselines. The x-axis denotes the number of extracted top-K edges, defining the subgraph size. Higher Abs-CPR indicates that the extracted circuit successfully governs the model’s original behavior.
  • Superior Downstream Performance: When fine-tuning a student model (Qwen2.5-0.5B-Instruct), the SAMS scheduling framework achieved the highest peak accuracy on the in-domain SciQ dataset (85.8%), outperforming both prompt-based baselines and uniform data mixtures.
  • Enhanced Model Calibration: SAMS dramatically reduced overconfident mistakes, yielding an Expected Calibration Error (ECE) of 0.055, a substantial improvement over the baseline's ECE of 0.157. This trend successfully generalized to the out-of-domain ARC-Easy benchmark.

Limitations and Future Work

While highly effective, the current SAMS framework relies on a predefined, discrete stage-wise mixture ratio rather than a fully automated, closed-loop dynamic scheduling policy. Additionally, the experiments were focused on multiple-choice QA tasks within a specific model family (Qwen2.5). The authors note that future work should explore extending these localized circuit interventions to broader architectures and more open-ended generation tasks to pave the way for fully automated, white-box data curation pipelines.

Summary updated

Abstract

While recent advances in data synthesis aim to curate high-quality datasets, most generation pipelines still rely on heuristic prompt-based control. This black-box paradigm provides limited insight into how individual samples interact with a model's underlying learning dynamics. To bridge this gap, we propose a circuit-grounded framework that connects training-dynamics-based data valuation with mechanistic interpretability (MI). Specifically, we conceptualize data quality along three complementary utility axes, learnability, challenge, and alignment. First, we uncover specialized model-internal circuits that causally govern these utility signals. Then, moving beyond heuristic prompting toward mechanistic control, we leverage these circuits as controllable interfaces, actively steering generation to produce utility-targeted data. Building on this capability, we introduce SAMS (Stage-Aware Mechanistic Scheduling), which schedules circuit-steered data according to the model's evolving optimization needs. Experiments on multiple-choice QA tasks demonstrate that our approach yields precisely controlled data with greater diversity than prompt-based baselines, consistently improving downstream performance and calibration. Ultimately, this work establishes a principled white-box paradigm for interpretable data generation, pioneering the use of MI not just as an analytical tool, but as a practical, controllable interface.
BibTeX
@inproceedings{lee2026mechanistic,
  author = {Nakyung Lee and Sangwoo Hong and Jungwoo Lee},
  title = {{Mechanistic Circuit Identification for Controllable Data Generation}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=C7XxHZycp6},
}
Figure