BiVCoder: A Multi-Agent Framework for Code Generation via Bidirectional Code-Test Diagnosis

Large Language Models (LLMs) have demonstrated remarkable potential in automated code generation. However, existing test-driven code generation and refinement frameworks are often hindered by the tests' quality: they typically treat self-generated tests as ground truth, leading to ineffective debugging loops where code is modified to satisfy erroneous tests. To address this, we propose BiVCoder, a diagnosis-driven multi-agent framework featuring a novel bidirectional code-test diagnosis mechanism. BiVCoder coordinates three specialized agents—Coding Agent, Test Agent, and Review Agent. Central to this architecture is the Review Agent, which serves as a diagnosis and decision-making hub. By integrating an MCP-based code-test execution tool, the Review Agent rigorously executes programs to diagnose failure root causes, distinguishing between implementation bugs and test case deficiencies, and subsequently triggers targeted repairs (Coding Agent or Test Agent). Furthermore, we introduce BiVCoder-SFT, a role-specific instruction fine-tuning scheme. We construct high-quality datasets to fine-tune the Qwen3-4B base model into specialized agents for coding, testing, and reviewing. Extensive experiments on HumanEval, MBPP, and their rigorous ''ET'' variants demonstrate the superiority of our approach. With GPT-3.5, BiVCoder achieves a Pass@1 of 77.3%. Notably, the specialized BiVCoder-SFT achieves an average score of 79.5% across the four datasets, not only outperforming its base model (69.7%) but also surpassing larger general-purpose models such as Qwen3-8B (77.8%). Additionally, BiVCoder boosts the performance of more powerful models, improving DeepSeek-V3.2 from 87.2% to 92.1% on HumanEval.

Link
https://www.semanticscholar.org/paper/6501353080b04fe754167724a6679406a6548c89
Found by
Semantic Scholar
Authors
Xiaoyang Li, Jinhao Dong, Wenhang Shi, Wei Lu, Xiaoyong Du
Categories
dataset
Published
2026-08-08
Last seen by the radar
2026-08-08
Citations
0
Influential citations
0
Radar score
38.54 / 100 (how it is scored)
Why it scored so
Matched: dataset; Primary record: Semantic Scholar
Related links
https://doi.org/10.1145/3770855.3818107
Is this record right? If you made this work and something here is wrong or missing, tell us what to fix.

More records found by Semantic Scholar