How LLM Architecture Changes Memory and Serving Decisions
Read architecture diagrams through their serving consequences: GQA, MLA, hybrid state and MoE. Work a pinned Qwen3-Next cache example and avoid false lineage claims.
BY RUIQI ZHOU · AIINFRAINTERVIEWS EDITORIAL · UPDATED NOVEMBER 21, 2026 · 4 MIN READ
PRACTICE THIS:Read the free model introduction ·Study the Premium attention-state lesson ·Practice estimating a new model
An LLM architecture diagram is most useful when you translate each mechanism into stored bytes, computation or communication. Grouped-query attention changes how many key/value heads are retained. Latent attention changes their representation. Hybrid layers change which state grows with context. Mixture-of-experts routing changes which weights a token uses while leaving a larger storage problem to solve.
Sebastian Raschka's LLM Architecture Gallery prompted this reading guide. The examples and figures here are original; technical details below come from the linked papers and model configuration. Use our public model reference for individual checkpoints and the beginner introduction for the vocabulary.
Read the arrow before inferring ancestry
A diagram can connect two models because one adopted a published idea. That does not establish that it inherited the earlier model's weights, used its outputs for distillation, or has the same license. Each is a different claim with different evidence.
| Relationship | Evidence to inspect | What follows |
|---|---|---|
| Uses a mechanism | Paper, config and implementation | Reuse the relevant analysis after checking its assumptions. |
| Continues a checkpoint | Documented base artifact and training history | Track weight provenance and the applicable release terms. |
| Learns from outputs | Documented teacher data or distillation procedure | Evaluate the student independently; geometry can differ. |
For example, RoFormer introduced rotary position embeddings, which encode position through rotations. A later model using rotary embeddings is adopting a positional mechanism. That fact alone says nothing about its training data or checkpoint parent. In an infrastructure review, the actionable question is how positions are represented and preserved during caching, chunking and restoration.
Ask which resource each mechanism changes
The GQA paper describes grouped-query attention: several query heads share a key/value head. Counting query heads in the KV formula would therefore overestimate the payload. The paper's uptraining experiment is a particular training recipe, not permission to change a pretrained model's head count with a serving flag.
DeepSeek-V2 introduced multi-head latent attention, or MLA, using a compressed representation to reduce cached attention state. Its serving benefit depends on the backend preserving the intended representation. Expanded intermediate tensors, additional positional state and temporary buffers still need accounting.
| Feature | Resource affected | Check before sizing |
|---|---|---|
| GQA | KV payload per position | Actual KV heads, head dimensions and cache dtype |
| MLA | Cached representation | Compressed versus expanded storage; extra positional state |
| Local attention | History retained by selected layers | Window semantics and whether old storage is reclaimed |
| Recurrent layers | State per live sequence | State shapes, precision and restoration copies |
| MoE | Routed work and expert traffic | Total stored weights and per-device expert placement |
Sparse attention adds another distinction: positions selected for the current read can differ from positions that must remain available for future reads. DeepSeek-V3.2-Exp describes a sparse-attention mechanism with an indexer. A shorter selected-token list does not, by itself, establish a proportionally smaller total allocation. Attention Variants develops the separate storage formulas.
Work one configuration instead of memorizing a family tree
The pinned Qwen3-Next-80B-A3B-Instruct card describes 48 layers: twelve groups containing three Gated DeltaNet layers followed by one gated-attention layer. The matching config gives two KV heads and a head dimension of 256 for full attention.
Derive only the full-attention KV payload for one sequence at 32,768 retained positions. Assume two-byte K/V elements, no sharing between requests and storage counted across the complete model:
Full-attention layers = 48 / 4 = 12
Bytes per layer-position = 2 × 2 × 256 × 2 = 2,048
KV payload = 12 × 32,768 × 2,048 = 805,306,368 bytes
805,306,368 / 2^20 = 768 MiB
Sanity: treating all 48 layers as full attention gives 3,072 MiB.
The 768 MiB result excludes the other 36 layers' recurrent and convolution state, weights, temporary allocations and any extra restoration copies. It is a scoped subtotal. Calling it the model's total runtime memory would replace one mistake with another.
Step 1 of 3: 32,768 retained positions
- 32,768 retained positions
Twelve full-attention layers account for 768 MiB under the stated two-byte cache assumption.
- Generate 4,096 more positions
Each extra position adds 12 × 2,048 = 24,576 bytes to this subtotal.
- Reserve another 96 MiB
The full-attention subtotal reaches 864 MiB. Budget other layer state and runtime allocations separately.
Try the variation before reading on: double the cache element size while keeping the same layout. The initial subtotal becomes 1,536 MiB and the output-growth reserve becomes 192 MiB. Changing stored precision scales this term; it does not double every other allocation in the service.
Keep active weights separate from stored weights
A mixture-of-experts model sends each token through selected expert networks. Its active-parameter count helps describe work for that token. The runtime still needs a plan for the full checkpoint, including experts that other tokens may choose.
For a synthetic model with 80 billion stored parameters and a hypothetical uniform four-bit representation, the raw weight payload is 80 billion × 0.5 bytes = 40 GB. An advertised three-billion active count would give 1.5 GB if incorrectly used for the same storage calculation. Scales, higher-precision tensors and alignment can increase the real artifact size; moving experts to host memory changes placement and transfer costs rather than deleting their weights.
This is why Model Memory Footprint and the unknown-model estimation question remain useful as model families change. The latter is publicly readable and works through a per-rank fit that fails despite enough aggregate capacity.
Finish with a deployment decision
Write a short acceptance memo for the exact artifact: required task quality, prompt/output envelope, supported runtime, per-device allocation estimate and the measurement that could reject the plan. If a backend expands latent state or retains local history longer than expected, revise the estimate before buying capacity.
Then measure the complete request. A smaller cache can increase available concurrency while another bottleneck limits useful throughput. Likewise, a model supported by a desktop application may require a different artifact and execution path for the NPU; the AMD local-inference guide applies that check.
Continue with the Premium attention-state lesson for mixed windows, output-growth reservations and a runnable restoration exercise. The Premium cache-correctness project tests head mapping and cache semantics on a CPU. Together they turn an architecture chart into calculations and checks you can explain, reproduce and challenge.
Turn it into offers. Work the real questions and concepts this maps to:
FAQ
No. Reusing a mechanism such as grouped-query attention is different from continuing training from another checkpoint or distilling its outputs. Establish each relationship from the model's documented training and artifact provenance.
No. Active parameters describe part of the work performed for one token. Deployment must account for all stored weights, their placement or offload policy, request state and runtime allocations.
No. Selecting fewer historical positions to read does not itself prove that all other positions can be discarded. Inspect the retention semantics, indexer state and the deployed cache implementation.
A uniform KV formula covers only the layers that match its assumptions. Sum full-attention state, local windows and recurrent or convolution state separately, then include runtime overhead and placement before estimating concurrency.
Discussion (4)
A small active-parameter count still leaves an expert-placement problem. At low concurrency the transfer path can decide the result before the advertised arithmetic throughput becomes relevant.
Prefix reuse is a useful follow-up to any bounded-state claim.
Yes. Bounded recurrent state describes the current sequence state. Keeping multiple earlier restoration points creates additional allocations, and every restored component must refer to the same accepted prefix.
Architectural similarity is a useful hypothesis for choosing tests. It is weak evidence for predicting task quality. Preserve a held-out task set when comparing checkpoints instead of changing the rubric to match each model's strengths.
