SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2211.10435 · 2022

PAL: Program-aided Language Models

arXiv · PDF · Open in the Atlas

Code that ran

3 of 3 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 3 failures of our instrument; 0 no recorded run), measured 2026-11-24; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2211.10435.json · badge: /api/ran/2211.10435.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
allanj/dynamic-pal extension (classifier label)
classifier basis: classifier_2025
3 ran · 0 no recorded run
FunctionStatusWhere it lives
construct_prompt_based_on_top_k_prompt Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
allanj/dynamic-pal/scripts/eval_basedon_sim.py
code served (permissive licence) · get_code("1ddce468acc940a1")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

torch.manual_seed(0)

# Construct minimal training_data: list of dicts with required keys
training_data = [
    {
        'sQuestion': 'What is 2 + 2?',
        'generation': [['print(2 + 2)']],
    },
    {
        'sQuestion': 'What is 3 * 4?',
        'generation': [['print(3 * 4)']],
    },
    {
        'question': 'What is 5 - 1?',
        'generation': [['print(5 - 1)']],
    },
]

# Construct test_data: list of dicts with question key
test_data = [
    {
        'question': 'What is 10 / 2?',
    },
    {
        'question': 'What is 7 + 8?',
    },
]

# Top k indices pointing to training_data elements
top_k_idx = [0, 1, 2]

# Test question index pointing to test_data element
test_question_idx = 0

# Test question key used to access question text
test_question_key = 'question'

ARGS = {
    'training_data': training_data,
    'top_k_idx': top_k_idx,
    'test_question_idx': test_question_idx,
    'test_data': test_data,
    'test_question_key': test_question_key,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
find_top_k_prompt Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
allanj/dynamic-pal/scripts/eval_basedon_sim.py
code served (permissive licence) · get_code("5a443e25b258cd28")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family int; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

# Set seed for reproducibility
np.random.seed(0)

# Create test sentence embeddings (5 test questions, 4-dim embeddings)
test_sent_embs = np.random.randn(5, 4).astype(np.float32)

# Create training sentence embeddings (8 training questions, 4-dim embeddings)
train_sent_embs = np.random.randn(8, 4).astype(np.float32)

# Create training data with score field
training_data = [
    {'id': 0, 'text': 'training question 0', 'score': 1},
    {'id': 1, 'text': 'training question 1', 'score': 0},
    {'id': 2, 'text': 'training question 2', 'score': 1},
    {'id': 3, 'text': 'training question 3', 'score': 1},
    {'id': 4, 'text': 'training question 4', 'score': 0},
    {'id': 5, 'text': 'training question 5', 'score': 1},
    {'id': 6, 'text': 'training question 6', 'score': 1},
    {'id': 7, 'text': 'training question 7', 'score': 1},
]

test_question_idx = 1
k = 3
similarity_order = 'most_similar'

ARGS = {
    'test_sent_embs': test_sent_embs,
    'test_question_idx': test_question_idx,
    'train_sent_embs': train_sent_embs,
    'training_data': training_data,
    'k': k,
    'similarity_order': similarity_order,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family int — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
read_data Ran
ran; our contract draft was wrong, not the code
allanj/dynamic-pal/scripts/eval_basedon_sim.py
code served (permissive licence) · get_code("2f69ddcd06d5421f")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import json
import tempfile
import os

# Create a temporary JSON file with valid data
temp_dir = tempfile.mkdtemp()
temp_file = os.path.join(temp_dir, "test_data.json")

test_data = {
    "key1": "value1",
    "key2": [1, 2, 3],
    "key3": {"nested": "object"}
}

with open(temp_file, 'w', encoding='utf-8') as f:
    json.dump(test_data, f)

ARGS = {
    "file": temp_file
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block

Also present in other papers' code

Of 3 samples lifted from this paper's linked repositories, 3 carry a function identity and 0 do not. Of the 3 distinct functions with an identity, 1 are also present in other papers whose code we hold (1 with at least one paper dated earlier, 0 the same month, 0 later) and 2 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
read_data 1 other paper
1 dated earlier
2210.11694 (2022-10)
Multi-View Reasoning: Consistent Contrastive Learning for Math Word Problem

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-24.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Large language models (LLMs) have recently demonstrated an impressive ability to perform arithmetic and symbolic reasoning tasks, when provided with a few examples at test time ("few-shot prompting"). Much of this success can be attributed to prompting methods such as "chain-of-thought'', which employ LLMs for both understanding the problem description by decomposing it into steps, as well as solving each step of the problem. While LLMs seem to be adept at this sort of step-by-step decomposition, LLMs often make logical and arithmetic mistakes in the solution part, even when the problem is decomposed correctly. In this paper, we present Program-Aided Language models (PAL): a novel approach that uses the LLM to read natural language problems and generate programs as the intermediate reasoning steps, but offloads the solution step to a runtime such as a Python interpreter. With PAL, decomposing the natural language problem into runnable steps remains the only learning task for the LLM, while solving is delegated to the interpreter. We demonstrate this synergy between a neural LLM and a symbolic interpreter across 13 mathematical, symbolic, and algorithmic reasoning tasks from BIG-Bench Hard and other benchmarks. In all these natural language reasoning tasks, generating code using an LLM and reasoning using a Python interpreter leads to more accurate results than much larger models. For example, PAL using Codex achieves state-of-the-art few-shot accuracy on the GSM8K benchmark of math word problems, surpassing PaLM-540B which uses chain-of-thought by absolute 15% top-1. Our code and data are publicly available at http://reasonwithpal.com/ .

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2211.10435")
get_code_for_paper("2211.10435")
have("2211.10435")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2211.10435.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2211.10435.svg)](https://syntology.ai/paper/2211.10435)

Connect an agent — have() is free.