Sub topic 1
Small and Large Models: What Differs
Prerequisites
This chapter assumes you can read basic Python and have called a hosted language model through an API. You should know that models differ in cost, speed, and capability. You should also know what a token is and that providers charge per token. Nothing else is required.
Why tiers exist
Most providers sell language models in tiers. A small model has fewer parameters (the learned numbers inside the model). A large model has many more. The names vary by provider, but the pattern is the same: a cheap, fast model and an expensive, more capable one.
Routing means choosing which tier handles each request. Before you can route well, you need a clear picture of how the tiers differ. This chapter covers that picture. Later chapters cover how to choose between them.
The three differences
The tiers differ on three axes.
| Axis | Small model | Large model |
|---|---|---|
| Price per token | Low | High, often many times the small price |
| Latency (time to answer) | Short | Longer |
| Quality on hard tasks | Weaker | Stronger |
Quality is the axis people misjudge, so the next section looks at it in detail.
Cost
You pay per token, for both input (the prompt) and output (the reply). A large model can cost ten times more per token than a small one, or more. Exact prices change often, so check your provider's current price list. The ratio between the two tiers matters more than any single price, because routing savings come from that ratio.
Latency
A large model usually takes longer to produce each token and often takes longer to start. For a chat interface, this shows up as a slower first word and a slower stream of text. For a batch job, it shows up as lower throughput.
Quality
Quality is not one number. A small model may match a large one on easy tasks and fall well behind on hard ones. That uneven gap is what makes routing worthwhile.
Where the gap is small and where it is large
The gap depends on the task. These are tendencies, not guarantees, so measure on your own data.
- Small models often do well on classification, short extraction, simple rewriting, and answering common factual questions.
- Large models often do better on multi-step reasoning, long documents, code that spans several files, and instructions with many constraints.
If most of your traffic is the first kind, a small model can serve most requests at a fraction of the cost. A few requests are hard enough to need the large model. A router tries to tell the two groups apart.
A worked example
Suppose the small model costs 1 unit per request and the large model costs 10 units. You handle 1,000 requests.
- Send everything to the large model: 10,000 units.
- Send everything to the small model: 1,000 units, but some hard requests get poor answers.
- Send 80% to the small model and 20% to the large one: 800 + 2,000 = 2,800 units.
The third option cuts cost by 72% compared with the first. It only works if the router sends the right requests to each tier. If it sends hard requests to the small model, quality drops. If it sends easy requests to the large model, you lose the savings.
The following code reproduces the arithmetic. It runs as shown.
def total_cost(n_requests, frac_small, cost_small, cost_large):
small_count = n_requests * frac_small
large_count = n_requests - small_count
return small_count * cost_small + large_count * cost_large
all_large = total_cost(1000, 0.0, 1, 10)
mixed = total_cost(1000, 0.8, 1, 10)
print(all_large) # 10000.0
print(mixed) # 2800.0
print(round(1 - mixed / all_large, 2)) # 0.72Other differences that affect routing
Cost, latency, and quality are the main axes. A few others matter in practice.
- Context window. This is the maximum amount of text a model can read at once. Small models sometimes have smaller windows, so a very long prompt may only fit in the large model.
- Output style. Two tiers from the same provider may format answers differently. If your application parses the output, test both tiers against the same parser.
- Rate limits. Providers cap requests per minute for each model. The tiers can have different caps, which affects how much traffic each can absorb.
- Consistency. Small models tend to vary more on hard prompts. The same prompt may succeed one time and fail the next.
Common mistakes at this stage
- Assuming bigger is always better. For easy tasks, the large model adds cost and delay without improving the answer.
- Judging quality from a few examples. One good or bad answer says little. Use a labeled sample, which a later chapter describes.
- Ignoring input length. Long prompts raise cost on both tiers. They also may exceed the small model's context window.
- Comparing prices without comparing latency. A cheaper model that is also faster improves two axes at once. The trade-off is only about quality.
What comes next
You now have the vocabulary: tiers, per-token cost, latency, and uneven quality. The next chapter turns these into a single trade-off and shows how to reason about it with numbers.
Exercise
A small model costs 2 units per request and a large model costs 20 units. A router sends 70% of 500 requests to the small model and the rest to the large model. What is the total cost, and how much does it save compared with sending everything to the large model?
Show answer
Small: 350 requests × 2 = 700 units. Large: 150 requests × 20 = 3,000 units. Total is 3,700 units. Sending all 500 to the large model costs 500 × 20 = 10,000 units. The saving is 6,300 units, or 63%.
Exercise
Name two reasons a request might have to go to the large model even if the small model is cheaper and faster.
Show answer
Any two of: the task needs multi-step reasoning that the small model handles poorly, the prompt is longer than the small model's context window, or the answer must meet a quality bar that the small model misses on that kind of task.