Sub topic 13
Measuring effort settings on your own task
This chapter assumes you can call a reasoning model API from Python. It also assumes you know what reasoning tokens, effort levels and thinking budgets are from the earlier chapters. Here you will turn the choice of an effort setting into a measurement.
Why measure
Public benchmarks tell you how a model does on someone else's problems. Your task has its own difficulty, answer format and latency limits. Higher effort usually costs more time and tokens, but it only pays off if accuracy rises enough on your inputs. The only way to know is to run your own cases at each setting.
Design a small experiment
Keep the experiment small enough to repeat whenever the model or prompt changes.
- Collect 20 to 50 real prompts from your task. Include easy, typical and hard ones.
- Write an expected answer for each. Choose answers that can be checked by code, such as a number, a label or a short phrase.
- Run every prompt at each effort level, with everything else fixed: the model, the prompt and the output limit.
- Record accuracy, time per case and tokens used.
- Choose the cheapest setting that meets your accuracy target.
A provider-neutral comparison loop
The function below takes any ask(prompt, effort) function that returns the answer as a string. This keeps the loop independent of the provider.
import time
def compare_efforts(ask, cases, efforts=("low", "medium", "high")):
"""ask(prompt, effort) -> answer string. cases is a list of (prompt, expected)."""
results = {}
for effort in efforts:
correct = 0
start = time.perf_counter()
for prompt, expected in cases:
answer = ask(prompt, effort)
if expected.strip().lower() in answer.strip().lower():
correct += 1
elapsed = time.perf_counter() - start
results[effort] = {
"accuracy": correct / len(cases),
"seconds_per_case": elapsed / len(cases),
}
return resultsThe check is a case-insensitive substring match. That is lenient, so an expected answer of 3 also matches a response containing 13. Use distinctive expected answers, or compare after extracting the final answer.
Connect it to a real model
Wrap one API call in an ask function. This version uses the OpenAI Responses API and passes the effort level through the reasoning parameter.
from openai import OpenAI
client = OpenAI()
def ask(prompt, effort):
response = client.responses.create(
model="o4-mini",
reasoning={"effort": effort},
input=prompt,
)
return response.output_text
cases = [
("A train leaves at 14:10 and arrives at 17:45. How long is the trip in minutes?", "215"),
("What is 17 * 24?", "408"),
]
for effort, stats in compare_efforts(ask, cases).items():
print(effort, stats)For a model with a thinking budget, such as Claude, change the wrapper to send thinking={"type": "enabled", "budget_tokens": N}. Return only the text blocks. Then loop over budgets instead of effort names. Remember that max_tokens must be larger than budget_tokens.
Read the results
A typical outcome looks like this table. The numbers are illustrative.
| Effort | Accuracy | Seconds per case |
|---|---|---|
| low | 0.72 | 2.1 |
| medium | 0.88 | 5.4 |
| high | 0.90 | 14.0 |
Here medium gains 16 points over low. High adds only 2 points for more than twice the time. If 0.85 is your target, medium is the right choice. This is the diminishing-returns pattern from the overthinking chapter, observed on your own data.
Common errors
- Too few cases. With 10 cases, one answer changes accuracy by 10 points. Use more cases before trusting small gaps.
- Single runs. Output varies between runs. Repeat the experiment, or use more cases, before treating a 2-point difference as real.
- Changing two things at once. Change only the effort setting between runs.
- Ignoring tokens. Latency can hide cost. Also log
usage.output_tokensandreasoning_tokensfor each call. - Truncated answers. A low output limit can cut off reasoning and make high effort look worse than it is. Check for incomplete responses before comparing.
Exercise
Your run shows low effort at 0.60 accuracy, medium at 0.84 and high at 0.85. High takes three times as long as medium. Your target is 0.80. Which setting do you choose, and what do you check before trusting the numbers?
Show answer
Choose medium. It meets the 0.80 target, and high adds only one point for three times the latency. Before trusting the numbers, check the number of cases (a one-point gap is small), whether the output limit truncated any answers, and whether repeated runs give similar accuracy.