Rúben GalvãoThe Rabbit Hole

The Rabbit Hole / AI / Model architectures

Meituan · Architecture map

LongCat-Flash

A mixture of experts where some experts do nothing: easy tokens can pick an identity expert and spend less compute.

LongCat-Flash-Chat, 2025 · LongCat release timeline

Inside LongCat-Flash

Parameters
560B · ~27B active
Layers
28
Width
6,144
Mixer
Latent
Select a component to explore it.
The complete LongCat-Flash architectureInput IDs select embeddings. Each layer adds its updates along the residual stream. 64 heads; compressed KV latent of 512 with a 64-value rotary key; query rank 1536. Per-head content key 128, value 128. A 512-value KV latent plus a 64-value rotary key per token per layer. Final normalisation and output weights produce vocabulary scores and the next-token distribution.Text becomes token IDs.Text → tokens → IDstheoldrabbitsleepsEmbedding lookup131,0726,144Input token vectorsCL6,144Layers 1–28 (two attentions per lay…Layers 1–28 (two attentions per layer) · 28 repetitions28 layers · one layer shown28RMSNorm before this operation.RMSNormLatent attention: Each layer holds two latent attentions, two dense feed-forward networks (size 12288) and one expert block. The expert block reads the normalised state after the first attention, runs beside the first dense feed-forward, and its output is added at the end of the layer.Latent attentionRotate query and key position components before attention scores; values are unchanged. Each layer holds two latent attentions, two dense feed-forward networks (size 12288) and one expert block. The expert block reads the normalised state after the first attention, runs beside the first dense feed-forward, and its output is added at the end of the layer.RoPEAdd the branch output to the original stream. +RMSNorm before this operation.RMSNormDense feed-forward: Each layer holds two latent attentions, two dense feed-forward networks (size 12288) and one expert block. The expert block reads the normalised state after the first attention, runs beside the first dense feed-forward, and its output is added at the end of the layer.Densefeed-forwardAdd the branch output to the original stream. +RMSNorm before this operation.RMSNormLatent attention: Each layer holds two latent attentions, two dense feed-forward networks (size 12288) and one expert block. The expert block reads the normalised state after the first attention, runs beside the first dense feed-forward, and its output is added at the end of the layer.Latent attentionRotate query and key position components before attention scores; values are unchanged. Each layer holds two latent attentions, two dense feed-forward networks (size 12288) and one expert block. The expert block reads the normalised state after the first attention, runs beside the first dense feed-forward, and its output is added at the end of the layer.RoPEAdd the branch output to the original stream. +RMSNorm before this operation.RMSNormDense feed-forward: Each layer holds two latent attentions, two dense feed-forward networks (size 12288) and one expert block. The expert block reads the normalised state after the first attention, runs beside the first dense feed-forward, and its output is added at the end of the layer.Densefeed-forwardAdd the branch output to the original stream. +RMSNorm512 routed experts plus 256 zero-computation identity experts; 12 chosen from 768; weights scaled by 6. The result is held and added at the end of the layer.MoE12 of 768 (256identity)12 of 512 routed experts selected per token. Highlighted boxes are schematic; boxes do not correspond one-to-one to experts.Residual streamLast columnCL6,144Final RMSNormA separate learned vocabulary projection.Output weights6,144131,072Vocabulary scoresSoftmax131,072Next-token probabilities
Inside latent attention · Layers 1–28 (two attentions per layer)
64 heads · 512 cached latent values + 64 rotary values.

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

LongCat-Flash: Layers 1–28 (two attentions per layer) · latent attention64 heads; compressed KV latent of 512 with a 64-value rotary key; query rank 1536. Per-head content key 128, value 128. A 512-value KV latent plus a 64-value rotary key per token per layer.1 shared latent cache; the front face shows one representative.1 shared latent cache64 attention heads; the front face shows one representative.64 attention headsAttention input. 64 heads; compressed KV latent of 512 with a 64-value rotary key; query rank 1536. Per-head content key 128, value 128.Earlier context is dimmed; outlined columns are current.Current token computation.Attention input6,144CLWq↓. 64 heads; compressed KV latent of 512 with a 64-value rotary key; query rank 1536. Per-head content key 128, value 128.Wq↓6,1441,536RMSNorm. 64 heads; compressed KV latent of 512 with a 64-value rotary key; query rank 1536. Per-head content key 128, value 128.RMSNormWq↑. 64 heads; compressed KV latent of 512 with a 64-value rotary key; query rank 1536. Per-head content key 128, value 128.Wq↑1,536192RoPE 64. 64 heads; compressed KV latent of 512 with a 64-value rotary key; query rank 1536. Per-head content key 128, value 128.RoPE 64Wkv↓. 64 heads; compressed KV latent of 512 with a 64-value rotary key; query rank 1536. Per-head content key 128, value 128.Wkv↓6,144512RMSNorm. 64 heads; compressed KV latent of 512 with a 64-value rotary key; query rank 1536. Per-head content key 128, value 128.RMSNorm512Wkᴿ. 64 heads; compressed KV latent of 512 with a 64-value rotary key; query rank 1536. Per-head content key 128, value 128.Wkᴿ6,14464RoPE 64. 64 heads; compressed KV latent of 512 with a 64-value rotary key; query rank 1536. Per-head content key 128, value 128.RoPE 64cᴷⱽ ⊕ kᴿ. 64 heads; compressed KV latent of 512 with a 64-value rotary key; query rank 1536. Per-head content key 128, value 128.cᴷⱽ ⊕ kᴿLatent cache. 64 heads; compressed KV latent of 512 with a 64-value rotary key; query rank 1536. Per-head content key 128, value 128.Earlier columns are cached; outlined columns are newly computed.Cached positions from earlier decoding steps.Current token computation.Latent cache576CLWk↑. 64 heads; compressed KV latent of 512 with a 64-value rotary key; query rank 1536. Per-head content key 128, value 128.Wk↑512128Wv↑. 64 heads; compressed KV latent of 512 with a 64-value rotary key; query rank 1536. Per-head content key 128, value 128.Wv↑512128kᶜ ⊕ kᴿ. 64 heads; compressed KV latent of 512 with a 64-value rotary key; query rank 1536. Per-head content key 128, value 128.kᶜ ⊕ kᴿ192Q context. 64 heads; compressed KV latent of 512 with a 64-value rotary key; query rank 1536. Per-head content key 128, value 128.Earlier context is dimmed; outlined columns are current.Current token computation.Q context192CLScaled query–key scores, masking and softmax. 64 heads; compressed KV latent of 512 with a 64-value rotary key; query rank 1536. Per-head content key 128, value 128.CLCL×. 64 heads; compressed KV latent of 512 with a 64-value rotary key; query rank 1536. Per-head content key 128, value 128.×Joined heads. 64 heads; compressed KV latent of 512 with a 64-value rotary key; query rank 1536. Per-head content key 128, value 128.64Wo. 64 heads; compressed KV latent of 512 with a 64-value rotary key; query rank 1536. Per-head content key 128, value 128.Wo8,1926,144Attention output. 64 heads; compressed KV latent of 512 with a 64-value rotary key; query rank 1536. Per-head content key 128, value 128.Earlier context is dimmed; outlined columns are current.Current token computation.Attention output6,144CL
Model-specific details
Layers 1–28 (two attentions per layer) · 28 repetitions
Each layer holds two latent attentions, two dense feed-forward networks (size 12288) and one expert block. The expert block reads the normalised state after the first attention, runs beside the first dense feed-forward, and its output is added at the end of the layer.
Attention and positions
64 heads; compressed KV latent of 512 with a 64-value rotary key; query rank 1536. Per-head content key 128, value 128.
Memory
A 512-value KV latent plus a 64-value rotary key per token per layer.

A shortcut around the second half

Each of the 28 layers contains two latent-attention blocks and two dense networks. A routed expert branch bypasses the second attention/feed-forward pair.

The router makes twelve choices from 512 real experts and 256 identity experts, so active computation varies between 18.6B and 31.3B parameters, averaging about 27B. Selecting an identity expert avoids its expert computation.

Attention uses 64 heads, a 512-wide latent and 64 position coordinates. Training context reaches 131,072 tokens.

Explore the components

Sources for this map