DeGMatch: Target-Aware Reasoning Data Selection via Deconfounded Gradient Matching
Organizations: University of Michigan · University of Texas at Dallas · LG AI Research
Abstract
Reasoning post-training on long trajectories has substantially improved the reasoning capabilities of large language models, but scaling such training to large datasets is increasingly expensive. We study target-aware reasoning data selection, where a small reference set specifies a target capability and guides the selection of training trajectories for specialization. We find that existing target-aware methods can exhibit limited target discrimination on long reasoning trajectories, while dominant population-level structure in candidate gradients can obscure finer target-dependent variation during gradient matching. To address these limitations, we introduce Deconfounded Gradient Matching (DeGMatch), which first constructs a target-relevance gate and then reranks candidates using model-specific gradients. DeGMatch centers gradients using the candidate-population mean and removes leading principal directions before target matching, reducing the influence of dominant population-level structure and improving target discrimination. Across mathematics, science, and code, DeGMatch outperforms strong heuristic, target-aware, and reasoning-specific data selection baselines, while remaining effective across selection budgets, model families, and scales. Our code is publicly available at https://github.com/CHLee0801/degmatch.
Figures & tables
| Method | # Ex. | Tokens | AIME24 | AIME25 | AIME26 | AMC23 | HMMT | MATH500 | GK24 | GK25 | Avg. |
| Base Model | – | – | 1.2 | 1.9 | 0.2 | 12 | 0.2 | 17.3 | 9.4 | 7.2 | 6.18 |
| OpenR1-Qwen-7B ‡ | 93K | 561.2M | 47.9 | 34.8 | 35.6 | 84.2 | 24.0 | 92.5 | 72.6 | 78.8 | 58.80 |
| Heuristic selection | |||||||||||
| Random | 10K | 60.3M | 39.2 | 30.8 | 34.4 | 77.7 | 18.3 | 89.6 | 70.2 | 80.0 | 55.03 |
| Length | 10K | 142.3M | 45.0 | 33.3 | 40.4 | 82.3 | 21.7 | 91.8 | 74.3 | 81.0 | 58.73 |
| MaxPPL | 10K | 117.2M | 41.7 | 34.6 | 38.5 | 82.0 | 20.3 | 92.4 | 73.1 | 80.8 | 57.93 |
| Science | ||||
| Method | GPQA-D | JEE | # Ex. | Tokens |
| Random | 46.8 | 45.8 | 5K | 12.2M |
| Length | 48.2 | 46.9 | 5K | 35.8M |
| RDS+ | 46.4 | 51.6 | 5K | 19.9M |
| TEMP | 47.5 | 46.6 | 5K | 11.6M |
| DeGMatch | 49.0 | 51.8 | 5K | 22.1M |
| Variant | A24 | A25 | A26 | AMC | Avg. |
| Random | 30.4 | 27.3 | 32.3 | 75.5 | 41.38 |
| Relevance only | 32.7 | 30.2 | 32.3 | 79.1 | 43.58 |
| Raw-gradient dir. | 36.9 | 30.8 | 34.0 | 78.0 | 44.93 |
| Centered dir. | 33.3 | 33.1 | 35.6 | 79.1 | 45.28 |
| Deconfounded dir. | 34.6 | 31.9 | 36.7 | 80.3 | 45.88 |
| Deconfounded mag. | 32.5 | 32.5 | 33.3 | 80.5 | 44.70 |
| Method | A24 | A25 | A26 | AMC | Avg. | Tokens |
| Qwen2.5-3B-Base | ||||||
| Random | 7.1 | 5.2 | 6.7 | 39.2 | 14.55 | 18.2M |
| Length | 7.5 | 7.7 | 5.8 | 42.2 | 15.80 | 45.8M |
| RDS+ | 7.7 | 10.4 | 6.2 | 38.7 | 15.75 | 29.1M |
| DeGMatch | 8.8 | 7.7 | 7.5 | 40.2 | 16.05 | 14.7M |
| Qwen3-1.7B-Base | ||||||
Appendix figures & tables40 assets
Supplementary material from the paper’s appendix.
Appendix
| Pool | # Examples | Tokens | Mean Len. |
| Math ( Open-R1 Team, 2025c ) | 93,733 | 561.2M | 5,986 |
| Science ( Open-R1 Team, 2025a ) | 53,195 | 131.9M | 2,480 |
| Code ( Open-R1 Team, 2025a ) | 26,061 | 337.0M | 12,931 |
| Domain | Target | Reference source | Evaluation set |
| Math | AIME | AIME 1983–2023 ( Neubig, ) | AIME24/25/26 ( Mathematical Association of America, 2025a ) |
| Math | AMC | AMC12 2018–2022 ( edev2000, ) | AMC23 ( Mathematical Association of America, 2025b ) |
| Math | HMMT | Omni-MATH HMMT ( KbsdJames, ) | HMMT Feb. 2025 ( MathArena, 2025 ) |
| Math | MATH | MATH train ( Hendrycks et al., 2021 ) | MATH500 ( Lightman et al., 2024 ) |
| Math | Gaokao | Gaokao 2023 ( MARIO-Math-Reasoning, 2023 ) | Gaokao 2024/25 ( FrankieYao, ) |
| Science | GPQA | GPQA non-Diamond ( Rein et al., 2024 ) | GPQA-Diamond ( Rein et al., 2024 ) |
| Method | Implementation source | Preserved selection rule | Adaptation to our setting |
| RDS+ | Published procedure | Position-weighted student hidden-state representations, cosine similarity, and round-robin target retrieval | Initial student representations computed over complete sequences up to 32K tokens |
| LESS | Official pipeline | Adam-preconditioned gradients across warmup checkpoints with learning-rate-weighted target alignment | Common LoRA warmup; per-example gradients computed over complete sequences up to 32K tokens |
| GIST | Official pipeline | Target-gradient Gram decomposition, 95% spectral-mass subspace, and maximum target-reference cosine | Common LoRA warmup; gradients computed over complete sequences up to 32K tokens |
| TAROT | Published method description | Multi-checkpoint gradient features, whitening, and fixed-budget OT-based selection | Common LoRA warmup; gradients computed over complete sequences up to 32K tokens |
| RSR | Official code | Rank–surprisal ratio from student-model response-token probabilities | Global fixed-budget ranking rather than within-problem trajectory selection |
| TEMP | Official code + adaptation | Difficulty filtering, perturbation-based loss trajectories, clustering, and learnability | OpenR1-Distill-7B as directional endpoint; source allocation follows the published equations |
| Method | Setting | Target | Reason. | Student | Primary signal | Grad. | Preparation |
| AlpaGasus ( Chen et al., 2024 ) | Instruction | No | No | No | LLM-estimated quality | No | LLM scoring |
| InsTag ( Lu et al., 2024 ) | Instruction | No | No | No | Instruction complexity / diversity | No | Tagging model |
| DEITA ( Liu et al., 2024a ) | Instruction | No | No | No | Quality, complexity, diversity | No | Scoring models |
| RHO-LOSS ( Mindermann et al., 2022 ) | General | No | No | Yes | Reducible loss / learnability | No | Reference-model fit |
| IFD ( Li et al., 2024b ) | Instruction | No | No | Yes | Instruction-following difficulty | No | Model scoring |
| SuperFiltering ( Li et al., 2024a ) | Instruction | No | No | No | Surrogate-model difficulty | No | Surrogate scoring |
| Benchmark | # Problems | (Avg@ ) | Scoring |
| AIME24/25/26 ( Mathematical Association of America, 2025a ) | 30 / 30 / 30 | 16 | final-answer equivalence |
| AMC23 ( Mathematical Association of America, 2025b ) | 40 | 16 | final-answer equivalence |
| HMMT Feb. 2025 ( MathArena, 2025 ) | 30 | 16 | symbolic answer verification |
| MATH500 ( Lightman et al., 2024 ) | 500 | 4 | math-verify |
| Gaokao 2024/25 ( FrankieYao, ) | 26 / 26 | 16 | math-verify |
| GPQA-Diamond ( Rein et al., 2024 ) | 198 | 8 | multiple-choice accuracy |
| Method | Auxiliary fitting | Reusable candidate representation | Approx. GPU-h |
| RDS+ | None | Student hidden states (full-sequence forward) | 12 |
| LESS | Four-epoch LoRA warm-up | Optimizer-aware LoRA gradients (4 checkpoints) | 200 |
| GIST | LoRA warm-up | LoRA gradients at warm-up checkpoint | 57 |
| TAROT | Four-epoch LoRA warm-up | Projected LoRA gradients (4 checkpoints) | 200 |
| DeGMatch | None | Full-parameter CountSketch gradients at initialization |
| Target | Input | Output | Cost |
| AIME | 5.5K | 918.2K | $1.98 |
| AMC | 4.9K | 523.5K | $1.31 |
| HMMT | 5.6K | 1.08M | $2.71 |
| MATH500 | 3.3K | 256.5K | $0.64 |
| Gaokao | 4.4K | 310.9K | $0.78 |
| GPQA | 9.4K | 486.0K | $1.22 |
| Target | Top-1 | Top-5 | Top-10 | Top-50 | Top-200 |
| AIME | 0.343 | 0.732 | 0.794 | 0.873 | 0.917 |
| AMC | 0.355 | 0.747 | 0.806 | 0.881 | 0.922 |
| HMMT | 0.326 | 0.717 | 0.782 | 0.867 | 0.913 |
| MATH500 | 0.391 | 0.773 | 0.826 | 0.894 | 0.930 |
| Gaokao | 0.385 | 0.769 | 0.822 | 0.892 | 0.929 |
| Property | PC1 | PC2 | PC3 | PC4 | PC5 | # PCs with |
| Log trajectory length | 0.61 | 0.66 | 0.28 | 0.02 | 0.11 | 2 |
| Student NLL | 0.60 | 0.63 | 0.20 | 0.27 | 0.08 | 2 |
| Gradient norm | 0.86 | 0.46 | 0.09 | 0.13 | 0.05 | 2 |
| Olympiad source | 0.01 | 0.12 | 0.07 | 0.12 | 0.06 | 0 |
| Algebra | 0.16 | 0.22 | 0.18 | 0.19 | 0.02 | 0 |
| Geometry | 0.08 | 0.10 | 0.10 | 0.15 | 0.35 | 2 |
| Set | ||||
| Random examples | 0.774 | 0.827 | 0.861 | 0.884 |
| AIME references | 0.658 | 0.720 | 0.777 | 0.817 |
| AMC references | 0.687 | 0.749 | 0.805 | 0.841 |
| HMMT references | 0.654 | 0.714 | 0.781 | 0.819 |
| MATH500 references | 0.809 | 0.856 | 0.886 | 0.906 |
| Gaokao references | 0.795 | 0.835 | 0.865 | 0.889 |
| PC range | Across targets | Pool-split ref. | Random |
| 1–5 | 0.93 | 0.94 | 0.0003 |
| 1–50 | 0.79 | 0.87 | 0.0031 |
| 51–100 | 0.45 | 0.60 | 0.0031 |
| Representation / correction | Matched-control | Random-ref. | Overlap w/ deconf. | Top-3K tokens | (score, len.) |
| Raw direction | 0.86 | 0.58 | 0.18 | 28.5M | +0.72 |
| Score residualization (linear) | 0.79 | 0.62 | 0.02 | 13.2M | |
| Score residualization (cubic) | 0.70 | 0.56 | 0.02 | 10.4M | |
| Gradient residualization | 0.78 | 0.73 | 0.12 | 17.2M | |
| Mean + PC50 | 0.28 | 0.08 | – | 30.8M | +0.34 |
| Covariate residualization + PC50 | 0.24 | 0.09 | 0.63 | 30.0M | +0.32 |
| IT | Short Math | R1 Reasoning | |
| Median response tokens | 33 | 159 | 4,826 |
| Mean-direction energy | 0.016 | 0.100 | 0.438 |
| Sample–mean cosine | 0.40 | 0.71 | |
| Raw random-ref. | 0.35 | – | 0.75 |
| Representation | Matched-control | AMC | HMMT | MATH500 | Gaokao | (score, len.) |
| Raw gradients | 0.86 | 0.92 | 0.96 | 0.90 | 0.89 | 0.78 |
| Mean-centered | 0.87 | 0.68 | 0.88 | 0.45 | 0.45 | 0.58 |
| Mean + PC10 removal | 0.39 | 0.75 | 0.78 | 0.62 | 0.66 | 0.56 |
| Mean + PC25 removal | 0.36 | 0.74 | 0.79 | 0.58 | 0.59 | 0.63 |
| Mean + PC50 removal | 0.28 | 0.72 | 0.78 | 0.56 | 0.59 | 0.69 |
| Mean + PC100 removal | 0.24 | 0.71 | 0.75 | 0.57 | 0.58 | 0.69 |
| Var. | Ctrl. | Overlap | Tokens | |
| 10 | 0.794 | 0.39 | 0.63 | 96.8M |
| 25 | 0.845 | 0.36 | 0.69 | 96.0M |
| 50 | 0.873 | 0.28 | 1.00 | 98.3M |
| 100 | 0.897 | 0.24 | 0.73 | 98.7M |
| 200 | 0.917 | 0.20 | 0.67 | 99.1M |
| AIME24 | AIME25 | AIME26 | Avg. | |
| 0 | 33.3 | 33.1 | 35.6 | 34.00 |
| 10 | 37.1 | 32.0 | 33.0 | 34.03 |
| 25 | 36.0 | 32.2 | 34.2 | 34.13 |
| 50 | 37.9 | 31.0 | 35.6 | 34.83 |
| 100 | 35.0 | 33.0 | 34.6 | 34.20 |
| Estimator | Overlap w/ default |
| Full 30K gate PCA | 1.00 |
| 6K gate sample, seed 0 | 0.87 |
| 6K gate sample, seed 1 | 0.89 |
| 6K gate sample, seed 2 | 0.90 |
| 6K gate sample, seed 3 | 0.90 |
| Full-pool PCA | 0.88 |
| Target | Gate | Pos./Budget | Min. sel. | |
| AIME | 30K | 0.16% | 29,951/10K | 0.017 |
| AMC | 30K | 0.03% | 29,991/10K | 0.014 |
| HMMT | 30K | 0.13% | 29,962/10K | 0.025 |
| MATH500 | 30K | 0.04% | 29,987/10K | 0.023 |
| Gaokao | 30K | 0.06% | 29,983/10K | 0.021 |
| GPQA | 15K | 0.15% | 14,978/5K | 0.015 |
| Gate | Size | Overlap w/ default | Tokens | Median len. | Median NLL | AIME sim. |
| 10K | 0.36 | 68.9M | 5,968 | 1.26 | 0.531 | |
| 20K | 0.69 | 90.0M | 8,326 | 1.49 | 0.525 | |
| 30K | 1.00 | 98.3M | 9,196 | 1.56 | 0.519 | |
| 50K | 0.64 | 107.4M | 10,378 | 1.61 | 0.507 | |
| No gate | 93,733 | 0.47 | 115.8M | 11,642 | 1.66 | 0.493 |
| Gate size | AIME24 | AIME25 | AIME26 | Avg. |
| 9K | 34.6 | 32.3 | 36.2 | 34.37 |
| 15K | 37.5 | 31.5 | 34.0 | 34.33 |
| 30K | 37.9 | 31.0 | 35.6 | 34.83 |
| Full pool | 37.3 | 29.7 | 34.7 | 33.90 |
| Gate construction | Gate Jaccard | Top-1K coverage min./med. | Selection overlap | AIME sim. |
| Qwen3 + round-robin | 1.00 | 893 / 949 | 1.00 | 0.519 |
| Student hidden state + round-robin | 0.30 | 214 / 506 | 0.47 | 0.499 |
| Qwen3 + max similarity | 0.68 | 96 / 913 | 0.76 | 0.522 |
| Qwen3 + mean similarity | 0.40 | 40 / 702 | 0.56 | 0.515 |
| Set | AIME24 | AIME25 | |
| Random 10K | 0.648 | 0.639 | 1.0 |
| Length 10K | 0.658 | 0.642 | 1.4 |
| Relevance gate 30K | 0.691 | 0.681 | 7.0 |
| DeGMatch 10K | 0.668 | 0.657 | 2.9 |
| Set | Length (tokens) | Student NLL | Grad. norm | AIME sim. | NT+Comb. | Olympiad |
| Pool | 4,935 [2,959, 8,107] | 1.14 [0.90, 1.46] | 31.2 | 0.47 | 0.29 | 0.73 |
| Random | 4,974 [3,019, 8,116] | 1.15 [0.91, 1.47] | 31.5 | 0.47 | 0.29 | 0.73 |
| Length | 13,940 [12,669, 15,574] | 1.77 [1.58, 2.01] | 42.3 | 0.49 | 0.38 | 0.67 |
| MaxPPL | 11,786 [9,066, 14,460] | 1.95 [1.84, 2.13] | 42.2 | 0.48 | 0.56 | 0.70 |
| RDS+ | 10,104 [7,403, 13,364] | 1.50 [1.28, 1.74] | 41.2 | 0.50 | 0.47 | 0.63 |
| DeGMatch | 9,196 [6,823, 12,600] | 1.56 [1.33, 1.82] | 41.0 | 0.52 | 0.48 | 0.64 |
| Method | Tokens | Med. len. | A24 | A25 | A26 | Avg. |
| Rand-LC | 35.3M | 12,102 | 38.4 | 30.6 | 32.1 | 33.70 |
| DeGMatch | 36.1M | 12,274 | 37.9 | 31.0 | 35.6 | 34.83 |
| AIME | AMC | HMMT | MATH | GK | |
| AIME | 1.00 | 0.21 | 0.27 | 0.12 | 0.11 |
| AMC | 1.00 | 0.20 | 0.13 | 0.12 | |
| HMMT | 1.00 | 0.11 | 0.12 | ||
| MATH500 | 1.00 | 0.14 | |||
| Gaokao | 1.00 |
| Rank shift | # | Med. len. | Med. NLL | Alg. | Comb. | Geom. | NT |
| Raw top 1K below 10K | 258 | 9,374 | 1.57 | 66 | 42 | 104 | 39 |
| Raw below 10K DeGMatch top 1K | 276 | 14,572 | 1.85 | 28 | 102 | 47 | 86 |
| Ex. | Selected training problem | Shared reasoning structure | Deconf. rank | Raw rank | Semantic rank |
| A | Six people are seated in a row, where three designated people must not sit next to one another. | Forbidden-adjacency arrangement problem closely matching the reference at both the problem and solution level. | 1 | 6,879 | 1 |
| B | Three red, two white, and two blue balls are arranged in a row; compute the probability that the two white balls or the two blue balls are adjacent. | Both solutions define adjacency events, merge adjacent objects into blocks, count the resulting arrangements, and combine overlapping cases using inclusion–exclusion. | 13 | 14,215 | 4,862 |
| Variant | Rel. | Transform | Dir. | Mag. |
| Random | – | – | – | – |
| Relevance only | ✓ | – | – | – |
| Raw-gradient dir. | ✓ | None | ✓ | – |
| Centered dir. | ✓ | Center | ✓ | – |
| Deconfounded dir. | ✓ | Center + PC50 | ✓ | – |
| Deconfounded mag. | ✓ | Center + PC50 | – | ✓ |
| Method | AIME24 | AIME25 | AIME26 | AMC23 | HMMT | MATH500 | GK24 | GK25 | Avg. | Tokens |
| Length | 45.0 | 33.3 | 40.4 | 82.3 | 21.7 | 91.8 | 74.3 | 81.0 | 58.73 | 142.3M |
| Gate30K+Length | 45.5 | 35.0 | 40.0 | 83.1 | 23.0 | 92.0 | 74.3 | 80.0 | 59.11 | 114.6M |
| MaxPPL | 41.7 | 34.6 | 38.5 | 82.0 | 20.3 | 92.4 | 73.1 | 80.8 | 57.93 | 117.2M |
| Gate30K+MaxPPL | 44.8 | 31.7 | 41.9 | 82.7 | 22.0 | 92.8 | 73.6 | 80.8 | 58.79 | 105.5M |
| DeGMatch | 47.7 | 33.8 | 42.6 | 85.6 | 23.7 | 92.8 | 76.9 | 82.7 | 60.73 | 86.9M |
| Variant | Score | A24 | A25 | A26 | Avg. | Tokens |
| Direction only ( ) | 34.6 | 31.9 | 36.7 | 34.40 | 30.8M | |
| Weak magnitude ( ) | 36.0 | 30.0 | 34.6 | 33.53 | 34.6M | |
| DeGMatch ( ) | 37.9 | 31.0 | 35.6 | 34.83 | 36.1M | |
| Strong magnitude ( ) | 37.1 | 32.1 | 34.6 | 34.60 | 37.1M | |
| Length-normalized | 34.2 | 30.0 | 32.1 | 32.10 | 28.1M | |
| Length-residualized | 36.0 | 32.9 | 35.0 | 34.63 | 27.1M |
| Method | AIME | AMC | Gaokao | MATH500 | HMMT | Avg. |
| Heuristic | ||||||
| Random | 60.3 (6.0K) | 60.3 | ||||
| Length | 142.3 (14.2K) | 142.3 | ||||
| MaxPPL | 117.2 (11.7K) | 117.2 | ||||
| Target-aware | ||||||
| RDS+ | 104.9 (10.5K) | 91.0 (9.1K) | 63.3 (6.3K) | 56.6 (5.7K) | 110.0 (11.0K) | 85.2 |
| Method | # Ex. | AIME24 | AIME25 | AIME26 | Avg. | Tokens |
| Random | 1K | 27.7 | 22.9 | 29.2 | 26.60 | 6.1M |
| 3K | 30.4 | 27.3 | 32.3 | 30.00 | 18.0M | |
| 5K | 39.4 | 30.0 | 30.8 | 33.40 | 30.1M | |
| 10K | 39.2 | 30.8 | 34.4 | 34.80 | 60.3M | |
| 15K | 41.2 | 30.8 | 39.2 | 37.07 | 90.0M | |
| Length | 1K | 30.8 | 24.8 | 29.4 | 28.33 | 17.7M |