Program of Thoughts Prompting: Disentangling Computation from Reasoning for Numerical Reasoning Tasks

Download PDF

Program of Thoughts Prompting: Disentangling Computation from Reasoning for Numerical Reasoning Tasks

Metadata

Compute Setup

The paper does not list GPU, TPU, accelerator count, or wall-clock runtime. Its main experiments use OpenAI Codex code-davinci-002 through an API, and also compare GPT-3 text-davinci-002, ChatGPT gpt-turbo-3.5, CodeGen 16B variants, CodeT5+, XGen, and reported PaLM/LaMDA baselines. Under the project rule, treat the LLM side as API-hosted accelerator inference, but do not attribute an exact device.

The paper does state the classical execution environment: generated programs are run with Python 3.8 and the SymPy library. That matters for compute structure. Arithmetic and symbolic manipulation are moved from expensive token generation inside a 175B-parameter model into cheap deterministic CPU execution. The LLM still pays prompt and decoding cost, but once it emits code, loops, high-precision arithmetic, and equation solving run on the interpreter rather than on transformer forward passes.

Inference scale is reported through sampling settings and dataset sizes. Few-shot prompting uses 4-8 examples depending on difficulty, with exemplar selection tuned from 10-20 written examples. Self-consistency uses temperature 0.4 and K=40 completions. Datasets include GSM8K 1318 test examples, AQuA 253, SVAMP 1000, TabMWP 7861, FinQA 1147, ConvFinQA 421, and TATQA among the financial/table QA tasks.

Bottleneck

The bottleneck is exact computation inside natural-language reasoning. Chain-of-thought can choose a plausible solution path but still make arithmetic errors, mishandle large numbers, fail at high-precision financial calculations, or struggle with symbolic equations. The paper explicitly points to large-number miscalculations in FinQA and ConvFinQA as a reason PoT improves over CoT. Adding a calculator to CoT helps only mildly because equation extraction is brittle and low-recall.

The second bottleneck is sampling reliability. The model can emit comments instead of executable code, choose wrong variables, miss constraints, or generate invalid programs. The authors therefore use prompt design, semantic variable names, multi-step decomposition, logit bias against the # token in zero-shot prompting, and self-consistency over 40 completions. Compute is spent on candidate programs while the interpreter cheaply evaluates each.

This is a memory/bandwidth contrast as well as an accuracy contrast. A 175B-parameter API model is expensive per generated token and per sampled completion. A Python interpreter is cheap for the numerical operations in these benchmarks. PoT exploits that asymmetry by minimizing how much arithmetic must be represented as transformer-token reasoning.

Method Adaptation

Program-of-Thoughts changes the target representation from natural-language derivation to executable Python. The model emits variable assignments, loops, formulas, and sometimes SymPy calls, stores the result in ans, and the program is executed. This splits reasoning into two devices: the LLM maps language to a structured computation, and the CPU interpreter performs the precise computation.

The method is adapted to the capabilities of code-trained LMs. The main model is Codex 175B, and the paper finds code-davinci-002 stronger than text-davinci-002 for generating programs. Semantic binding is part of the adaptation: variables are named meaningfully rather than as a, b, c, which improves performance, especially on problems with many quantities. Multi-step programs also help because they break a large equation into executable intermediate bindings.

For multiple-choice AQuA, the authors add a second prompting step: PoT computes an intermediate answer, then the LLM maps it to the closest option. For zero-shot PoT, they suppress # token probability with a small bias, reporting that -2 worked best in preliminary study, because the model otherwise sometimes falls back to writing reasoning comments. For self-consistency, they sample 40 programs at temperature 0.4 and aggregate outputs. This is a direct inference-budget tradeoff: more LLM calls raise cost but allow program diversity and majority selection, while execution remains cheap.

Evidence

The few-shot table provides clear evidence. With greedy decoding, Codex Direct averages 42.7 across the listed datasets, Codex CoT averages 56.7, and PoT-Codex averages 68.9. Dataset-level gains are especially large on arithmetic-heavy and table/finance tasks: FinQA improves from Codex CoT 40.4 to PoT 64.5, ConvFinQA from 45.6 to 64.6, TabMWP from 65.2 to 73.2, and GSM8K from 63.1 to 71.6.

Self-consistency preserves the pattern while spending more inference. Codex CoT-SC averages 63.9, while PoT-SC-Codex averages 73.6. PoT-SC reaches 80.0 on GSM8K, 58.6 on AQuA, 89.1 on SVAMP, 81.8 on TabMWP, 68.1 on FinQA, 67.3 on ConvFinQA, and 70.2 on TATQA. The paper notes that self-consistency helps less on financial datasets than on math word problems, but PoT still beats CoT-SC by about 20 points on FinQA/ConvFinQA and 7 points on TATQA.

Zero-shot results show that the representation itself carries value. Zero-shot Direct GPT-3 averages 31.0, zero-shot CoT GPT-3 averages 53.7, and zero-shot PoT averages 66.1 across GSM8K, AQuA, SVAMP, TabMWP, and MultiArith. Ablations support the compute interpretation: removing semantic binding drops GSM8K from 71.6 to 60.2, and removing multi-step programming drops it to 45.8. On AQuA breakdowns, PoT helps most in linear/polynomial equations, iterative, symbolic, and combinatorics categories, exactly where interpreter-backed computation is most useful.

Historical Effect

PoT is a clean historical example of tool-augmented inference before agentic tool use became a default design pattern. It showed that bigger LMs do not need to internalize every computation if a prompt can route deterministic work to a classical program. In compute terms, it replaced unreliable transformer arithmetic with short code synthesis plus cheap CPU execution.

The paper helped establish a durable division of labor: LMs translate natural language into programs, while interpreters handle exact arithmetic, loops, and symbolic algebra. That idea reappears in program-aided reasoning, tool use, code execution sandboxes, and modern data-analysis agents.

Limits

Hardware and API serving details are absent, so latency, batching, and dollar cost cannot be reconstructed from the local source. The method requires an execution sandbox and robust parsing of generated code. It can also fail on unsafe code, syntax errors, missing libraries, wrong program semantics, or problems whose answer is not reducible to a short deterministic computation.

PoT is strongest when the task has exact numerical or symbolic structure. It is less obviously useful for commonsense, external-knowledge, or ambiguous reasoning tasks. Self-consistency with K=40 can be expensive because it multiplies API calls, and majority voting over program outputs only helps when enough sampled programs are independently close to correct.

Links

  • Compute regime: history/compute_regimes/inference_time_compute_post_training/README.md
  • Source PDF and extracted text are listed in metadata above.
  • Queue status: read_complete.
  • Method index: inference_time_reasoning, tool_use
  • Ledger updates: compute bottlenecks