atlas

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

Chain of Code: Reasoning with a Language Model-Augmented Code Emulator

ICML 2024 · Large language models › Reasoning and chain of thought · approach: Search and self-correction in reasoning · 12 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 Chain of Code, where an LM writes code and an interpreter executes lines when possible, falling back to the LM ("LMulator") to simulate outputs for non-executable semantic lines, evaluated on BIG-Bench Hard and other reasoning tasks.

Problem

Code-based reasoning helps arithmetic and algorithmic tasks but struggles on semantic reasoning tasks that are hard to express as executable code, and mixed semantic-numeric problems.

Approach

Line-by-line execution where a Python interpreter runs executable lines and an LM (the LMulator) simulates the output of lines that raise exceptions, updating a shared program state so code and language reasoning interleave.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
Use CoC (Interweave) instead of CoTtext-davinci-003 · BIG-Bench Hard, single taskaccuracy (%): 72 -> 84Helped
Use CoC (Interweave) instead of CoTtext-davinci-003 · BIG-Bench Hard, cross taskaccuracy (%): 55 -> 61Helped
Use CoC instead of CoTPaLM 2-S* code variant · BIG-Bench Hard, single taskaccuracy (%): 61 -> 78Helped
Use CoC instead of CoTPaLM 2-S* code variant · BIG-Bench Hard, cross taskaccuracy (%): 47 -> 47No clear effect
Use CoC (Interweave) instead of CoTtext-davinci-003 · GSM8K, single taskaccuracy (%): 63 -> 71Helped
Use CoC (Interweave) instead of CoTtext-davinci-003 · GSM8K, cross taskaccuracy (%): 55 -> 60Helped
Use CoC (Interweave) rather than Python-only execution (ablation)text-davinci-003 · BIG-Bench Hard, single taskaccuracy (%): 48 -> 84Helped
Add Python interpreter execution to LM state simulation (ablation)CoC · BIG-Bench Hard, single taskaccuracy (%): 63 -> 84Helped
Maintain intermediate program state rather than output only a final LM answer (ablation)CoC without Python execution · BIG-Bench Hard, single taskaccuracy (%): 57 -> 63Helped
Use full-program Python execution with LM fallback instead of line-by-line interweaving (ablation)CoC · BIG-Bench Hard, cross taskaccuracy (%): 61 -> 60No clear effect

Surprising findings

Limitations

Experimental setup

Datasets: BIG-Bench Hard GSM8K BIG-Bench

Benchmarks: BIG-Bench Hard GSM8K

Metrics: accuracy

Baselines: Direct prompting Chain of Thought Program of Thoughts ScratchPad PaLM 2-S code variant

Builds on: Chain of Thought ScratchPad Program of Thoughts Program-aided language models

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