QAQ:双向语义一致性用于选择高质量的合成代码指令
QAQ: Bidirectional Semantic Coherence for Selecting High-Quality Synthetic Code Instructions
AI总结:
本文提出QAQ框架,通过双向语义一致性评估合成数据质量,利用反向互信息量化答案对查询的信息增益,实验表明选择25%数据可达到全数据训练效果,提升数据筛选效率。
摘要:
合成数据已成为训练代码生成模型的关键,但其引入显著噪声和幻觉,现有方法如指令遵循难度(IFD)难以有效检测。本文提出QAQ框架,从反向方向评估数据质量:如何利用答案预测查询(Q|A)。定义反向互信息(RMI)量化答案对查询的信息增益。分析表明,RMI的极值均反映质量问题:低RMI表示语义不一致,高RMI可能包含LLM易识别的缺陷模式。进一步引入基于强弱模型分歧的筛选策略,识别有效且具有挑战性的样本。在WarriorCoder数据集上实验表明,使用分层RMI选择25%数据可达到全数据训练效果,显著优于现有方法。本方法强调合成数据筛选中双向语义一致性的关键作用,提供一种可扩展的途径以减少计算成本而不牺牲模型能力。
英文摘要:
Synthetic data has become essential for training code generation models, yet it introduces significant noise and hallucinations that are difficult to detect with current metrics. Existing data selection methods like Instruction-Following Difficulty (IFD) typically assess how hard a model generates an answer given a query ($A|Q$). However, this metric is ambiguous on noisy synthetic data, where low probability can distinguish between intrinsic task complexity and model-generated hallucinations. Here, we propose QAQ, a novel data selection framework that evaluates data quality from the reverse direction: how well can the answer predict the query ($Q|A$)? We define Reverse Mutual Information (RMI) to quantify the information gain about the query conditioned on the answer. Our analyses reveal that both extremes of RMI signal quality issues: low RMI indicates semantic misalignment, while excessively high RMI may contain defect patterns that LLMs easily recognize. Furthermore, we introduce a selection strategy based on the disagreement between strong and weak models to identify samples that are valid yet challenging. Experiments across three datasets spanning code generation (WarriorCoder, Magpie-Qwen2.5-Coder-Pro-300K) and math reasoning (OpenR1-Math-220k) demonstrate that selecting just 25\% of data using stratified RMI matches full-data performance while being consistently competitive with or better than existing data selection methods. Our approach highlights the importance of bidirectional semantic coherence in synthetic data curation, offering a scalable pathway to reduce computational costs without sacrificing model capability. Code is available at https://github.com/XXSg559/QAQ.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。