Skip to content
nonconvexcard

Implement the cluster sizing formula

CodingBeginner⏱ 30 minAI Systemscapacity planningsizingkv cachebottleneck

Problem

Turn the sizing arithmetic into code that cannot be fudged.

  1. concurrency_ceiling(kv_bytes, per_seq_bytes, efficiency) — how many sequences fit, rounding down.
  2. compute_ceiling(machine_intensity, bytes_per_param) — the batch at which weight-bound decode reaches the machine's compute-to-bandwidth ratio.
  3. replicas_needed(lam, W, rho_target, concurrency) — rounding up.
  4. binding_constraint(memory_ceiling, compute_ceiling_value) — 'memory', 'compute' or 'balanced'.

Then run the worked example: an 80 GB device with 28 GB of weights and 6 GB of workspace, 92% allocator efficiency, 640 MB per sequence, 900 requests per second, 5 s latency, 65% target utilisation.

Implement it, then check the implementation against something you can verify independently.

Write it

Solve it here7 tests · Python runs in your browser
⌘/Ctrl + ↵ to run · limit 30s · draft saved in this browser
7 tests will run against your code. The first run downloads the Python runtime — several megabytes, once per browser.

Hints

Hints — 0 of 2 revealed

Solution

Opening this before you have a real attempt on paper is the fastest way to feel like you understand something you cannot reproduce.

Related problems

All problems
SolvedProblemFieldTypeDifficultyTime
KV cache sizing with MHA and GQALLM OpsNumericalBeginner30 min
Size a serving cluster and find the binding constraintAI SystemsNumericalIntermediate1 hour
Build a serving capacity calculator runLLM OpsCodingAdvanced3 hours