← Latest papers
💬 NLP

QAQ: Bidirectional Semantic Coherence for Selecting High-Quality Synthetic Code Instructions

The paper proposes QAQ, a novel data selection framework that leverages Reverse Mutual Information to evaluate bidirectional semantic coherence between queries and answers, effectively filtering noisy synthetic code data to achieve high model performance with significantly reduced training sets.

Original authors: Jiayin Lei, Ming Ma, Yunxi Duan, Chenxi Li, Tianming Yang

Published 2026-03-13
📖 5 min read🧠 Deep dive

Original authors: Jiayin Lei, Ming Ma, Yunxi Duan, Chenxi Li, Tianming Yang

Original paper licensed under CC BY 4.0 (http://creativecommons.org/licenses/by/4.0/). This is an AI-generated explanation of the paper below. It is not written or endorsed by the authors. For technical accuracy, refer to the original paper. Read full disclaimer

Imagine you are trying to teach a robot how to write computer code. You have a massive library of "practice problems" (questions) and "solutions" (answers) generated by other robots. This is called synthetic data.

The problem? Not all of these practice problems are good. Some are nonsense, some are too easy, and some are just copy-pasted garbage. If you feed your robot bad practice problems, it will learn bad habits.

The paper you shared introduces a new method called QAQ (which stands for Question, Answer-Question) to filter out the trash and keep only the gold.

Here is how it works, explained with simple analogies:

1. The Old Way: "How hard is this?" (The Student's Perspective)

Previously, researchers used a method called IFD. Imagine a teacher looking at a math problem and asking, "How hard is it for a student to solve this?"

  • If the answer is obvious, the problem is too easy.
  • If the answer is impossible, the problem is too hard.
  • They kept the "just right" problems.

The Flaw: This only looks at the problem from the front. It doesn't check if the problem itself makes sense. A robot might generate a question like, "How do I turn a 'gritty sulla matrix' into code?" The robot might write a perfect answer that repeats the nonsense words. The "difficulty" score looks fine, but the whole thing is garbage.

2. The New Way: "Does the answer explain the question?" (The Detective's Perspective)

The authors, QAQ, flip the script. Instead of asking "How hard is the question?", they ask: "If I only saw the answer, could I guess what the question was?"

They call this Reverse Mutual Information (RMI). Think of it like a detective looking at a crime scene (the answer) and trying to reconstruct the crime (the question).

  • Good Data (The Sweet Spot): You see a complex code solution. You can look at it and say, "Ah, this must have been the answer to a question about sorting a list." The answer gives you a clear clue about the question. This is high quality.
  • Bad Data Type A (The Echo Chamber): The question is nonsense, and the answer just repeats the nonsense words back.
    • Question: "How to fix a 'flibber-flabber'?"
    • Answer: "To fix a 'flibber-flabber', you must..."
    • The Detective's View: Because the answer just parrots the question, it's too easy to guess the question. The "clue" is obvious because it's a cheat. This is low quality.
  • Bad Data Type B (The Lost Connection): The question is "Hello!" and the answer is a complex Python script.
    • The Detective's View: Looking at the code, you have no idea why someone asked "Hello!" The answer gives you zero clues about the question. This is low quality.

3. The "Cognitive Gap" Strategy: Using Two Teachers

The authors realized that one robot (model) might be too smart or too dumb to spot the difference between "good" and "tricky" data. So, they used two teachers:

  1. The Expert Teacher (Strong Model): Very smart, knows deep patterns.
  2. The Junior Teacher (Weak Model): Less experienced, sees things more simply.

They looked for a specific type of disagreement, which they call the "Cognitive Gap":

  • Scenario: The Expert Teacher looks at a sample and says, "Wow, this is a brilliant, complex problem with a perfect solution!" (High Score).
  • But the Junior Teacher looks at the same sample and says, "I have no idea what's going on here. This is confusing." (Low Score).

Why keep this?
If both teachers agree it's easy, it's probably too simple (boring).
If both agree it's broken, it's trash.
But if the Expert sees value that the Junior misses, that sample is a hidden gem. It's challenging enough to teach the robot new things, but valid enough to be real.

The Results: Doing More with Less

The team tested this on a massive dataset of 300,000 code examples.

  • The Magic Number: They found that by using this "QAQ" filter, they only needed to keep 25% of the data (the top 1/4th).
  • The Outcome: Training the robot on just this small, filtered 25% worked just as well as training on the full 100% of the messy data.
  • The Benefit: This saves a huge amount of time, money, and electricity (computational cost) without making the robot any dumber.

Summary Analogy

Imagine you are building a gym for a weightlifter.

  • Old Method: You grab a pile of random weights. Some are too light (boring), some are too heavy (impossible), and some are made of cardboard (fake). You try to guess which are real by how heavy they feel when you lift them.
  • QAQ Method: You look at the weightlifter's form after they lift the weight.
    • If their form is perfect and you can tell exactly what exercise they were doing, it's a good weight.
    • If they are just swinging a cardboard box and the form looks fake, it's trash.
    • If you have a Coach (Expert) who says, "That was a great lift!" and a Trainee (Junior) who says, "I don't get it," you keep that weight. It's the perfect challenge.

The Bottom Line: By checking if the answer makes sense backwards to the question, and by listening to the disagreement between smart and less-smart robots, we can clean up synthetic data and train AI much faster and cheaper.

Drowning in papers in your field?

Get daily digests of the most novel papers matching your research keywords — with technical summaries, in your language.

Try Digest →