productinterview.tools
MenuClose

Back-of-Envelope Method for AI Numbers

On this page
  1. When to use it
  2. The framework
  3. Worked example
  4. Where people go wrong
  5. Patterns to plug in
  6. Questions to practise with it

When to use it

GPUGraphics processing unit. The chips most AI models are trained and served on. Read the full explanation counts, memory, training compute, serving cost, cost per token, time to generate data.

The framework

Step Ask yourself What good sounds like
Restate What unit is the answer in? GPUs, at peak.
Formula Write it before numbers GPUs = peak tokens/s ÷ tokens/s per GPU.
Assume Round numbers, said out loud ~2,400 tokens/s per 8-GPU server.
Compute Powers of ten 150k ÷ 2.4k ≈ 63 servers.
Adjust Headroom, utilisation, filtering +25% headroom → ~80 servers.
Sanity-check Does it match anything known? Cross-check with KV cacheKey-value cache. Stored attention keys and values that let a model generate each new token without recomputing the whole context. Read the full explanation memory.

Worked example

Where people go wrong

  • Silent arithmetic
  • Sizing for average instead of peak
  • False precision
  • Forgetting the KV cache or utilisation

Patterns to plug in

  • Weights = params × bytes
  • Inference ≈ 2N FLOPsFloating-point operation. One arithmetic operation on decimal numbers; FLOPs measure how much compute training or inference takes. Read the full explanation per token; training ≈ 6ND
  • KV cache ≈ 2 × layers × KV heads × head size × bytes per token
  • Cost per million tokens = $/hour ÷ tokens per hour × 10⁶

Questions to practise with it