Rúben GalvãoThe Rabbit Hole

The Rabbit Hole / AI / Model architectures

Sarvam AI · Architecture map

Sarvam 30B

A grouped-query attention MoE decoder with 18 routed layers after a dense opening.

Sarvam 30B, March 2026 · Sarvam release timeline

Inside Sarvam 30B

Parameters
30B
Layers
19
Width
4,096
Mixer
Grouped-query
Select a component to explore it. Layer colours match the execution-order strip.
The complete Sarvam 30B architectureInput IDs select embeddings. Layer types execute in the order strip; dotted lines connect the type examples below. 64 query heads share four KV heads of width 64 (16 queries per KV head). Q and K receive per-head RMSNorm before full-width RoPE (base 8,000,000). The fused QKV projection splits into 64 query, four key and four value heads. Each of 19 layers stores four 64-coordinate keys and four 64-coordinate values per token: 512 values per layer per token. Full causal history; no sliding window. Final normalisation and output weights produce vocabulary scores and the next-token distribution.Text becomes token IDs.Text → tokens → IDstheoldrabbitsleepsEmbedding lookup262,1444,096Input token vectorsCL4,096Execution order · 19 layersLayer 1: Opening dense layerLayer 2: Routed layersLayer 3: Routed layersLayer 4: Routed layersLayer 5: Routed layersLayer 6: Routed layersLayer 7: Routed layersLayer 8: Routed layersLayer 9: Routed layersLayer 10: Routed layersLayer 11: Routed layersLayer 12: Routed layersLayer 13: Routed layersLayer 14: Routed layersLayer 15: Routed layersLayer 16: Routed layersLayer 17: Routed layersLayer 18: Routed layersLayer 19: Routed layersOpening dense layer · matches this colour in the execution-order barOpening dense layerOpening dense layer · 1 repetitionsIndependent layer type1RMSNorm before this operation.RMSNormGrouped-query attention: Dense feed-forward intermediate width 8192.Grouped-queryattentionRotate query and key position components before attention scores; values are unchanged. Dense feed-forward intermediate width 8192.RoPENormalise queries and keys before attention scores. 64 query heads share four KV heads of width 64 (16 queries per KV head). Q and K receive per-head RMSNorm before full-width RoPE (base 8,000,000). The fused QKV projection splits into 64 query, four key and four value heads.QK-normAdd the branch output to the original stream. +RMSNorm before this operation.RMSNormSwiGLU: Dense feed-forward intermediate width 8192.SwiGLUAdd the branch output to the original stream. +Layer type · execution order aboveRouted layers · matches this colour in the execution-order barRouted layersRouted layers · 18 repetitions18 layers · one layer shown18RMSNorm before this operation.RMSNormGrouped-query attention: 128 routed SwiGLU experts of width 1024, six selected per token, plus an always-active shared SwiGLU expert of width 1024.Grouped-queryattentionRotate query and key position components before attention scores; values are unchanged. 128 routed SwiGLU experts of width 1024, six selected per token, plus an always-active shared SwiGLU expert of width 1024.RoPENormalise queries and keys before attention scores. 64 query heads share four KV heads of width 64 (16 queries per KV head). Q and K receive per-head RMSNorm before full-width RoPE (base 8,000,000). The fused QKV projection splits into 64 query, four key and four value heads.QK-normAdd the branch output to the original stream. +RMSNorm before this operation.RMSNormMoE: 128 routed SwiGLU experts of width 1024, six selected per token, plus an always-active shared SwiGLU expert of width 1024.MoE6 of 128 routed experts selected per token. Highlighted boxes are schematic; boxes do not correspond one-to-one to experts. 1 shared experts run for every token.Add the branch output to the original stream. +6 of 128 experts + 1sharedLayer type · execution order aboveAfter all 19 layer executionsResidual streamLast columnCL4,096Final RMSNormA separate learned vocabulary projection.Output weights4,096262,144Vocabulary scoresSoftmax262,144Next-token probabilities
Inside grouped-query attention · Opening dense layer
16 query heads per group × 4 K/V groups.

Earlier context dimmed · current token bright · dashed regions contain cached entries.

