Sub topic 1
Small and Large Models: What Differs
Prerequisites
This chapter assumes basic Python, experience calling a hosted language model through an API, and familiarity with tokens and per-token pricing.
Small and large models: what differs
A small model usually has lower cost and latency. Latency is the time between sending a request and receiving a response. A large model usually handles harder reasoning, longer context, and ambiguous instructions more reliably.
| Model tier | Strength | Typical limitation |
|---|---|---|
| Small | Cheap and fast for routine work | More errors on difficult tasks |
| Large | Better quality on complex work | Higher cost and slower responses |
The difference is not absolute. A small model may answer a simple question correctly, while a large model may still fail on an unclear request. Routing chooses a model per request instead of sending every request to the same tier.
The cost, latency, and quality trade-off
A router balances three competing goals:
- Cost: smaller models generally use fewer paid tokens or have lower per-request prices.
- Latency: smaller models generally respond faster.
- Quality: larger models often perform better on reasoning, coding, and unusual inputs.
For example, an application might send summarization and classification requests to a small model, but send complex debugging or multi-step analysis to a large model. This can reduce average cost while preserving quality where it matters.
A router that sends each request to exactly one model pays for one model call. A cascade first calls the small model and escalates uncertain requests, so escalated requests pay for both calls.
def route(prompt: str) -> str:
text = prompt.lower()
hard_markers = ("prove", "step by step", "refactor", "analyze")
if len(prompt) > 4000 or any(marker in text for marker in hard_markers):
return "large"
return "small"
print(route("Summarize this paragraph."))
print(route("Analyze this algorithm step by step."))What a router can look at
A router can inspect signals available before generation:
- Prompt length or estimated token count
- Words that suggest reasoning, coding, or analysis
- Request type, such as summarization or extraction
- User tier, deadline, or latency requirement
- Previous failures or quality feedback
These signals are imperfect. A short prompt can require difficult reasoning, and a long prompt can be easy. Treat rules as a starting point. Measure their accuracy and cost before relying on them.
Exercise
Which model tier should usually receive a routine classification request, and why?
Show answer
The small model, because routine classification often needs low cost and low latency rather than advanced reasoning.