Architecture Hyperparameters › Key Parameters
Language AI HandbookAll chapters Architecture Hyperparameters › Key ParametersOne section · Sections in this chapter9 / 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
When designing or analyzing transformer architectures, the following parameters have the most significant impact:
-
(number of layers): Controls model depth and hierarchical abstraction capability. Start with 12-24 layers for smaller models (< 1B parameters) and scale to 32-80+ for larger models. Deeper models generally improve reasoning and multi-step tasks but require more careful initialization and training stability measures.
-
(model dimension): The primary driver of per-layer capacity. Should be a multiple of 128 for optimal hardware utilization. Common values range from 768 (small models) to 8192 (frontier models). Quadratic impact on parameters means width is expensive.
-
(attention heads): Determines how many parallel attention patterns the model can learn. Set based on desired : for , use . More heads allow finer-grained attention but increase overhead.
-
(head dimension): Target 64-128 for most applications. Smaller values allow more heads but reduce per-head expressiveness. Larger values (256+) rarely improve performance and reduce head count.
-
(FFN dimension): Set to for standard FFN or approximately for SwiGLU. Round to multiples of 256 for efficient GPU computation. This parameter dominates total parameter count.
-
(GQA heads): For inference-optimized models, reduce KV heads to 8-16 regardless of query head count. Reduces KV cache memory proportionally with minimal quality loss. Essential for long-context models.
-
(vocabulary size): Typically 32K-100K tokens. Larger vocabularies improve compression but increase embedding memory. Choose based on target languages and tokenization strategy.