Chinese Academy's QAQ Matches Full AI Training on Just 25% of Data
A new metric flips the direction of instruction-tuning data selection, matching full-dataset code model performance on just 25% of samples.
ProTakeaways
- QAQ selects synthetic code instruction data by measuring how well the answer predicts the question, not the reverse.
- Reverse Mutual Information catches both misaligned pairs and paraphrasing shortcuts that IFD misses entirely.
- Stratifying RMI by question complexity into 10 bins prevents simple valid questions from being filtered out.
- Model disagreement between strong and weak scorers identifies samples that are valid yet still learnable.
- Selecting 25% of WarriorCoder via stratified RMI matches full-data performance on HumanEval+.
- RMI and IFD have Spearman correlation of only 0.252, confirming they capture different quality signals.
Training code generation models on synthetic instruction data has become standard practice, but the datasets it produces are riddled with subtle defects that existing quality metrics fail to catch. A new paper from researchers at the Chinese Academy of Sciences and collaborators proposes QAQ, a data selection framework that flips the usual direction of quality scoring and reaches full-dataset performance while training on only a quarter of the samples.
The core idea is deceptively simple. Instead of asking how hard it is for a model to generate an answer given a question, QAQ asks how well the answer explains the question. That reversal turns out to expose failure modes that the dominant metric in this space, Instruction-Following Difficulty (IFD), misses entirely.
Why synthetic code data breaks existing filters
Seedless pipelines like Magpie and WarriorCoder generate instruction-response pairs by prompting aligned LLMs with almost no scaffolding. That yields diversity but also large volumes of noise. The authors flag two dominant failure modes: queries containing fabricated jargon (their example: convert a gritty sulla matrix with floating discharges) paired with syntactically valid code that just echoes the nonsense terms, and off-topic queries like a bare Hi! paired with incoherent responses.
IFD, which scores samples by PPL(A|Q)/PPL(A), cannot distinguish these cases. A query full of made-up terminology produces answers with reasonable perplexity because the fabricated words get echoed back. Answer-focused metrics look at the wrong side of the pair.

Reverse Mutual Information as the quality signal
QAQ defines Reverse Mutual Information as RMI(Q,A) = log PPL(Q) - log PPL(Q|A). It measures how much the answer reduces uncertainty about the question. The implementation reframes PPL(Q|A) as a reverse generation task: the model is prompted with the answer and asked to produce the most likely computer science question, then teacher-forced on the ground-truth question tokens.
Both extremes of RMI signal problems. Low RMI means the answer tells you nothing about the question, indicating semantic misalignment. Very high RMI means the answer trivially reveals the question, usually because it paraphrases or repeats query keywords. The sweet spot is in the middle. Empirically, RMI and IFD have a Spearman correlation of only 0.252, confirming they capture genuinely different signals.
Stratification and the cognitive gap
Raw RMI has a confound: simple questions have low PPL(Q) and therefore compressed RMI ranges regardless of answer quality. QAQ addresses this by binning the dataset into 10 deciles by PPL(Q) and ranking RMI within each bin.

The second ingredient is model disagreement. The authors compute stratified RMI ranks from a strong model (DeepSeek-Coder-6.7B-Base) and a weak one (Qwen3-0.6B), then select samples where the strong model rates the pair highly but the weak model does not. The logic is that these samples are valid (the strong model recognizes their coherence) and still learnable (the weak model has not internalized them). Samples both models rank highly are often paraphrasing shortcuts, since repetition is trivial for any model to detect.
Results on WarriorCoder
Fine-tuning DeepSeek-Coder-6.7B-Base on selected subsets of the 310K-sample WarriorCoder reproduction produces these headline numbers:
- Full data (100%): 78.05 HumanEval, 72.56 HumanEval+, 71.69 MBPP, 59.52 MBPP+
- RMI 50-75% (25% data): 77.44 / 72.56 / 71.43 / 58.47, matching full data on HumanEval+
- IFD at 25%: 71.95 / 66.46 / 64.81 / 54.76
- Random at 25%: 73.78 / 69.51 / 68.52 / 57.67
- SCAR at 25%: 75.00 / 70.73 / 70.63 / 57.67
The mid-range RMI subset beats every other 25% baseline and closes the gap with full-data training. Both extremes hurt: the top-25% subset underperforms full data by around 2.4 points on HumanEval+, and the bottom-25% loses nearly 5 points, quantifying the harm from paraphrasing shortcuts and misaligned pairs respectively.
A generalization test on Magpie-Qwen2.5-Coder-Pro-300K shows QAQ ranks second across all four benchmarks, while competitor SCAR overfits to HumanEval and falls below full-data on MBPP+. RMI rankings are also stable, with a Pearson correlation of 0.9539 between pre- and post-fine-tuning scores, meaning selection can be run once up front.
Practical considerations and limits
QAQ is not free. Computing RMI requires two forward passes per sample, and the full cognitive-gap pipeline runs both a strong and a weak model. On 8xA100s the authors report roughly 6 hours for the full pipeline on 310K samples, comparable to IFD and slower than embedding-based methods like SCAR (about 1.5 hours) or RDS+ (about 2 hours). It is a one-time preprocessing cost, but not negligible.
The authors also flag honest limitations. Both evaluation datasets are seedless synthetic code corpora and may share noise patterns, so generalization to seed-based or general-purpose instruction tuning is untested. The disagreement signal depends on model pairing, though sensitivity experiments with Qwen2.5-Coder-7B and Mistral-7B-v0.3 as the second model show the method holds up as long as there is meaningful disagreement between the two, not necessarily a strict capacity gap. The paper does not mention released code or model weights.
For teams building code models on synthetic pipelines, the takeaway is that answer-conditioned query perplexity is a cheap, static signal that catches defects invisible to answer-side metrics, and that pairing it with model disagreement filters out the paraphrasing shortcuts that pure quality scores tend to reward.