BiVCoder: A Multi-Agent Framework for Code Generation via Bidirectional Code-Test Diagnosis
Xiaoyang Li, Jinhao Dong, Wenhang Shi, Wei Lu, Xiaoyong Du
Abstract
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.
Ask about this paper
Ask your agent about it.
Lune has read the top-tier papers around this one, so every answer names the papers it rests on.
Your agent calls
Lunesearch_papers
Free to start. No credit card required.
Terminal
Install the CLIlune papers get 88633cb3-cfe1-4516-828a-710f7a4fe756Related papers
- TraceCoder: A Trace-Driven Multi-Agent Framework for Automated Debugging of LLM-Generated CodeJiangping Huang, Wenguang Ye, Weisong Sun, Jian Zhang et al.ICSE 2026 · 1 citation
- DebateCoder: Towards Collective Intelligence of LLMs via Test Case Driven LLM Debate for Code GenerationJizheng Chen, Kounianhua Du, Xinyi Dai, Weiming Zhang et al.ACL 2025
- InspectCoder: Dynamic Analysis-Driven Self Repair through Interactive LLM-Debugger CollaborationYunkun Wang, Yue Zhang, Guochang Li, Chen Zhi et al.OOPSLA 2026 · 1 citation
- ACECODER: Acing Coder RL via Automated Test-Case SynthesisHuaye Zeng, Dongfu Jiang, Haozhe Wang, Ping Nie et al.ACL 2025 · 72 citations
- Escaping Whack-a-Mole: Optimizing Documentation as Repo-Specific Playbooks for Coding AgentsYutong Cheng, Haifeng Chen, Wenchao Yu, Xujiang Zhao et al.ICML 2026
