跳到正文
arXiv:cs.AI· Zheng Fang, Yongmin Li, Yichang Zhang, Dongming Jin, Haoyu Wang, Shuai Wang, Zhi Jin, Ge Li·· 5 小时前AI 评分41

CONTRA:为 LLM 代码生成选择性澄清发现并筛选改变行为的问题

CONTRA: Discovering and Qualifying Behavior-Changing Questions for Selective Clarification in LLM Code Generation

AI 导读

CONTRA 是一种免训练方法,通过广泛发现问题并结合语义与执行筛选,为 LLM 代码生成识别关键的澄清问题。在 ClarifyCodeBench 上,CONTRA 在四种编码智能体中均取得最高 F1,比最佳基线宏平均 F1 高出 13.88 个百分点,澄清召回率和 F1 也超过 Claude Code 与 OpenHands。

正文

View PDF HTML (experimental)

Abstract:Coding agents can generate code that appears correct but implements behavior the user never intended. This mismatch can arise when an agent silently resolves underspecified requirements through its own assumptions. As subsequent development builds on these assumptions, correcting the resulting behavior can become increasingly costly. Early clarification can help prevent such mismatches, but unnecessary questions can interrupt developers and slow down development. Existing methods struggle to identify key clarification questions while avoiding unnecessary ones. Therefore, we propose CONTRA, a training-free method that combines broad question discovery with semantic and execution-based question qualification. CONTRA first generates candidate questions and filters out those unrelated to required behavior or already resolved by the requirement. For each remaining question, it generates programs conditioned on two plausible answers and checks for stable behavioral differences on shared inputs. It then uses the interaction history to select among qualified questions or stop asking. Experiments on ClarifyCodeBench show that CONTRA achieves the highest F1 with all four coding agents, exceeding the best baseline macro-average F1 by 13.88 percentage points. With the same LLM and evaluation protocol, CONTRA also achieves higher clarification recall and F1 than the coding harnesses Claude Code and OpenHands. To support practical use, we also implement CONTRA as a Claude Code plugin that integrates selective clarification into everyday development.
Comments: 15 pages. Code: this https URL
Subjects: Software Engineering (cs.SE); Artificial Intelligence (cs.AI)
Cite as: arXiv:2610.01769 [cs.SE]
  (or arXiv:2610.01769v1 [cs.SE] for this version)
  https://doi.org/10.48550/arXiv.2610.01769

arXiv-issued DOI via DataCite

Submission history

From: Zheng Fang [view email]
[v1] Thu, 1 Oct 2026 14:26:21 UTC (1,601 KB)

来源:arXiv:cs.AI · arxiv.org