mlsanityData to 14 Oct 2026

Self-Correcting Code Generation Using Small Language Models

arXiv 2505.23060 ↗First posted 29 May 2025cs.CLcited by 4

Not on the map. Why?

Abstract (arXiv)

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.

Key facts. Cited by 4 papers in the map (data through 14 Oct 2026). Builds on 32 of its 41 references that are in the map. First posted on arXiv 29 May 2025.

Builds on

32 of 41 references.

References · 32

  1. 2020Language Models are Few-Shot Learnerscited by 32,419
  2. 2024The Llama 3 Herd of Modelscited by 14,715
  3. 2021Evaluating Large Language Models Trained on Codecited by 8,320
  4. 2023Direct Preference Optimization: Your Language Model is Secretly a Reward Modelcited by 8,065
  5. 2024Qwen2.5 Technical Reportcited by 4,942
  6. 2021Program Synthesis with Large Language Modelscited by 3,637
  7. 2023Self-Refine: Iterative Refinement with Self-Feedbackcited by 3,442
  8. 2024Gemini 1.5: Unlocking multimodal understanding across millions of tokens of contextcited by 3,224
  9. 2024DeepSeek-Coder: When the Large Language Model Meets Programming -- The Rise of Code Intelligencecited by 1,181
  10. 2023Large Language Models Cannot Self-Correct Reasoning Yetcited by 1,017
  11. 2023Teaching Large Language Models to Self-Debugcited by 988
  12. 2022STaR: Bootstrapping Reasoning With Reasoningcited by 940
20 more
  1. 2025SFT Memorizes, RL Generalizes: A Comparative Study of Foundation Model Post-trainingcited by 672
  2. 2024Training Language Models to Self-Correct via Reinforcement Learningcited by 426
  3. 2022Generating Sequences by Learning to Self-Correctcited by 277
  4. 2024When Can LLMs Actually Correct Their Own Mistakes? A Critical Survey of Self-Correction of LLMscited by 240
  5. 2022Defining and Characterizing Reward Hackingcited by 203
  6. 2022Exploration in Deep Reinforcement Learning: A Surveycited by 166
  7. 2024Recursive Introspection: Teaching Language Model Agents How to Self-Improvecited by 165
  8. 2025KodCode: A Diverse, Challenging, and Verifiable Synthetic Dataset for Codingcited by 119
  9. 2022Execution-Based Evaluation for Open-Domain Code Generationcited by 91
  10. 2024Small Language Models Need Strong Verifiers to Self-Correct Reasoningcited by 86
  11. 2025A Self-Improving Coding Agentcited by 79
  12. 2023A Survey of Temporal Credit Assignment in Deep Reinforcement Learningcited by 59
  13. 2025SETS: Leveraging Self-Verification and Self-Correction for Improved Test-Time Scalingcited by 54
  14. 2024SuperCorrect: Advancing Small LLM Reasoning with Thought Template Distillation and Self-Correctioncited by 40
  15. 2022On Transforming Reinforcement Learning by Transformer: The Development Trajectorycited by 36
  16. 2025ReVISE: Learning to Refine at Test-Time via Intrinsic Self-Verificationcited by 35
  17. 2024What Makes Large Language Models Reason in (Multi-Turn) Code Generation?cited by 29
  18. 2025Multi-Turn Code Generation Through Single-Step Rewardscited by 28
  19. 2024Small Language Model Can Self-correctcited by 23
  20. 2025Self-Taught Self-Correction for Small Language Modelscited by 5

Built on by

Cited by year (2026 to 14 Oct)

Citing papers per year: 2026: 4.

4 papers.

Similar, not cited

Close in wording, no citation either way

  1. 2026ReflexiCoder: Teaching Large Language Models to Self-Reflect on Generated Code and Self-Correct It via Reinforcement Learning
  2. 2025PAG: Multi-Turn Reinforced LLM Self-Correction with Policy as Generative Verifier
  3. 2025ReVeal: Self-Evolving Code Agents via Reliable Self-Verification
  4. 2025Reflect, Retry, Reward: Self-Improving LLMs via Reinforcement Learning
  5. 2024Can Large Language Models Invent Algorithms to Improve Themselves?: Algorithm Discovery for Recursive Self-Improvement through Reinforcement Learning
  6. 2025Towards Better Correctness and Efficiency in Code Generation
  7. 2026Improving Small Language Models for Code Generation with Reinforcement Learning from Verification Feedback
  8. 2025Teaching Language Models to Critique via Reinforcement Learning