Architecture Hyperparameters › Summary

Michael BrenndoerferUpdated June 18, 20252 min read
Language AI HandbookAll chapters
Part 16 of 67Transformer Architectures
Chapter 116Architecture Hyperparameters › Summary
Reading section 8 of 10 · Summary · 2 minSection 8 of 10 · 2 min

Book contents

Section 8 of 10 · 2 min read

Architecture Hyperparameters › SummaryOne section · Sections in this chapter8 / 10 ↓
Reading tools Definitions & inline links

Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.

Article links

Make inline references clickable

Transformer architecture hyperparameters determine model capacity, computational requirements, and ultimately performance. The key takeaways from this chapter are:

  • Six core hyperparameters define a transformer: vocabulary size (VV), layers (LL), model dimension (dmodeld_{\text{model}}), attention heads (nheadsn_{\text{heads}}), head dimension (dheadd_{\text{head}}), and FFN dimension (dffd_{\text{ff}}). Everything else derives from these choices.

  • Depth scales linearly, width quadratically. Doubling the number of layers doubles parameters; doubling the model dimension quadruples them. This makes depth a more parameter-efficient way to add capacity, but both contribute to model expressiveness in different ways.

  • Head dimensions cluster around 64-128. This empirical sweet spot balances per-head capacity with the benefits of multiple parallel attention mechanisms. The number of heads is then determined by nheads=dmodel/dheadn_{\text{heads}} = d_{\text{model}} / d_{\text{head}}.

  • FFN expansion follows predictable ratios. Standard FFNs use dff=4×dmodeld_{\text{ff}} = 4 \times d_{\text{model}}, while SwiGLU-based FFNs use approximately 2.7×dmodel2.7 \times d_{\text{model}} to maintain equivalent parameter counts.

  • Grouped-query attention trades parameters for memory. GQA reduces KV cache size during inference by sharing key-value projections across multiple query heads, enabling longer context windows without proportional memory increases.

  • FFN dominates parameter counts. At larger scales, feed-forward networks contain the majority of parameters, making them the primary target for efficiency innovations like mixture-of-experts.

  • Hardware alignment matters. Dimensions should be multiples of 8, 64, or 128 for efficient tensor core utilization. The number of heads should divide evenly across GPUs for tensor parallelism.

When designing a new architecture, start with proven configurations from similar-scale models, ensure hardware-friendly dimensions, and adjust based on your specific constraints and empirical results. The art of architecture design lies in balancing these considerations while respecting the fundamental trade-offs between capacity and compute, alongside memory.