Skip to content
Inference Academy

Case study: serving a trillion-parameter hybrid MoE (Kimi K3)

A worked serving plan for a 2.8T-parameter open model with 896 experts, hybrid KDA and MLA attention and a 1M-token context: does it fit, which parallelism, how to split the cache between per-token entries and recurrent states, prefix caching with snapshots, expert load balancing, disaggregation and speculation. Every number comes from a calculator you can run.

By

20 min · verified 2026-115 animated diagramsPro
Share

Kimi K3, released by Moonshot AI in July 2026, is the largest open-weight model so far: 2.8 trillion parameters, 896 experts and a one-million-token context. Getting it to run is a project. Getting it to run well uses almost every idea in this course at once. This lesson walks through a serving plan step by step, with a calculator you can rerun for the next large model.

The architecture numbers below come from the model card. Where the card is silent (cache layouts, state sizes), the lesson states its assumption; read the model's config.json and your engine's startup log to replace them with real values.

#What makes this model hard

Dimension What K3 does Serving consequence
Width 896 routed experts per MoE layer, 16 chosen per token, plus 2 shared experts Huge total memory; load balance across GPUs matters
Attention 93 layers: 69 Kimi Delta Attention (KDA) layers and 24 gated MLA layers Two kinds of cache to manage (linear attention and hybrids)
Length 1,048,576-token context A few long requests can fill a node's cache
Precision MXFP4 weights and MXFP8 activations, trained with quantisation-aware training Serve as shipped: no extra quantisation step (FP8 and FP4)

Moonshot also changed how layers connect: Attention Residuals replace the fixed residual sum with a learned attention over earlier layers' outputs, so each layer can weight earlier representations instead of receiving them all added together. This matters for training quality; for serving it is just part of the forward pass the engine must implement.

#Step 1: does it fit?

An MoE's compute follows its active parameters, but its memory follows its total parameters (mixture of experts). With hundreds of requests in a batch, every expert gets used in every step, and swapping experts in and out from host memory would destroy latency. So plan for all 2.8T.

python
GB, GiB, KiB, MiB = 1e9, 2**30, 2**10, 2**20
# From the model card: 92 MoE layers, 896 routed + 2 shared experts,
# latent MoE dim 3584, expert hidden dim 3072, MXFP4 weights.
expert = 3 * 3584 * 3072                       # gate, up and down matrices of one expert
expert_params = expert * (896 + 2) * 92
mxfp4 = 4.25 / 8                               # 4-bit values plus one 8-bit scale per 32 values
expert_bytes = expert_params * mxfp4
other_bytes = 72 * GB                          # attention, embeddings, projections: about 71B parameters
weights = expert_bytes + other_bytes
print(f"experts {expert_params/1e12:.2f}T params = {expert_bytes/GB:.0f} GB; total {weights/1e12:.2f} TB")
for name, hbm, n in [("8x B200", 180, 8), ("8x B300", 288, 8), ("16x B200", 180, 16)]:
    per = weights / n / GB
    print(f"{name:9s} {per:4.0f} GB of weights per GPU -> " + (f"{hbm - per:.0f} GB left" if per < hbm else "does not fit"))
text
experts 2.73T params = 1450 GB; total 1.52 TB
8x B200    190 GB of weights per GPU -> does not fit
8x B300    190 GB of weights per GPU -> 98 GB left
16x B200    95 GB of weights per GPU -> 85 GB left
Fit Kimi K3 on a node: one GPU's memory
Interactive

Hardware

Attention layout

Experts 181
Cache 78

288 GB HBM

Weights per GPU

190 GB

Cache per GPU

78 GB

Tokens the node holds

5.6M

Fits, with room for about 5.6M tokens of MLA cache across the node (about 5 million-token requests).

Weights from the case study: experts about 1,450 GB, attention and other weights about 72 GB. MLA cache 13.5 KiB per token. Under tensor parallelism (TP) every GPU holds the same tokens; under data-parallel attention (DP) each GPU holds different requests but a full copy of the attention weights.

Two things stand out. First, experts are 95% of the weights. The attention layers that get most of the architectural attention are about 72 GB. Second, one B300 node fits, one B200 node does not. Two B200 nodes work, but then every step crosses the link between nodes, which is several times slower than NVLink inside a node (GPU generations). That narrows your parallelism choices, so a single B300 node (or a rack-scale NVLink system) is the simplest home for this model.

#Step 2: choose the parallel layout

Inside one 8-GPU node there are three common layouts (model parallelism):

Layout Attention weights Expert weights Strength Cost
TP8 for everything Every layer split 8 ways Every expert split 8 ways Simplest; good single-user latency Most collective communication per layer; MLA cache replicated on all 8 GPUs
TP8 attention + EP8 experts Split 8 ways 112 whole experts per GPU Experts run as whole matrices; fewer collectives in MoE layers Two all-to-alls per MoE layer; load imbalance
DP8 attention + EP8 experts Full copy on every GPU (72 GB each) 112 whole experts per GPU Each GPU keeps the cache only for its own requests 63 GB more weights per GPU

The weight memory is the same in the first two layouts; they only divide it differently. The third trades weight memory for cache memory, and whether that trade pays depends on the numbers in step 4.

For a large batch at high throughput, attention data parallelism with expert parallelism is the usual choice at scale. For the lowest latency at a small batch, plain tensor parallelism is often fastest. Measure both with your traffic.

#Step 3: the per-GPU memory budget

For the TP8 layout on B300:

  1. 1
    288 GB HBM per B300
  2. 2
    Expert weights1450 / 8 ≈ 181 GB
  3. 3
    Attention and other weights72 / 8 = 9 GB
  4. 4
    Reserveactivations, CUDA graphs, communication buffers: set by the engine
  5. 5
    Cache poolwhat remains: MLA entries and KDA states

Of the roughly 98 GB left after weights, the engine reserves some for activations at the largest batch, CUDA graphs and communication buffers. Engines set the rest with a memory utilisation setting and print the resulting cache size at startup. Read that line rather than guessing.

Pro content

Keep reading with Inference Academy Pro

Unlock the rest of this lesson, including 4 animated diagrams, plus every advanced lesson, hands-on lab, the larger playground models and completion certificates.

Still to come in this lesson

  1. Step 4: one cache, two kinds of state
  2. Step 5: prefix caching with snapshots
  3. Step 6: keep the experts balanced
  4. Step 7: make it fast
  5. A checklist for the next giant model
  6. What you can now do
  7. Common mistakes
  8. Exercise
  9. Going deeper

You will be able to answer

  • Why do you plan GPU memory for Kimi K3 by its 2.8T total parameters rather than its 104B active parameters?
  • The weights are about 1.52 TB in MXFP4. Which single 8-GPU node can hold them?
  • Under tensor parallelism, why is the MLA cache replicated on every GPU while the KDA states are split?
  • Why can't a hybrid model reuse a cached prefix at any token boundary?
  • In the lesson's simulation with 128 GPUs, what did replicating the 32 hottest experts do?

Articles that build on this lesson

Preparing for an interview?