Code · Data

Naturalized Execution Tuning (NExT)

First page
Naturalized Execution Tuning (NExT)
Paper summary

NExT teaches LLMs to reason about program runtime behavior by generating synthetic chain-of-thought rationales over execution traces. The approach bootstraps training data through self-training rather than manual annotation, and the learned reasoning transfers to scenarios where traces are unavailable at inference.

Ask this paper

Key points
01

Execution-aware rationales: The model inspects variable states at each step of a program's execution and produces natural-language rationales explaining what is happening, then fine-tunes on those rationales.

02

Self-training bootstrap: No human-annotated rationales are needed - rationales for correct repairs are kept and used to teach the model, scaling naturally across many programs.

03

Large repair gains: On PaLM 2, NExT improves fix rate by +26.1% on MBPP and +14.3% on HumanEval (absolute), with both automated metrics and human evaluators rating the rationales as higher quality.

04

Trace-free generalization: At inference the model applies the same reasoning patterns without live execution traces, showing it learned transferable execution-aware reasoning rather than trace-copying.

Abstract

A fundamental skill among human developers is the ability to understand and reason about program execution. As an example, a programmer can mentally simulate code execution in natural language to debug and repair code (aka. rubber duck debugging). However, large language models (LLMs) of code are typically trained on the surface textual form of programs, thus may lack a semantic understanding of how programs execute at run-time. To address this issue, we propose NExT, a method to teach LLMs to inspect the execution traces of programs (variable states of executed lines) and reason about their run-time behavior through chain-of-thought (CoT) rationales. Specifically, NExT uses self-training to bootstrap a synthetic training set of execution-aware rationales that lead to correct task solutions (e.g., fixed programs) without laborious manual annotation. Experiments on program repair tasks based on MBPP and HumanEval demonstrate that NExT improves the fix rate of a PaLM 2 model, by 26.1% and 14.3% absolute, respectively, with significantly improved rationale quality as verified by automated metrics and human raters. Our model can also generalize to scenarios where program traces are absent at test-time.

Every Monday
Get next week’s papers.
Subscribe on Substack