ACL 2025long0 citations

ReflectionCoder: Learning from Reflection Sequence for Enhanced One-off Code Generation

Houxing Ren, Mingjie Zhan, Zhongyuan Wu, Aojun Zhou, Junting Pan, Hongsheng Li

Abstract

Code generation plays a crucial role in various tasks, such as code auto-completion and mathematical reasoning. Previous work has proposed numerous methods to enhance code generation performance, including integrating feedback from the compiler. Inspired by this, we present ReflectionCoder, a novel approach that effectively leverages reflection sequences constructed by integrating compiler feedback to improve one-off code generation performance. Furthermore, we propose reflection self-distillation and dynamically masked distillation to effectively utilize these reflection sequences. Extensive experiments on three benchmarks, i.e., HumanEval (+), MBPP (+), and MultiPl-E, demonstrate that models fine-tuned with our method achieve state-of-the-art performance. Beyond the code domain, we believe this approach can benefit other domains that focus on final results and require long reasoning paths. Code and data are available at https://github.com/SenseLLM/ReflectionCoder.

BibTeX
@inproceedings{ren-etal-2025-reflectioncoder,
    title = "{R}eflection{C}oder: Learning from Reflection Sequence for Enhanced One-off Code Generation",
    author = "Ren, Houxing  and
      Zhan, Mingjie  and
      Wu, Zhongyuan  and
      Zhou, Aojun  and
      Pan, Junting  and
      Li, Hongsheng",
    editor = "Che, Wanxiang  and
      Nabende, Joyce  and
      Shutova, Ekaterina  and
      Pilehvar, Mohammad Taher",
    booktitle = "Proceedings of the 63rd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)",
    month = jul,
    year = "2025",
    address = "Vienna, Austria",
    publisher = "Association for Computational Linguistics",
    url = "https://aclanthology.org/2025.acl-long.494/",
    doi = "10.18653/v1/2025.acl-long.494",
    pages = "9999--10020",
    ISBN = "979-8-89176-251-0"
}
ReflectionCoder: Learning from Reflection Sequence for Enhanced One-off Code Generation · ACL 2025