Compression and sparsity are different
CSA stores one entry per four tokens, then chooses only a subset to read. All compressed entries remain in the cache, even those not selected by this query.
A trillion-class expert bank behind a much narrower active path. Long-context attention compresses what it stores, mHC mixes four residual streams, and Muon updates whole matrices across distributed shards.
Based on the official V4 model card, technical report, and released configuration and inference code. Shapes are logical, before parallelism. Layers are numbered from 1 here; code indices start at 0. This is V4, not the later V4.1 architecture.
Every decoder block has an MoE feed-forward network. The first three blocks use token-ID-based hash routing, not dense FFNs. Attention alternates between a lightly compressed sparse view and a heavily compressed global view, always retaining a local 128-token window.
Click a layer to update the computation diagram. The release config has one extra compression-ratio entry of 0 for the MTP block; it is not an extra decoder layer.
CSA stores one entry per four tokens, then chooses only a subset to read. All compressed entries remain in the cache, even those not selected by this query.
Its memory still grows with context, at one entry per 128 tokens. It reads all causally available compressed entries instead of running an indexer.
mHC contracts the residual state to one D-wide input before each attention or MoE call, then broadcasts the result back with learned mixing.
One token touches six routed experts and one shared expert per layer. It does not execute all 384 expert networks in Pro.
Choose a layer and click an operation to inspect its weight shape, logical output, and backward dependencies. Heavy borders mark matrix multiplies and attention; dashed borders mark distributed expert movement.
T denotes packed tokens in a logical invocation. R = 6T is the number of routed token-expert assignments across the expert group, not the workload on every GPU. The diagram assumes one continuous sequence only when showing compressed-entry counts; real packed sequences require independent causal boundaries.
Both paths use shared-key-value multi-query attention: one 512-dimensional memory vector serves as both K and V for all query heads. The last 64 dimensions carry RoPE; attention output receives inverse RoPE before the grouped projection.
Two KV projections and two gate projections create previous/current candidates. A per-channel softmax pools eight candidates from two adjacent four-token groups into one compressed entry. Groups overlap, so the storage reduction is 4:1, not 8:1.
A separate lightning indexer reuses the low-rank query latent, makes 64 query heads of dimension 128, and scores causally available compressed index keys. Top-K selects positions for the main attention.
Report §2.3.1. The indexer still examines the compressed candidate pool; top-K bounds the expensive main attention, not every operation in the system.
One KV projection and one gate projection pool each non-overlapping group of 128 tokens into one entry. No lightning indexer is needed: each query reads every completed, causally available compressed block.
The longer pooling interval makes its global memory much smaller. The tradeoff is coarser historical detail; CSA supplies a finer-grained view in the alternating layers.
Report §2.3.2. The global path is dense over compressed entries, not dense over the original million-token sequence.
| Configuration | Pro | Flash |
|---|---|---|
| Decoder layers / hidden width | 61 / 7,168 | 43 / 4,096 |
| CSA / HCA / SWA-only layers | 30 / 31 / 0 | 21 / 20 / 2 |
| Query heads / head dimension | 128 / 512 | 64 / 512 |
| Query latent rank | 1,536 | 1,024 |
| Output groups / rank per group | 16 / 1,024 | 8 / 1,024 |
| Routed experts / active / shared | 384 / 6 / 1 | 256 / 6 / 1 |
| Expert intermediate width | 3,072 | 2,048 |
| CSA top-K | 1,024 | 512 |
The residual state is T × 4 × D. Before each sublayer, a normalized flattened 4D vector produces 24 mixing values: 4 input coefficients, 4 output coefficients, and a 4 × 4 residual matrix.
Sigmoid bounds A and 2 × sigmoid bounds C. Twenty Sinkhorn iterations make B approximately doubly stochastic: positive entries, with each row and column summing to one. The ideal constrained residual mapping is non-expansive and remains stable under composition.
The expensive sublayer F still receives T × D. The four-way expansion affects residual storage and the small mixing operation, not the attention and expert input widths.
Report §2.2. This is standard V4 mHC, not V4.1 Single-Pass mHC.
Every block owns a bank of fine-grained routed experts and one always-active shared expert. Scores use sqrt(softplus), with a balancing bias affecting selection but not the gathered expert weights.
The first three layers select experts using a token-ID hash table; later layers use score-based top-6 selection. Both execute real MoE networks. The reference clips SwiGLU activations to limit outliers.
A packed input of T tokens generates 6T routed assignments. Expert parallelism redistributes those assignments to expert owners, combines their weighted outputs, and adds the shared expert result.
This ledger reconstructs logical trainable parameter elements from the released dimensions and inference modules. It counts all routed experts, not just the six used by a token. Quantization changes their stored bytes, not their logical parameter count.
| Component | Logical formula | Parameters | Share |
|---|
D = hidden width; F = expert intermediate width; L = decoder layers; E = routed experts; H/K = query heads/head dimension; q = query rank; G/r = output groups/rank; V = vocabulary. Biases, RMSNorm weights and attention sinks are included. Frozen token-ID lookup tables, quantization scales and storage padding are excluded. MTP shares the embedding and vocabulary head and is listed separately, avoiding double-counting. Headline 1.6T/284B and 49B/13B are the publisher's reported figures, not exact outputs of this calculator.
Only completed blocks occupy compressed history. CSA keeps N/4 main entries and N/4 index entries per layer; HCA keeps N/128 main entries. The local ring buffer saturates at 128 entries per layer.
Mixed payload = 448 FP8 + 64 BF16 main dimensions (576 bytes), and 128 FP4 index dimensions (64 bytes). One main entry serves as both K and V, shared across all query heads.
Bars share the GQA8 baseline scale: the same number of layers, separate K and V, eight KV heads, head dimension 128, BF16. Estimates are unsharded decoder cache payload only; exclude MTP, quantization scales, page tables, unfinished compressor state, workspaces, and allocator overhead. The public Python reference uses BF16 buffers while simulating quantization, so these mixed-format payload numbers are not its measured GPU allocations.
Report §2.3.4 reports roughly 2% of this GQA8 baseline at 1M context. Separately, the model card reports Pro's single-token inference FLOPs and KV cache at 27% and 10% of DeepSeek-V3.2; that is a different baseline, not a prediction from this calculator.
The V4 report explicitly uses hybrid Newton–Schulz orthogonalization inside every Muon update: eight iterations of the fast quintic, followed by two of a convergent polynomial. This is V4's published choice, not a universal Muon default.
A singular value s follows p(s) = as + bs3 + cs5. The fast polynomial expands small values quickly but does not fix s = 1. The final polynomial has p(1) = 1 and p′(1) = 0.
Report §2.4, Hybrid Newton-Schulz Iterations. The schedule repeats inside each optimizer update; it is not a schedule over training steps.
Illustration in JavaScript scalar arithmetic, not a BF16 matrix-kernel simulation or a training-loss comparison. Very small singular values may not reach 1 in ten iterations.
The report's system combines expert dispatch with a hybrid ZeRO strategy for Muon. Dense matrices are assigned to bounded-size groups; MoE matrices are split by expert identity so that each expert can be orthogonalized independently.
Knapsack-style assignment balances dense matrix sizes. Experts are assigned independently, with data-parallel owners redundant only where the report's hybrid ZeRO policy calls for it.
The report merges consecutive same-shaped matrices into batched Newton–Schulz computations. This improves utilization without making those matrices a single larger orthogonalization problem.
MoE gradients are stochastically rounded to BF16 for communication. The report uses all-to-all exchange and a local FP32 sum to avoid low-precision collective accumulation errors.
Tensor-level checkpointing, fused MoE kernels, and recomputed mHC intermediates reduce saved activation memory. The diagram's checkpoint option illustrates dependencies, not a measured peak-memory budget.
Report §3.4: efficient Muon, mHC, long-context communication, and extended automatic differentiation.
The formulas are educational reconstructions, not measured throughput, training convergence, or memory requirements for a specific deployment. Parallelism, padding, quantization metadata, fusion and checkpoint policies change physical ownership and allocations.