Small Language Model Design › Capacity Allocation: Depth, Width, and Ratio
Language AI HandbookAll chapters To compare a deeper model with a wider model, first choose what you want to hold fixed. A fixed parameter budget is useful for comparing model files. A fixed cache budget is useful when context and concurrency matter. These budgets constrain different combinations of depth, width, and head count, so an architecture that fits the first may exceed the second.
MobileLLM studies this trade-off below a billion parameters. Its authors compare depth and width and build models using deep-and-thin layouts, shared embeddings, and grouped-query attention. They also study sharing a block's weights across adjacent steps without increasing the parameter count. The block still runs at each step, so this strategy saves stored weights while retaining those sequential operations. It is a candidate to measure when parameter memory is scarce.
Use the accountant to propose configurations before training:
- Depth and width. Compare 24 layers at width 1,024 with 12 at width 1,536, holding the tied vocabulary at 32K. The first has about 335M counted weights, while the second has about 389M. They illustrate why comparing layer counts alone can confound the shape change with a change in total size.
- FFN width. At fixed layer count and hidden width, lowering the intermediate width by 1,024 saves three times 1,024 times the hidden width per layer. Reallocate some of the savings to depth if that is the hypothesis you want to test. Both candidates need to be evaluated on the same held-out tasks.
- Head counts. For a cache-limited deployment, use the target maximum context when checking whether either candidate fits. Adding layers grows the cache with each additional layer. The number of KV heads and their widths can change the cost per layer.
There are two useful matched comparisons here. To study representation on a fixed task, choose shapes with similar stored parameter counts and keep the tokenizer, training data, and exposures fixed. To study deployment, select shapes that all fit the real device and compare them at the same context, batch size, and output length. Similar file sizes do not by themselves imply similar times to first token or decode rates. Measuring both comparisons helps identify which part of the budget is responsible for the difference.
The Chinchilla study estimates how model size and training tokens should change together under a fixed training-compute budget. A deployment comparison also needs device memory, latency, and task results. The scaling-law chapter covers the original training objective.
Comments
Add to the conversation
A question, a correction, or an example from your own work.
No comments yet. Be the first to share your thoughts!