atlas

Research map / Large language models / Reasoning and chain of thought

What Makes Large Language Models Reason in (Multi-Turn) Code Generation?

ICLR 2025 · Large language models › Reasoning and chain of thought · approach: Search and self-correction in reasoning · 0 citations (OpenAlex)

Read the paperCheck your idea against 108,967 papers

AI-extracted summary. Written by AI from the paper's full text. Numbers and claims can be wrong or missing context, so check the paper before you cite or build on it.

Systematic grid search over reasoning, instruction, and execution-feedback prompts for single- and multi-turn code generation on CodeContests and TACO, plus rejection-sampling finetuning to internalize multi-turn CoT.

Problem

Chain-of-thought and self-repair prompting are under-explored for code generation, especially in multi-turn settings under fixed computational budgets, where it is unclear whether multi-turn approaches beat repeated single-turn sampling.

Approach

Decomposes CoT prompting for code into reasoning (NL to NL), instruction (NL to code), and execution-feedback prompts, evaluates them in a unified grid search with the compute-aware pass n@k metric, and finetunes a model via rejection sampling on correct multi-turn CoT trajectories so reasoning is internalized without inference-time prompts.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
Add tailored multi-turn CoTLlama 3.1 70B · CodeContests testpass 1@3: 27.3 -> 31.5Helped
Add tailored multi-turn CoTLlama 3.1 405B · CodeContests testpass 1@3: 32.9 -> 40.1Helped
Add multi-turn without CoTLlama 3.1 405B · CodeContests testpass 1@3: 32.9 -> 35.4Helped
Add single-turn CoTLlama 3.1 405B · CodeContests testpass 1@3: 32.9 -> 31.8Hurt
Combine the best reasoning and instruction promptsLlama 3.1 70B · CodeContests testpass@100: 48.9 -> 54.1Helped
Use multi-turn CoT rather than the base modelLlama 3.1 70B · TACO hardpass n@k (%) — 1@3: 4.4 -> 5.8Helped
Use multi-turn CoT rather than the base modelLlama 3.1 70B · TACO easypass n@k (%) — 100@300: 60.2 -> 59.8Mixed
Add a second reasoning prompt (ablation)Llama 3.1 70B with one reasoning and one instruction prompt · CodeContests testpass 100@300: 59.2 -> -3.1Hurt
Add a second instruction prompt after adding a second reasoning prompt (ablation)Llama 3.1 70B · CodeContests testpass 100@300: -3.1 -> -2.1Hurt
Replace the simple retry prompt with explicit execution-feedback analysis and retry (ablation)Llama 3.1 70B · CodeContests testpass 100@300: 56.2 -> 54.6Hurt
Replace the simple retry prompt with a direct fix instruction (ablation)Llama 3.1 8B · CodeContests testpass 100@300: 30.4 -> 29.3Hurt
Replace the simple retry prompt with execution-feedback analysis and a direct fix instruction (ablation)Llama 3.1 8B · CodeContests testpass 100@300: 30.4 -> 27.5Hurt

Surprising findings

Limitations

Experimental setup

Datasets: CodeContests TACO HumanEval+ MBPP+ LiveCodeBench-v4

Benchmarks: CodeContests TACO HumanEval+ MBPP+ LiveCodeBench-v4

Metrics: pass n@k pass@k pass@1 pass@100

Baselines: Single-turn repeated sampling Chain-of-thought (CoT) Multi-turn without CoT LDB feedback SFT on CodeContests

Builds on: chain-of-thought prompting LDB AlphaCode pass@k estimator Expert Iteration ReST

Closest papers by meaning

Writing a paper in this area? scime draft is a free LaTeX editor with AI included, real-time co-authors and a check of your references and venue rules before you submit. It also imports OpenAI Prism projects.

Open scime draft

Get the next scime Dispatch and a monthly field update

Free. We send a confirmation link first; every email has a one-click unsubscribe. Privacy