Skip to the page

Cost, speed and serving · senior

Self-hosting, GPU memory and quantisation

Self-hosting an open-weights model gives control and steady cost at high load, but you own GPUs and operations. Weights and the KV cache decide what fits on a GPU, and quantisation trades some quality for memory.

The notes

What you must know

  • Decide hosted or self-hosted from the real rule (data must not leave the account, stay in India, or not be stored), task difficulty, volume, latency, team skills and budget. Hosted options in Indian regions may meet the rule; check the contract.
  • Self-hosting gives control of data, version and fine-tunes, and has no provider rate limits. You own GPUs, scaling, patches, monitoring and evals.
  • A serving engine such as vLLM gives continuous batching and a paged KV cache with little waste. It also offers prefix caching and quantisation support.
  • Weights memory is parameters times bytes per parameter. An 8-billion-parameter model at 2 bytes needs about 16 GB.
  • KV cache per token is 2 (keys and values) times layers times KV heads times head dimension times bytes. It is shared by all running requests, so long contexts and many requests use it fast.
  • When KV blocks run out, requests wait or are preempted and latency jumps. Fixes: lower the maximum model length and number of sequences, use a quantised KV cache or weights, and use prefix caching.
  • Quantisation stores numbers in fewer bits: 8-bit halves weight memory and 4-bit quarters it. This frees memory for the KV cache and often speeds decoding.
  • Cost of quantisation: accuracy loss, usually small at 8-bit and more visible at 4-bit, especially for maths, code, long reasoning and less-represented languages. Evaluate on your own tasks, including Indian languages.

The red pen

Common traps: mistake → fix

  • Mistake: Self-hosting is always cheaper

    Fix: only at steady high volume, after counting GPUs and people.

  • Mistake: If the weights fit, the model fits

    Fix: the KV cache needs memory too.

  • Mistake: 4-bit has no quality cost

    Fix: measure it on your tasks.

Easy to hard

Questions interviewers ask, easy to hard

  1. Self-host or hosted API for a bank with data residency rules?
  2. What is quantisation?
  3. Estimate memory for an 8B model on a 24 GB GPU.
  4. Why does latency jump under load on a GPU server?

Explain it out loud

Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.

Practise by voice

Your first interview is free

Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.

Start your free interview