You should be able to estimate any modern Transformer's parameter count from its (vocab, d_model, n_layers, d_ff, n_q_heads, n_kv_heads) tuple in your head, or at worst on a napkin. The formula is simple:
N ≈ vocab · d_model + n_layers · ((n_q + 2 n_kv) · d_model · d_head + d_model² + 3 · d_model · d_ff + 2 · d_model)
Breaking it down per block:
- Q projection: n_q_heads · d_model · d_head — same as d_model² when n_q_heads = d_model / d_head.
- K, V projections: n_kv_heads · d_model · d_head each. With GQA, much smaller than Q.
- Output projection: d_model² (mixes heads).
- FFN (SwiGLU): 3 · d_model · d_ff.
- RMSNorm × 2: 2 · d_model (negligible).
The dominant terms are the FFN (about 70% of per-block params) and the embedding (a one-time cost that becomes proportionally smaller in large models).