- Overview
- big reasoning models turn text into correct structured data, but are slow and expensive
- small models are cheap, but make mistakes
- a cascade runs the small model first and pays for the big one only when a check flags the small model’s answer
- the models we use:
- rung 0 (cheap):
gpt-6-luna - rung 1 (reasoning):
gpt-6.1-solwithreasoning_effort="high" - verifier:
jev-1.14.0
- rung 0 (cheap):
- Algorithm
- Answer with the cheap model, as a JSON object that matches a schema.
- Verify with Jev: ask yes/no questions (“Noul questions”) about the answer, one per rule it must follow, such as “does this time overlap someone’s meeting?”; each returns P(the rule is broken).
- Escalate to the reasoning model if the answer fails the schema or a rule check fires; otherwise keep the cheap answer.
Setup
Run in Colab
Runs as published without an API key.
Python file
This page as one .py file, to run locally.
Open in playground
Edit one request and run it live. Needs a TypeSafe account.
uv run cascade_cookbook.py installs the dependencies for you.
The code replays saved answers, so it runs as published without an API key. To change a
request, set TYPESAFE_API_KEY and OPENAI_API_KEY; in Colab, add them in the Secrets
panel.
Step 1: the data
example.jsonholds one task from the calendar set of NATURAL PLAN: the busy times of three people on one work day, and a one-hour meeting to fit around them- the code below downloads it from typesafe-public-examples unless it is already on disk
- Every fact the answer depends on is in the text, but the answer itself isn’t: the model has to work out a free hour from the busy times
- Shirley has four meetings, so only one full hour of the day is free for all three
Step 2: answer with the cheap model
- the prompt ends with a JSON Schema for the answer: a day, a start time and an end time
- the model reads the schema in the prompt and replies with plain text that we parse. We don’t use structured outputs, which would force valid JSON and hide the rare answer that breaks the schema
- The answer is schema-valid (the line above prints
True), yet it’s wrong:- Monday 10:30-11:30 overlaps Joan’s meeting at 11:00 and Shirley’s at 11:00
- a JSON-Schema check can’t see this. A cheap model produces confident, schema-satisfying mistakes of this kind, and catching them is the job of a semantic verifier
Step 3: verify with Jev
- the verifier is Jev; we ask it one
Noulquestion per rule the answer must follow, each framed so thattrue= the rule is broken (escalate) - Jev returns a calibrated
noul=P(true)per question, in one system_one call - the state holds the task and the cheap model’s record; Jev never sees a correct answer
- The TypeSafe Way: Decomposition
- we split the check in code into narrow questions, one per rule, never one question about the whole answer
- a flag then names the rule that broke, and each question can be reworded or re-thresholded on its own
- a single “is this answer right?” returns one score that cannot say what went wrong
- see Decompose the questions
-

- Only the broken rule scores high:
busy_conflictfires at 0.97- every other rule stays at 0.25 or below
Step 4: decide whether to escalate
- escalate if the answer failed the schema check, or if any rule’s probability exceeds
FIRE_T - this is a
max-style check, not a mean, so one confident red flag is enough instead of being averaged into silence - one threshold works only if the questions separate, scoring high on broken rules and low on kept ones, as in Step 3
- the verifier has to cost far less than the reasoning rung, or the cascade saves nothing
Step 5: escalate to the reasoning model
Since a check fired, we pay for the strong model (gpt-6.1-sol,
reasoning_effort="high")
- The improvement
- The reasoning model proposes Monday 14:00-15:00, which is free for all three people
- The cascade paid for the reasoning model on this task only because the verifier flagged it
Step 6: the cascade on 1,000 tasks
- One example shows how the loop runs. To see whether it pays, we run it on many tasks and plot cost against quality
- A cascade pays when the cheap model is right most of the time and its mistakes break
rules a check can see. Scheduling a meeting fits:
- task: the 1,000 calendar-scheduling tasks of NATURAL PLAN. Each gives the busy times of 2 to 7 people across 1 to 5 work days, how long the meeting should be, and sometimes a preference, such as “would rather not meet on Monday”. The model proposes one time that works for everyone
- prompt: each task’s text, ending with the JSON Schema from Step 2
- models:
gpt-6-lunawith default reasoning is the cheap rung, andgpt-6.1-solwithreasoning_effort="high"is the strong one. Both answer every task, so we know what each does alone - checks: the six rule questions from Step 3. A task’s flag is the highest of the six, or 1 when luna’s answer fails the schema check
- cascade: a task goes to sol-high when its flag is above the threshold. Its cost is luna plus Jev, plus sol-high when it goes on
- grading: an answer works if it is JSON that matches the schema and proposes one of
the task’s valid times. Some tasks admit more than one valid time, which we added to
NATURAL PLAN’s answer key; the full key is in
calendar_answers.json. Grading only scores answers and plays no part in the cascade
calendar_sweep.pymade these calls and wrote one row per task tocalendar_results.csv. The code below draws the chart from that file and calls nothing- Numbers below came from
jev-1.14.0on 2026-11-05


- How to read it:
- black diamonds: each model on its own, with ±1 SEM bars. Cost barely varies from task to task, so the cost bars are narrower than the markers
- blue points: the cascade at every threshold. The line joins the points no other point beats on both cost and quality
- What it shows:
- luna alone gets 92.6% of answers right at $0.16 per 1,000 tasks, and sol-high alone 98.1% at $1.89
- 72 of luna’s 74 wrong answers pass the schema check, so only Jev’s rule checks can catch them
- sending the 3% of tasks Jev flags most to sol-high lifts the cascade to 94.9% for $0.26
- sending 13% reaches 96.5% for $0.49, about a quarter of sol-high’s cost
- sending 54% matches sol-high, 98.1%, for $1.31. Past 64% (98.3% for $1.50), spending more buys nothing, which the flat line on the right shows
- Jev’s checks cost $0.04 per 1,000 tasks

