Pith. sign in

REVIEW 3 cited by

Structured Chain-of-Thought Prompting for Code Generation

Not yet reviewed by Pith; the record is open.

This paper has not been read by Pith yet. Machine review is queued; the pith claim, tier, and objections will appear here once it completes.

SPECIMEN: schema-true, not a live event

T0 review · schema-true

One-sentence machine reading of the paper's core claim.

pith:XXXXXXXX · record.json · timestamp

arxiv 2305.06599 v3 pith:T7ZIIAEE submitted 2023-05-11 cs.SE cs.CL

classification cs.SEcs.CL
keywords promptingcodellmsgenerationscotstructuredcotslanguage
verification ladder T0 review T1 audit T2 compute T3 formal
0 comments
read the original abstract

Large Language Models (LLMs) (e.g., ChatGPT) have shown impressive performance in code generation. LLMs take prompts as inputs, and Chain-of-Thought (CoT) prompting is the state-of-the-art prompting technique. CoT prompting asks LLMs first to generate CoTs (i.e., intermediate natural language reasoning steps) and then output the code. However, CoT prompting is designed for natural language generation and has low accuracy in code generation. In this paper, we propose Structured CoTs (SCoTs) and present a novel prompting technique for code generation, named SCoT prompting. Our motivation is source code contains rich structural information and any code can be composed of three program structures (i.e., sequence, branch, and loop structures). Intuitively, structured intermediate reasoning steps make for structured source code. Thus, we ask LLMs to use program structures to build CoTs, obtaining SCoTs. Then, LLMs generate the final code based on SCoTs. Compared to CoT prompting, SCoT prompting explicitly constrains LLMs to think about how to solve requirements from the view of source code and further the performance of LLMs in code generation. We apply SCoT prompting to two LLMs (i.e., ChatGPT and Codex) and evaluate it on three benchmarks (i.e., HumanEval, MBPP, and MBCPP). (1) SCoT prompting outperforms the state-of-the-art baseline - CoT prompting by up to 13.79% in Pass@1. (2) Human evaluation shows human developers prefer programs from SCoT prompting. (3) SCoT prompting is robust to examples and achieves substantial improvements.

Discussion (0). Sign in to comment.

Forward citations

Cited by 3 Pith papers

Reviewed papers in the Pith corpus that reference this work. Sorted by Pith novelty score. OpenAlex reports about 17 citations worldwide. Full citation record

  1. CROP: Circuit Retrieval and Optimization with Parameter Guidance using LLMs

    cs.LG 2025-07 conditional novelty 6.0 of 10

    LLM-based retrieval-augmented tuning of EDA flow parameters found a 9.9% lower-power configuration on one industrial core than classical optimizers.

  2. Enhancing Factual Accuracy and Citation Generation in LLMs via Multi-Stage Self-Verification

    cs.CL 2025-09 reject novelty 3.0 of 10

    The paper proposes a four-stage self-verification prompting method but explicitly labels its experimental results as fabricated, so it cannot support its claimed gains.

  3. Large Language Models (LLMs) for Electronic Design Automation (EDA)

    eess.SY 2025-08 conditional novelty 2.0 of 10

    A review of LLM applications in EDA, summarizing prior work and three case studies on hardware design, testing, and optimization.

Pith tools