Lune

EMNLP Findings2025

Self-Correcting Code Generation Using Small Language Models

Jeonghun Cho, Deokhyung Kang, Hyounghun Kim, Gary Lee

摘要

Self-correction has demonstrated potential in code generation by allowing language models to revise and improve their outputs through successive refinement. Recent studies have explored prompting-based strategies that incorporate verification or feedback loops using proprietary models, as well as training-based methods that leverage their strong reasoning capabilities. However, whether smaller models possess the capacity to effectively guide their outputs through self-reflection remains unexplored. Our findings reveal that smaller models struggle to exhibit reflective revision behavior across both self-correction paradigms. In response, we introduce COCOS, an approach designed to enhance the ability of small language models for multi-turn code correction. Specifically, we propose an online reinforcement learning objective that trains the model to confidently maintain correct outputs while progressively correcting incorrect outputs as turns proceed. Our approach features an accumulated reward function that aggregates rewards across the entire trajectory and a fine-grained reward better suited to multi-turn correction scenarios. This facilitates the model in enhancing initial response quality while achieving substantial improvements through self-correction. With 1B-scale models, COCOS achieves improvements of 35.8% on the MBPP and 27.7% on HumanEval compared to the baselines. 1

问 Lune

几分钟读透这篇 Paper,不用再花一下午。

Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。

已有 1 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。

可以从这些问题问起

Lune 可以查阅

全文 · 引用它的顶会 Paper · 相关的 Paper

获取答案

免费开始,无需绑卡

脉络

  • STaR: Bootstrapping Reasoning With Reasoning 引用了 Language Models are Few-Shot Learners
  • Direct Preference Optimization: Your Language Model is Secretly a Reward Model 引用了 Language Models are Few-Shot Learners
  • Teaching Large Language Models to Self-Debug 引用了 Self-Refine: Iterative Refinement with Self-Feedback
  • Teaching Large Language Models to Self-Debug 引用了 Language Models are Few-Shot Learners
  • MM-ReCoder: Advancing Chart-to-Code Generation with Reinforcement Learning and Self-Correction 引用了 Direct Preference Optimization: Your Language Model is Secretly a Reward Model
它引用的引用它的从左到右按年份排列,引用越多,位置越高。

引用它的顶会 Paper1

  1. MM-ReCoder: Advancing Chart-to-Code Generation with Reinforcement Learning and Self-CorrectionZitian Tang, Xu Zhang, Jianbo Yuan, Yang Zou 等CVPR 2026 · 4 次引用

它引用的 Paper18

  1. Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah 等NeurIPS 2020 · 64,255 次引用
  2. Direct Preference Optimization: Your Language Model is Secretly a Reward ModelRafael Rafailov, Archit Sharma, Eric Mitchell, Christopher D. Manning 等NeurIPS 2023 · 10,924 次引用
  3. Self-Refine: Iterative Refinement with Self-FeedbackAman Madaan, Niket Tandon, Prakhar Gupta, Skyler Hallinan 等NeurIPS 2023 · 4,972 次引用
  4. STaR: Bootstrapping Reasoning With ReasoningEric Zelikman, Yuhuai Wu, Jesse Mu, Noah D. GoodmanNeurIPS 2022 · 1,126 次引用
  5. Teaching Large Language Models to Self-DebugXinyun Chen, Maxwell Lin, Nathanael Schärli, Denny ZhouICLR 2024 · 1,085 次引用

相关 Paper

  1. ReflexiCoder: Teaching Large Language Models to Self-Reflect on Generated Code and Self-Correct It via Reinforcement LearningJuyong Jiang, Jiasi Shen, Sunghun Kim, Kang Min Yoo 等ACL Findings 2026 · 2 次引用
  2. Small Language Models Need Strong Verifiers to Self-Correct ReasoningYunxiang Zhang, Muhammad Khalifa, Lajanugen Logeswaran, Jaekyeom Kim 等ACL Findings 2024 · 6 次引用
  3. Training Language Models to Self-Correct via Reinforcement LearningAviral Kumar, Vincent Zhuang, Rishabh Agarwal, Yi Su 等ICLR 2025
  4. Teaching Language Models to Critique via Reinforcement LearningZhihui Xie, Jie Chen, Liyu Chen, Weichao Mao 等ICML 2025
  5. Self-Verifying Reflection Helps Transformers with CoT ReasoningZhongwei Yu, Wannian Xia, Xue Yan, Bo Xu 等NeurIPS 2025 · 3 次引用
黄昏的海面,两侧是细线勾勒的悬崖