Sub topic 11
Choosing when to reason and how much
This chapter assumes you can call an LLM API from Python, know what tokens and max output tokens are, and have read the earlier chapters on reasoning tokens, effort levels and thinking budgets. Here you will turn those settings into a decision.
Reasoning is a cost you opt into
A reasoning model spends extra output tokens on hidden thinking before it answers. Those tokens are billed and they add latency. So the question for each task is whether the extra thinking changes the answer enough to pay for it.
Reasoning tends to help when the task needs several dependent steps, where an early mistake ruins the result. It helps little when the answer is a lookup, a rewrite, or a short pattern match.
| Task | Reasoning helps? | Starting setting |
|---|---|---|
| Classify a support ticket into one of five labels | Rarely | Standard model, or low effort |
| Extract fields from an invoice | Rarely | Standard model, or low effort |
| Summarize a meeting transcript | Rarely | Standard model, or low effort |
| Multi-step arithmetic or scheduling | Often | Medium effort |
| Debug a failing function across several files | Often | Medium to high effort |
| Plan a database migration with constraints | Often | High effort |
Treat the last column as a hypothesis to test, not a rule. Models and prompts differ.
A decision flow
Start from the cheapest option that could work. Move up only when measurements show a gap.
Constraints that decide for you
Some limits settle the choice before accuracy does.
- Latency. A chat interface where users wait for each reply may not tolerate many seconds of thinking. A nightly batch job can.
- Cost. Reasoning tokens are billed as output tokens. A task run a million times a day multiplies any extra thinking.
- Output limits. Reasoning shares the output cap. With a tight
max_tokens, high effort can use the whole budget and leave no room for the visible answer. - Error cost. If a wrong answer is expensive, such as a financial calculation, extra thinking can be worth the price.
Overthinking and diminishing returns
More thinking does not always mean better answers. On easy tasks, high effort can add cost with no accuracy gain, and it can sometimes talk the model out of a correct first answer. Accuracy often rises quickly from low to medium effort, then flattens. The point where the curve flattens is usually the setting you want.
Routing by difficulty
You do not have to pick one setting for a whole product. A common pattern is to route each request. Cheap rules or a small model decide whether a request is simple or hard, and hard ones get more effort.
def choose_effort(prompt: str) -> str:
"""Pick an effort level from simple signals. Replace with measured rules."""
text = prompt.lower()
hard_markers = ("prove", "debug", "optimize", "step by step", "schedule")
if len(prompt) > 2000 or any(marker in text for marker in hard_markers):
return "high"
if any(char.isdigit() for char in prompt):
return "medium"
return "low"
print(choose_effort("Summarize this paragraph."))
print(choose_effort("A train leaves at 14:10 and arrives at 17:45. How long?"))
print(choose_effort("Debug this function and explain the failure."))This heuristic is deliberately crude. Check it against your own cases using the comparison loop from the previous chapter, and adjust the rules where it misroutes requests.
Putting it together
- Write 20 to 50 real test cases with known correct answers.
- Run them on a standard model and on a reasoning model at low, medium and high effort.
- Record accuracy, average latency and tokens used.
- Choose the cheapest setting that meets your accuracy target within your latency limit.
- Re-run the test when you change models or prompts.
Exercise
Your app extracts the order number from short customer emails and must reply in under one second. A teammate proposes high effort "for accuracy". What do you recommend, and how would you check it?
Show answer
Use a standard model or low effort. Extraction is a lookup, not a multi-step problem, and high effort adds latency and cost that likely breaks the one-second limit. Check by running a set of real emails at each setting and comparing accuracy and latency. If accuracy is the same, keep the cheaper, faster option.
Exercise
At high effort, a request with max_tokens set to 1500 returns an empty answer. What is the likely cause, and what are two fixes?
Show answer
Reasoning tokens count toward the output cap, so thinking consumed the whole 1500 tokens and left none for the visible answer. Fixes: raise max_tokens, or lower the effort level or thinking budget.