Paper · 2207.10342 · ICML · 2022
Language Model Cascades
Charles Sutton, Aitor Lewkowycz, Yuhuai Wu, Jascha Sohl-Dickstein, David Dohan, David Bieber, Jacob Austin, Henryk Michalewski, Winnie Xu, Raphael Lopes, Rif Saurous, Kevin Murphy
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-22; 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.
- 0 ran with no instrument failure
0 honoured the contract we drafted, 0 violated it, 0 have no contract verdict
- 3 ran where Syntology's instrument failed
failures of Syntology's instrument, not of the code: 3 where our contract draft was wrong, 0 where the contract check could not run
- 0 have no recorded run
- 0 of those that ran constructed an object rather than computing a result
an executed sample whose run returned an instance of its own class (fixture_out_type equals the entry name): the run built an object and did not compute a result
- 0 are pointer only: the body is not served under this paper's link
"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/2207.10342.json · badge: /api/ran/2207.10342.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.
| Repository | Role | Ran |
|---|
| google-research/cascades |
canonical (classifier label) classifier basis: classifier_2025 |
3 ran · 0 no recorded run |
| Function | Status | Where it lives |
|---|
| fewshot_prompt |
Ran ran; our contract draft was wrong, not the code |
google-research/cascades/cascades/examples/scratchpad.py code served (permissive licence) · get_code("e877875ad0510c06") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) 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 dataclasses
from typing import Dict, Iterable, Tuple, Optional, Text, List
@dataclasses.dataclass
class ReasonIO:
"""Represents a question and answer, together with reasoning."""
question: Text
reason: Optional[Text] = None
answer: Optional[Text] = None
id: Optional[Text] = dataclasses.field(default=None)
# Create example ReasonIO instances with question, reason, and answer
example1 = ReasonIO(
question="What is 2 + 2?",
reason="Adding 2 and 2 together gives us 4.",
answer="4",
id="ex1"
)
example2 = ReasonIO(
question="What is the capital of France?",
reason="France is a country in Europe and its capital city is Paris.",
answer="Paris",
id="ex2"
)
example3 = ReasonIO(
question="Is water wet?",
reason="Water molecules create wetness when they interact with surfaces.",
answer="Yes",
id="ex3"
)
# Create a target ReasonIO with only a question (no reason or answer)
target = ReasonIO(
question="What is the meaning of life?",
reason=None,
answer=None,
id="target1"
)
# Create the examples list
examples = [example1, example2, example3]
# Define ARGS dictionary
ARGS = {
"examples": examples,
"target": target
}
- Setup block drafted by
- a language model, Claude Sonnet 4.5, prompt python_fixture_v1
- 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 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
|
| load_dataset |
Ran ran; our contract draft was wrong, not the code |
google-research/cascades/cascades/examples/tasks/gsm8k.py code served (permissive licence) · get_code("45fbdf255c58060f") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) 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 os
import tempfile
import json
# Create a temporary directory with mock GSM8K data
temp_dir = tempfile.mkdtemp()
# Create mock train.jsonl
train_data = [
{"question": "What is 2+2?", "answer": "The answer is 4.\n#### 4"},
{"question": "What is 5*3?", "answer": "The answer is 15.\n#### 15"},
{"question": "What is 10-3?", "answer": "The answer is 7.\n#### 7"}
]
train_path = os.path.join(temp_dir, 'train.jsonl')
with open(train_path, 'w') as f:
for example in train_data:
f.write(json.dumps(example) + '\n')
# Create mock test.jsonl
test_data = [
{"question": "What is 8+1?", "answer": "The answer is 9.\n#### 9"},
{"question": "What is 6*2?", "answer": "The answer is 12.\n#### 12"}
]
test_path = os.path.join(temp_dir, 'test.jsonl')
with open(test_path, 'w') as f:
for example in test_data:
f.write(json.dumps(example) + '\n')
ARGS = {
'base_dir': temp_dir
}
- Setup block drafted by
- a language model, Claude Sonnet 4.5, prompt python_fixture_v1
- 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
|
| process_gsm8k_example |
Ran ran; our contract draft was wrong, not the code |
google-research/cascades/cascades/examples/scratchpad.py code served (permissive licence) · get_code("f00b008c48fbe442") How it ranRan in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned ReasonIO. 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 dataclasses
from typing import Dict, Text, Optional
@dataclasses.dataclass
class ReasonIO:
"""Represents a question and answer, together with reasoning."""
question: Text
reason: Optional[Text] = None
answer: Optional[Text] = None
id: Optional[Text] = dataclasses.field(default=None)
def process_gsm8k_example(x: Dict[Text, Text]) -> ReasonIO:
"""Convert gsm8k dicts into ReasonIO."""
return ReasonIO(question=x['question'], reason=x['answer'].split('####')[0].strip(), answer=x['final_answer'], id=x['id'])
# Construct a valid gsm8k example dict
x_example = {
'question': 'What is 2 + 2?',
'answer': 'To solve this problem, we add 2 and 2 together.\n2 + 2 = 4\n####\n4',
'final_answer': '4',
'id': 'gsm8k_001'
}
ARGS = {
'x': x_example
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1
- 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 ReasonIO — a ReasonIO output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a ReasonIO 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, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 3 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.
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-22.
Repositories linked to this paper
Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.
Abstract
Prompted models have demonstrated impressive few-shot learning abilities. Repeated interactions at test-time with a single model, or the composition of multiple models together, further expands capabilities. These compositions are probabilistic models, and may be expressed in the language of graphical models with random variables whose values are complex data types such as strings. Cases with control flow and dynamic structure require techniques from probabilistic programming, which allow implementing disparate model structures and inference strategies in a unified language. We formalize several existing techniques from this perspective, including scratchpads / chain of thought, verifiers, STaR, selection-inference, and tool use. We refer to the resulting programs as language model cascades.
For agents
The same record, over MCP at https://syntology.ai/mcp:
get_harvested_code_for_paper("2207.10342")
get_code_for_paper("2207.10342")
have("2207.10342")
The run record, dated, one paper per request, free:
curl https://syntology.ai/api/ran/2207.10342.json
A badge for a README (the split and the date, never a ratio):
[](https://syntology.ai/paper/2207.10342)
Connect an agent — have() is free.