paper-with-me

홈 › Papers

Self-Correcting Code Generation Using Small Language Models

2025-05-29 · Jeonghun Cho, Deokhyung Kang, Hyounghun Kim, Gary Geunbae 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.

📄 PDF Abstract BibTeX arXiv:2505.23060

Code (1)

jeonghun3572/CoCoS 공식 구현 pytorch

Tasks

Code GenerationHumanEvalmbpp

Similar Papers 제목 키워드 기반

An Empirical Study on Self-correcting Large Language Models for Data Science Code Generation

2024-08-28 · Thai Tang Quoc, Duc Ha Minh, Tho Quan Thanh, Anh Nguyen-Duc

Large Language Models (LLMs) have recently advanced many applications on software engineering tasks, particularly the potential for code generation. Among contemporary challenges, code generated by LLMs often suffers fro…

Code Generation

Self-Correcting RAG: Enhancing Faithfulness via MMKP Context Selection and NLI-Guided MCTS

2026-04-12 · Shijia Xu, Zhou Wu, Xiaolong Jia, Yu Wang 외 arxiv

Retrieval-augmented generation (RAG) substantially extends the knowledge boundary of large language models. However, it still faces two major challenges when handling complex reasoning tasks: low context utilization and …

Multi-hop Question AnsweringNatural Language Inference

Teaching Language Models to Self-Improve through Interactive Demonstrations

2023-10-20 · Xiao Yu, Baolin Peng, Michel Galley, Jianfeng Gao 외

The self-improving ability of large language models (LLMs), enabled by prompting them to analyze and revise their own outputs, has garnered significant interest in recent research. However, this ability has been shown to…

Math

Smaller Large Language Models Can Do Moral Self-Correction

2024-10-30 · Guangliang Liu, Zhiyu Xue, Rongrong Wang, Kristen Marie Johnson

Self-correction is one of the most amazing emerging capabilities of Large Language Models (LLMs), enabling LLMs to self-modify an inappropriate output given a natural language feedback which describes the problems of tha…

Language ModelingLanguage ModellingSafety Alignment

Self-Evolved Preference Optimization for Enhancing Mathematical Reasoning in Small Language Models

2025-03-04 · Joykirat Singh, Tanmoy Chakraborty, Akshay Nambi

Large language models (LLMs) have significantly improved their reasoning capabilities; however, they still struggle with complex multi-step mathematical problem-solving due to error propagation, lack of self-correction, …

GSM8KMathMathematical Problem-SolvingMathematical Reasoning+1