arXiv:2604.21950 · 中英对照阅读
反馈胜于形式:为什么执行反馈在 1-3B 代码生成中比流水线拓扑结构更重要
Feedback Over Form: Why Execution Feedback Matters More Than Pipeline Topology in 1-3B Code Generation
中文速览
研究想弄清楚:几个能力有限的小模型串起来,能不能靠协作弥补单打独斗的不足。作者让模型先写代码,再运行测试,并把报错信息交给模型修改,同时用进化搜索尝试不同的流水线组合;实验都在一台笔记本上完成。结果显示,带运行反馈的修改流程能显著提升 HumanEval 和 MBPP 成绩,尤其擅长修复语法、名称等运行错误,却很难解决逻辑错误;及时停止也很关键,因为继续改可能把正确代码改坏,而更复杂的流程没有明显胜过简单流程。研究说明,对小模型来说,清楚具体的外部反馈比堆叠更多协作环节更有用,也为低资源环境下提升代码生成提供了实证依据。
摘要
小语言模型(SLM)(1–3B)适合在本地运行,但单独用于较难的代码生成任务时能力有限。我们探究将它们组合成流水线能否弥补部分能力损失。我们研究了由 1–3B 模型构建、带有执行反馈的代码生成流水线,并采用受 NEAT 启发的进化搜索,检验更复杂的流水线结构是否比简单的精炼循环更有帮助。我们在 HumanEval(164 道题)和净化版 MBPP(427 道题)上进行评估,所有推理均在单台笔记本电脑上本地完成。带有执行反馈的自我精炼使两个基准上的代码生成性能均提升了 $>4\sigma$。这种增益的作用机制较为有限:精炼能修复许多运行时错误(尤其是名称错误和语法错误),但很少能修复断言错误等逻辑错误。在我们测试的通用模型池中,生成模型的身份不如精炼模型的能力重要:由一个 1.5B 生成模型搭配一个 3B 精炼模型,其表现与一个 3B 模型同时承担这两种角色相当。提前停止至关重要——若不提前停止,每次迭代都会带来净负面影响。代码专用模型的表现优于所有通用流水线配置,这表明模型专用化比流水线架构更重要。初步的纯文本流水线实验未使用执行反馈,在这一规模下并未显示出增益。在我们受限的搜索空间中,进化搜索主要是重新发现了我们手动找到的同一简单生成→执行→精炼循环,增加拓扑结构并未带来明确显著的增益。单次评估适应度会使结果虚高 5–7%,从而选中幸运的基因组,而非优良的基因组。在这些基准和 1–3B 规模下,决定组合是否有帮助的因素中,执行反馈比增加流水线复杂度更重要。
Small language models (1-3B) are practical to run locally, but individually limited on harder code generation tasks. We ask whether composing them into pipelines can recover some of that lost capability. We study code generation pipelines built from 1-3B models with execution feedback, and use a NEAT-inspired evolutionary search to test whether more complex pipeline structure helps beyond a simple refinement loop. We evaluate on HumanEval (164 problems) and sanitized MBPP (427 problems), all with local inference on a single laptop. Self-refinement with execution feedback improves code generation by $>4\sigma$ on both benchmarks. The gains are narrow in mechanism: refinement fixes many runtime errors (especially NameError and SyntaxError), but rarely fixes logic errors such as AssertionError. Within our tested general-purpose model pool, generator identity mattered less than refiner capability: a 1.5B generator paired with a 3B refiner matched a 3B model doing both roles. Early stopping is essential — without it, every iteration is net-negative. The code-specialized models outperform every general-purpose pipeline configuration, suggesting model specialization matters more than pipeline architecture. Preliminary text-only pipeline experiments without execution feedback did not show gains at this scale. In our constrained search space, evolutionary search mostly rediscovered the same simple generate $\rightarrow$ execute $\rightarrow$ refine loop we found manually, with no clearly significant gain from added topology. Single-evaluation fitness inflates results by 5–7%, selecting lucky genomes over good ones. On these benchmarks at 1-3B scale, execution feedback mattered more than added pipeline complexity in determining whether composition helped.
术语表
- Small Language Models (SLMs)
- 小语言模型
- code generation
- 代码生成
- pipeline composition
- 流水线组合
- execution feedback
- 执行反馈
- self-refinement
- 自我精炼
- refiner
- 精炼模型
- generator
- 生成模型
- early stopping
- 提前停止
- HumanEval
- HumanEval
- MBPP
- MBPP
- Sanitized MBPP
- 净化版 MBPP
- NEAT
- NEAT
- evolutionary search
- 进化搜索
- pipeline topology
- 流水线拓扑结构
- generate → execute → refine loop
- 生成→执行→精炼循环
- traceback
- 回溯信息
- runtime error
- 运行时错误
- logic error
- 逻辑错误
- NameError
- 名称错误
- SyntaxError
- 语法错误
- AssertionError
- 断言错误
- single-evaluation fitness
- 单次评估适应度
- Mixture-of-Agents (MoA)
- 多智能体混合(MoA)
- Self-MoA
- Self-MoA
- CYCLE
- CYCLE
- AgentConductor
- AgentConductor
- DSPy
- DSPy
- AFlow
- AFlow
- EvoFlow
- EvoFlow
- FrugalGPT
- FrugalGPT