atlas

Research map / Large language models / Agents, code and math

LeDex: Training LLMs to Better Self-Debug and Explain Code

NeurIPS 2024 · Large language models › Agents, code and math · approach: Code generation benchmarks · 5 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.

Proposes LeDex, a pipeline that collects code explanation-and-refinement trajectories from LLMs (GPT-3.5, CodeLlama-34B/7B) filtered by execution, then trains StarCoder-15B and CodeLlama-7B/13B with SFT and PPO using a novel explanation-and-refinement reward to improve self-debugging.

Problem

Open-sourced code LLMs have limited self-debugging ability: prompting them to explain and refine incorrect code works poorly, and high-quality code explanation and refinement training data is scarce.

Approach

Collect verified chain-of-thought trajectories (explanation then refinement) from a stronger or the same LLM, filter them by unit-test execution, fine-tune with SFT, and then apply PPO with separate rewards for the refinement (CodeBLEU plus test pass rate) and the explanation (RoBERTa embedding similarity to correct explanations).

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
SFT on explanation and refinement trajectoriesStarCoder-15B · MBPP & HumanEvalpass@1: +15.92Helped
Apply RL after SFT with direct refinementStarCoder-15B · MBPP & HumanEvalpass@10: +2.55Helped
Apply RL after SFT with explanation and refinementCodeLlama-7B · MBPP & HumanEvalpass@1: -0.60; +0.66Mixed
Apply RL after SFT with explanation and refinementCodeLlama-13B · MBPP+ & HumanEval+pass@1: +3.34Helped
Train with code explanation and refinement data instead of promptingStarCoder-15B · Four benchmarkssuccess refinement rate: 6.90 -> 16.27Helped
Add code explanation before refinement rather than requesting refinement directly (ablation)StarCoder-15B · MBPPsuccess refinement rate: 2.58 -> 4.43Helped
Add code explanation before refinement rather than requesting refinement directly (ablation)CodeLlama-7B · MBPPsuccess refinement rate: 7.42 -> 6.71Hurt
Add code explanation before refinement rather than requesting refinement directly (ablation)CodeLlama-13B · MBPPsuccess refinement rate: 9.80 -> 10.20Helped
Use self-bootstrapped training data rather than promptingCodeLlama-7B · MBPP & HumanEvalpass@1: +8.25Helped
Apply RL after SFT using self-bootstrapped dataCodeLlama-7B · MBPP & HumanEvalpass@10: +0.11; -0.05Mixed
Use full explanation and refinement data rather than code-generation-only data (ablation)CodeLlama-7B · HumanEvalpass@1: 42.91 -> 52.65Helped
Use RL training with separate explanation and refinement rewards after SFTStarCoder-15B · Code explanation ratingGPT-4 average score: 2.92 -> 3.18Helped

Surprising findings

Limitations

Experimental setup

Datasets: MBPP APPS CodeContests

Benchmarks: MBPP HumanEval MBPP+ HumanEval+

Metrics: pass@1 pass@10 success refinement rate

Baselines: Prompting self-refinement ILF GPT-3.5-Turbo CYCLE Self-Edit

Builds on: PPO CodeBLEU StarChat ILF

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