Sarvam 30B: Opening dense layer · grouped-query attention64 query heads share four KV heads of width 64 (16 queries per KV head). Q and K receive per-head RMSNorm before full-width RoPE (base 8,000,000). The fused QKV projection splits into 64 query, four key and four value heads. Each of 19 layers stores four 64-coordinate keys and four 64-coordinate values per token: 512 values per layer per token. Full causal history; no sliding window.4 KV groups; the front face shows one representative.4 KV groups16 heads / group; the front face shows one representative.16 heads / groupAttention input. 64 query heads share four KV heads of width 64 (16 queries per KV head). Q and K receive per-head RMSNorm before full-width RoPE (base 8,000,000). The fused QKV projection splits into 64 query, four key and four value heads.Earlier context is dimmed; outlined columns are current.Current token computation.Attention input4,096CLWq. 64 query heads share four KV heads of width 64 (16 queries per KV head). Q and K receive per-head RMSNorm before full-width RoPE (base 8,000,000). The fused QKV projection splits into 64 query, four key and four value heads.Wq4,09664Wk. 64 query heads share four KV heads of width 64 (16 queries per KV head). Q and K receive per-head RMSNorm before full-width RoPE (base 8,000,000). The fused QKV projection splits into 64 query, four key and four value heads.Wk4,09664Wv. 64 query heads share four KV heads of width 64 (16 queries per KV head). Q and K receive per-head RMSNorm before full-width RoPE (base 8,000,000). The fused QKV projection splits into 64 query, four key and four value heads.Wv4,09664RMSNorm. 64 query heads share four KV heads of width 64 (16 queries per KV head). Q and K receive per-head RMSNorm before full-width RoPE (base 8,000,000). The fused QKV projection splits into 64 query, four key and four value heads.RMSNormRoPE. 64 query heads share four KV heads of width 64 (16 queries per KV head). Q and K receive per-head RMSNorm before full-width RoPE (base 8,000,000). The fused QKV projection splits into 64 query, four key and four value heads.RoPERMSNorm. 64 query heads share four KV heads of width 64 (16 queries per KV head). Q and K receive per-head RMSNorm before full-width RoPE (base 8,000,000). The fused QKV projection splits into 64 query, four key and four value heads.RMSNormRoPE. 64 query heads share four KV heads of width 64 (16 queries per KV head). Q and K receive per-head RMSNorm before full-width RoPE (base 8,000,000). The fused QKV projection splits into 64 query, four key and four value heads.RoPEK cache. 64 query heads share four KV heads of width 64 (16 queries per KV head). Q and K receive per-head RMSNorm before full-width RoPE (base 8,000,000). The fused QKV projection splits into 64 query, four key and four value heads.Earlier columns are cached; outlined columns are newly computed.Cached positions from earlier decoding steps.Current token computation.K cache64CLV cache. 64 query heads share four KV heads of width 64 (16 queries per KV head). Q and K receive per-head RMSNorm before full-width RoPE (base 8,000,000). The fused QKV projection splits into 64 query, four key and four value heads.Earlier columns are cached; outlined columns are newly computed.Cached positions from earlier decoding steps.Current token computation.V cache64CLQ context. 64 query heads share four KV heads of width 64 (16 queries per KV head). Q and K receive per-head RMSNorm before full-width RoPE (base 8,000,000). The fused QKV projection splits into 64 query, four key and four value heads.Earlier context is dimmed; outlined columns are current.Current token computation.Q context64CLScaled query–key scores, masking and softmax. 64 query heads share four KV heads of width 64 (16 queries per KV head). Q and K receive per-head RMSNorm before full-width RoPE (base 8,000,000). The fused QKV projection splits into 64 query, four key and four value heads.CLCL×. 64 query heads share four KV heads of width 64 (16 queries per KV head). Q and K receive per-head RMSNorm before full-width RoPE (base 8,000,000). The fused QKV projection splits into 64 query, four key and four value heads.×Joined heads. 64 query heads share four KV heads of width 64 (16 queries per KV head). Q and K receive per-head RMSNorm before full-width RoPE (base 8,000,000). The fused QKV projection splits into 64 query, four key and four value heads.64Wo. 64 query heads share four KV heads of width 64 (16 queries per KV head). Q and K receive per-head RMSNorm before full-width RoPE (base 8,000,000). The fused QKV projection splits into 64 query, four key and four value heads.Wo4,0964,096Attention output. 64 query heads share four KV heads of width 64 (16 queries per KV head). Q and K receive per-head RMSNorm before full-width RoPE (base 8,000,000). The fused QKV projection splits into 64 query, four key and four value heads.Earlier context is dimmed; outlined columns are current.Current token computation.Attention output4,096CL
Model-specific details
Opening dense layer · 1 repetitions
Dense feed-forward intermediate width 8192.
Routed layers · 18 repetitions
128 routed SwiGLU experts of width 1024, six selected per token, plus an always-active shared SwiGLU expert of width 1024.
Attention and positions
64 query heads share four KV heads of width 64 (16 queries per KV head). Q and K receive per-head RMSNorm before full-width RoPE (base 8,000,000). The fused QKV projection splits into 64 query, four key and four value heads.
Memory
Each of 19 layers stores four 64-coordinate keys and four 64-coordinate values per token: 512 values per layer per token. Full causal history; no sliding window.

Share the keys, route the feed-forward computation

A full attention history need not store the same number of key/value heads as query heads. Sarvam 30B uses 64 queries per token but only four keys and four values, so each KV head serves 16 query heads. The reference implementation normalises each query and key before rotating its 64 coordinates. The cache stores the four key and four value heads before expanding them for attention.

The first layer has an 8,192-wide dense SwiGLU network. The remaining 18 use six selected 1,024-wide routed experts and one shared expert of the same width. The router adds correction bias only when choosing experts; the original sigmoid scores determine their normalised weights. The routed sum is scaled before the shared output is added.

At 8,192 tokens and 16-bit precision the backbone KV cache holds 152 MiB (19 × 512 × 8,192 × 2 bytes), excluding allocator overhead.

Explore the components

Sources for this map