close this message
arXiv smileybones

Happy Open Access Week from arXiv!

YOU make open access possible! Tell us why you support #openaccess and give to arXiv this week to help keep science open for all.

Donate!
Skip to main content
Cornell University
We gratefully acknowledge support from the Simons Foundation, member institutions, and all contributors. Donate
arxiv logo > cs > arXiv:2303.06689

Help | Advanced Search

arXiv logo
Cornell University Logo

quick links

  • Login
  • Help Pages
  • About

Computer Science > Software Engineering

arXiv:2303.06689 (cs)
[Submitted on 12 Mar 2023 (v1), last revised 20 Oct 2025 (this version, v5)]

Title:Self-planning Code Generation with Large Language Models

Authors:Xue Jiang, Yihong Dong, Lecheng Wang, Zheng Fang, Qiwei Shang, Ge Li, Zhi Jin, Wenpin Jiao
View a PDF of the paper titled Self-planning Code Generation with Large Language Models, by Xue Jiang and 7 other authors
View PDF HTML (experimental)
Abstract:Although large language models (LLMs) have demonstrated impressive ability in code generation, they are still struggling to address the complicated intent provided by humans. It is widely acknowledged that humans typically employ planning to decompose complex problems and schedule solution steps prior to implementation. To this end, we introduce planning into code generation to help the model understand complex intent and reduce the difficulty of problem-solving. This paper proposes a self-planning code generation approach with large language models, which consists of two phases, namely planning phase and implementation phase. Specifically, in the planning phase, LLM outlines concise and formatted planning steps from the intent. Subsequently, in the implementation phase, the model generates code step by step, guided by the preceding planning steps. We conduct extensive experiments on various code-generation benchmarks across multiple programming languages. Experimental results show that self-planning code generation achieves a relative improvement of up to 25.4% in Pass@1 compared to direct code generation, and up to 11.9% compared to Chain-of-Thought code generation. Moreover, our self-planning approach also enhances the quality of the generated code with respect to correctness, readability, and robustness, as assessed by humans.
Comments: Accepted by TOSEM
Subjects: Software Engineering (cs.SE)
Cite as: arXiv:2303.06689 [cs.SE]
  (or arXiv:2303.06689v5 [cs.SE] for this version)
  https://doi.org/10.48550/arXiv.2303.06689
arXiv-issued DOI via DataCite

Submission history

From: Xue Jiang [view email]
[v1] Sun, 12 Mar 2023 15:36:03 UTC (485 KB)
[v2] Thu, 3 Aug 2023 13:18:46 UTC (1,340 KB)
[v3] Fri, 31 May 2024 16:50:23 UTC (650 KB)
[v4] Fri, 25 Oct 2024 15:08:03 UTC (1,391 KB)
[v5] Mon, 20 Oct 2025 16:41:09 UTC (1,172 KB)
Full-text links:

Access Paper:

    View a PDF of the paper titled Self-planning Code Generation with Large Language Models, by Xue Jiang and 7 other authors
  • View PDF
  • HTML (experimental)
  • TeX Source
view license
Current browse context:
cs.SE
< prev   |   next >
new | recent | 2023-03
Change to browse by:
cs

References & Citations

  • NASA ADS
  • Google Scholar
  • Semantic Scholar
export BibTeX citation Loading...

BibTeX formatted citation

×
Data provided by:

Bookmark

BibSonomy logo Reddit logo

Bibliographic and Citation Tools

Bibliographic Explorer (What is the Explorer?)
Connected Papers (What is Connected Papers?)
Litmaps (What is Litmaps?)
scite Smart Citations (What are Smart Citations?)

Code, Data and Media Associated with this Article

alphaXiv (What is alphaXiv?)
CatalyzeX Code Finder for Papers (What is CatalyzeX?)
DagsHub (What is DagsHub?)
Gotit.pub (What is GotitPub?)
Hugging Face (What is Huggingface?)
Papers with Code (What is Papers with Code?)
ScienceCast (What is ScienceCast?)

Demos

Replicate (What is Replicate?)
Hugging Face Spaces (What is Spaces?)
TXYZ.AI (What is TXYZ.AI?)

Recommenders and Search Tools

Influence Flower (What are Influence Flowers?)
CORE Recommender (What is CORE?)
  • Author
  • Venue
  • Institution
  • Topic

arXivLabs: experimental projects with community collaborators

arXivLabs is a framework that allows collaborators to develop and share new arXiv features directly on our website.

Both individuals and organizations that work with arXivLabs have embraced and accepted our values of openness, community, excellence, and user data privacy. arXiv is committed to these values and only works with partners that adhere to them.

Have an idea for a project that will add value for arXiv's community? Learn more about arXivLabs.

Which authors of this paper are endorsers? | Disable MathJax (What is MathJax?)
  • About
  • Help
  • Click here to contact arXiv Contact
  • Click here to subscribe Subscribe
  • Copyright
  • Privacy Policy
  • Web Accessibility Assistance
  • arXiv Operational Status