Zero-Shot vs. Chain-of-Thought Prompting for Python Code Generation: Separating Execution, Functional Correctness, and Judged Quality

Zero-shot and chain-of-thought (CoT) prompting can produce different program structures, validation logic, and explanations, but those differences need not translate into improved correctness. We present a small case study using ChainZCode, a code-evaluation toolkit with a retained collection of 180 Python implementations: 30 algorithmic tasks, three models (GPT-4o, Claude 3.5 Sonnet, and Gemini 2.0 Flash), and two styles. The evaluation separates retrospective external callable checks under explicit task contracts, whole-script completion, and five-criterion model-assisted quality scores. Of the 180 implementations, 178 pass the callable suites and 177 complete as whole scripts. GPT and Claude pass all 30 callable suites in each style; Gemini passes 29 in each, with different failed tasks. The failures distinguish a maximum-subarray convention, a syntax error, and defects in generated self-tests. Paired CoT-minus-zero-shot judge-score differences are −0.124, +0.180, and −0.497 points out of 20 for GPT, Claude, and Gemini, respectively. Gemini's difference becomes +0.171 when the comparison requires two completed assessments, a sign reversal showing why failure policy and assessment coverage must accompany quality averages. Process completion, checked functional behavior, and judged quality capture different outcomes in this case study. The study contains one saved implementation per condition; its conclusions concern these programs rather than variation across newly sampled generations.

Authors

Institutions

Publication Details

Journal
Zenodo (CERN European Organization for Nuclear Research)
Published
2026-11-03
DOI
https://doi.org/10.5281/zenodo.23894898
Primary Topic
Software Engineering Research
Type
preprint
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
preprint

Zero-Shot vs. Chain-of-Thought Prompting for Python Code Generation: Separating Execution, Functional Correctness, and Judged Quality

Sean Lester Miranda
4 links
Zenodo (CERN European Organization for Nuclear Research)
Software Engineering Research
preprint

Zero-Shot vs. Chain-of-Thought Prompting for Python Code Generation: Separating Execution, Functional Correctness, and Judged Quality

Sean Lester Miranda
preprint en

Abstract

Zero-shot and chain-of-thought (CoT) prompting can produce different program structures, validation logic, and explanations, but those differences need not translate into improved correctness. We present a small case study using ChainZCode, a code-evaluation toolkit with a retained collection of 180 Python implementations: 30 algorithmic tasks, three models (GPT-4o, Claude 3.5 Sonnet, and Gemini 2.0 Flash), and two styles. The evaluation separates retrospective external callable checks under explicit task contracts, whole-script completion, and five-criterion model-assisted quality scores. Of the 180 implementations, 178 pass the callable suites and 177 complete as whole scripts. GPT and Claude pass all 30 callable suites in each style; Gemini passes 29 in each, with different failed tasks. The failures distinguish a maximum-subarray convention, a syntax error, and defects in generated self-tests. Paired CoT-minus-zero-shot judge-score differences are −0.124, +0.180, and −0.497 points out of 20 for GPT, Claude, and Gemini, respectively. Gemini's difference becomes +0.171 when the comparison requires two completed assessments, a sign reversal showing why failure policy and assessment coverage must accompany quality averages. Process completion, checked functional behavior, and judged quality capture different outcomes in this case study. The study contains one saved implementation per condition; its conclusions concern these programs rather than variation across newly sampled generations.

Zenodo (CERN European Organization for Nuclear Research)
AMA Computer University (PH)
Software Engineering Research
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.

Laika access coming soon