Sub topic 5
What model size means for quality and cost
This chapter assumes you know what a token and a context window are, can read basic Python, and have called an LLM API before. Here you will learn what "model size" measures and how it affects quality, memory, speed, and price.
What a parameter count is
A model's size is its number of parameters. Parameters are the numeric weights the model learned during training. A "7B" model has about 7 billion of them. Names like 7B, 70B, or 400B come from this count.
Size is a rough proxy for capability. Larger models usually handle harder reasoning, rarer knowledge, and longer instructions better. But the relationship is not strict. A newer, well-trained 8B model can beat an older 30B model. Training data, training method, and fine-tuning all matter.
Size drives cost in three places
| Resource | Effect of a larger model |
|---|---|
| Memory | Weights must fit in GPU or system memory. |
| Latency | More computation per generated token, so each token arrives more slowly. |
| Price | Hosted providers charge more per token for larger tiers. |
Memory is easy to estimate. Weight memory is parameter count times bytes per weight. At 16 bits, each weight takes 2 bytes.
def weight_memory_gb(params_billion: float, bits_per_weight: int) -> float:
"""Memory for the weights alone, in GB (1 GB = 1e9 bytes)."""
return params_billion * bits_per_weight / 8
for bits in (16, 8, 4):
print(f"7B model at {bits}-bit: {weight_memory_gb(7, bits):.1f} GB")
# 7B model at 16-bit: 14.0 GB
# 7B model at 8-bit: 7.0 GB
# 7B model at 4-bit: 3.5 GBA 70B model at 16-bit needs about 140 GB for weights alone. That is more than a single common GPU holds, so it needs multiple GPUs. A 7B model fits on one consumer GPU.
Quality does not scale evenly
Bigger models help most on tasks that are hard for small ones. Many everyday tasks do not need that capability:
- Extracting fields from text
- Classifying support tickets
- Reformatting or summarizing short documents
Small models often handle these well, especially with a clear prompt. Multi-step reasoning, complex code, and subtle instruction following are where large models earn their cost.
Common errors
- Assuming bigger is always better. You pay more and wait longer for no gain if the task is easy.
- Comparing sizes across model families. A parameter count only compares fairly within the same family and generation.
- Forgetting that some models activate only part of their weights. Mixture-of-experts models have a large total count but use a fraction per token. Memory follows the total. Compute follows the active part.
- Choosing by name alone. Only your own test examples tell you whether a smaller model is good enough. A later chapter shows how to build that test.
Exercise
You want to run a 13B model at 8-bit precision on a GPU with 16 GB of memory. Estimate the weight memory. Is it likely to fit comfortably?
Show answer
Weights take 13 × 8 / 8 = 13 GB. That leaves about 3 GB for the KV cache and runtime overhead. It may fit for short contexts, but it is tight. A 4-bit version (6.5 GB) would leave much more room.
Exercise
Why can a smaller model from a newer generation outperform a larger model from an older one?
Show answer
Parameter count is only one factor. Better training data, longer training, and improved methods can make each parameter more useful, so a newer small model can beat an older large one.