|
| 1 | +# Disaggregation Calculator — agg vs. disagg decision tool for LLM serving |
| 2 | + |
| 3 | +Author: Anton Alexander |
| 4 | + |
| 5 | +> **Disclaimer.** This calculator is provided **free of charge, as a utility** to help quickly |
| 6 | +> **estimate** and plan model-serving topologies. It produces **first-order estimates and guidance only**. |
| 7 | +> AWS and the authors make **no representation, warranty, or guarantee** — express or implied — about model |
| 8 | +> performance, throughput, latency, cost, or fitness for any purpose, and **accept no liability** for any |
| 9 | +> outcome arising from its use. Actual measured results will differ from the calculated numbers. Always |
| 10 | +> validate on your own hardware with your own workload before making deployment or purchasing decisions. |
| 11 | +> The calculator is provided **"AS IS"** without support obligation. |
| 12 | +
|
| 13 | +An architecture-first calculator that answers a single question for any model on any GPU: |
| 14 | +**should I serve it aggregated (prefill + decode on one worker) or disaggregated (prefill and decode |
| 15 | +split across workers, KV cache moved over the network)?** It derives the answer from the model's real |
| 16 | +architecture (`config.json`), the GPU's HBM and bandwidth, and your workload (input/output token lengths, |
| 17 | +SLO), then reports the memory fit, the predicted TTFT/ITL/throughput, the $/Mtok, and the verdict. |
| 18 | + |
| 19 | +It is the planning companion to the [NVIDIA Nemotron 3 Ultra 550B](../nemotron/ultra) deployment in this |
| 20 | +project: use the calculator to pick a topology, then deploy it with the `agg` / `disagg` manifests there. |
| 21 | + |
| 22 | +To stay aligned with the principles of the [do-framework](https://bit.ly/do-framework), this tool is pure |
| 23 | +Python standard library (no install) plus two static HTML pages (no server) — clone and run. |
| 24 | + |
| 25 | +## What's here |
| 26 | + |
| 27 | +``` |
| 28 | +disagg-calculator/ |
| 29 | + analyze/ |
| 30 | + calc.py # the engine — architecture-aware agg/disagg math + verdict (CLI + importable) |
| 31 | + calibration.py # PREDICT → MEASURE → DELTA loop; corrects the math toward live-measured numbers |
| 32 | + results/ |
| 33 | + calibration/ |
| 34 | + ledger.jsonl # append-only measured datapoints the calculator calibrates against (seeded on p5en) |
| 35 | + web/ |
| 36 | + index.html # interactive calculator (pick a model + GPU + workload → verdict), runs in-browser |
| 37 | + calculator.html # the same engine as a single-purpose page (shareable link) |
| 38 | + docs/ |
| 39 | + DEPLOYMENT-GUIDE.md # when to disaggregate vs. scale aggregated replicas — rules of thumb + worked cases |
| 40 | + METHODOLOGY.md # the math, the physics assumptions, and how the calibration loop refines them |
| 41 | +``` |
| 42 | + |
| 43 | +> **Engine = two files.** `calc.py` lazily imports `calibration.py`; without it the calculator silently |
| 44 | +> falls back to the uncalibrated HBM-roofline numbers (e.g. decode ITL ~4 ms instead of the live-measured |
| 45 | +> ~80 ms). Always ship/run them together. `ledger.jsonl` is the measured data they calibrate against. |
| 46 | +
|
| 47 | +## Prerequisites |
| 48 | + |
| 49 | +- Python 3.9+ (standard library only — nothing to `pip install`). |
| 50 | +- For the web pages: any modern browser. No server, no build step. |
| 51 | + |
| 52 | +## Run (CLI) |
| 53 | + |
| 54 | +From the `aws-do-eks` shell (or any shell with Python 3): |
| 55 | + |
| 56 | +```bash |
| 57 | +cd /eks/deployment/inference/agentic-ai/disagg-calculator/analyze |
| 58 | + |
| 59 | +# Self-test (proves the engine + calibration are wired correctly): |
| 60 | +python3 calc.py --selftest |
| 61 | + |
| 62 | +# Score a model from its HuggingFace config.json on a given GPU + workload: |
| 63 | +python3 calc.py --config /path/to/config.json --gpu p5en --isl 8192 --osl 1024 --tp 8 --pp 1 |
| 64 | +``` |
| 65 | + |
| 66 | +The output JSON includes the memory fit (weights + KV vs. HBM), the predicted timings |
| 67 | +(`prefill_compute`, `kv_transfer`, `decode_step_ITL`), the $/Mtok for agg vs. disagg, and the verdict |
| 68 | +(`aggregate` / `disaggregate` / `no-op`) with the reasoning. |
| 69 | + |
| 70 | +## Run (web) |
| 71 | + |
| 72 | +Open `web/index.html` in a browser (or serve the `web/` folder statically). Pick a model preset (or paste a |
| 73 | +`config.json`), choose the GPU and workload, and read the verdict. `web/calculator.html` is the same engine |
| 74 | +as a single shareable page. The browser pages mirror `analyze/calc.py` exactly — a parity harness in the |
| 75 | +source project asserts they agree on a model × workload grid, so the link you share computes what the CLI does. |
| 76 | + |
| 77 | +## How it stays honest (calibration) |
| 78 | + |
| 79 | +First-order math over-predicts throughput and under-predicts latency for hybrid (Mamba + attention) models — |
| 80 | +a naive HBM roofline says "fast" while the live system is decode-latency-bound. `calibration.py` records what |
| 81 | +we **predicted**, ingests what we **measured** on real GPUs (the seed datapoint is Nemotron-3 Ultra 550B on |
| 82 | +p5en/H200), computes the **delta**, and derives a per-(family, metric) **correction factor**. As more live |
| 83 | +runs land in `results/calibration/ledger.jsonl`, the corrections converge and the calculator gets more |
| 84 | +accurate **without changing the physics**. See [docs/METHODOLOGY.md](docs/METHODOLOGY.md). |
| 85 | + |
| 86 | +## When to use which verdict |
| 87 | + |
| 88 | +See [docs/DEPLOYMENT-GUIDE.md](docs/DEPLOYMENT-GUIDE.md) for the rules of thumb. In short: |
| 89 | + |
| 90 | +- **Aggregated replicas** when: short-context chat, prefill cheap relative to decode, cost/throughput-bound, |
| 91 | + loose-to-moderate ITL SLO. At the 1P:1D floor, disaggregation buys little but costs ≥2× the GPUs. |
| 92 | +- **Disaggregate** when: long input contexts (RAG / agents / code), prefill-heavy, tight TPOT/ITL SLO, and you |
| 93 | + can right-size the prefill : decode pool ratio (asymmetric scaling via independent replica counts). |
| 94 | + |
| 95 | +## References |
| 96 | + |
| 97 | +- [do-framework](https://bit.ly/do-framework) · [aws-do-eks](https://bit.ly/do-eks) |
| 98 | +- Companion deployment: [Nemotron 3 Ultra 550B](../nemotron/ultra) (agg + disagg manifests) |
| 99 | +- [NVIDIA Dynamo](https://github.com/ai-dynamo/dynamo) · [NIXL](https://github.com/ai-dynamo/nixl) |
0 commit comments