learningto/pass

Quantization & the Startup Stack

AdvancedConcepts

The second serving job is not the fleet; it is the one card, when the budget is what a startup can put on the balance sheet instead of a Vercel bill. Open weights changed the question: the model can be downloaded, and the job becomes making it fit and making it fast on hardware a 24 GB card describes. Three compression decisions run in a fixed order. Weight precision comes first: a model of P parameters takes 2 x P bytes at bf16, 1 x P at INT8, and 0.5 x P at 4-bit, and because decode is bandwidth bound - the card re-reads every weight byte for each token - cutting the bytes in half doubles tokens/sec per stream exactly. An 8B brain goes from 16 GB to 4 GB, and a card re-reading 4 GB through a 1008 GB/s bus decodes 252 tokens a second per stream. KV precision comes second and is the cheaper knob: the per-seat rent of 128 KB a token at bf16 for an 8B-class model collapses quarter-price at 4-bit, which is what llama.cpp KV quantization and vLLM FP8 KV do, while costing about a quality point. Model size, the third knob, is the expensive one - but distillation is how startups move it: train a smaller student on the outputs of a bigger teacher and keep most of the quality at a fraction of the arithmetic. The follow-up interviewers run at startups is the trap answer: quantization is never one decision. Weights, KV, and context length are three separate dial groups, and the 4-bit-weights-on-4-bit-KV stack is the combination that lives just under the quality floor, which is why the quality regression has to be measured, not assumed - bad quantization scales have produced long-context regressions that dropped retrieval recall from 91 to 13 percent before a recalibration put it back. The three challenges below work the stack: the bytes of weights a precision choice buys, the seats a card grants after the per-seat KV rent, and the tokens/sec the memory bus lets through.

Key Concepts

  • 1Decode is bandwidth bound at batch 1: tokens/sec per stream is card bandwidth divided by weight bytes, so precision is speed. Halving the bytes per parameter doubles the decode rate - 70B at bf16 reads 140 GB and streams 7.2 tokens/s on a 4090, at INT8 14.4, at 4-bit 28.8
  • 2Weight precision buys everything else: 4-bit quantization (GPTQ/AWQ style) quarters the weights, which is what lets a 70B-class model sit at all - 35 GB fits a Mac Studio or a 48 GB card where bf16 (140 GB) fits nothing on the menu
  • 3KV precision is the cheap knob: it quarters the per-seat rent at 4-bit while costing around a quality point, and it is the dial that saves long-context pods, because per-seat rent is context tokens times KV bytes, and context is what renters promise
  • 4Compression decisions are separate and stack: weights, KV, and context length are three dials, and the quality regression has to be measured per stack - bad quantization scales have caused long-context recall collapses from 91 to 13 percent, while a good recalibration restored it to 89, so "4-bit barely changes quality" is the trap answer
  • 5Distillation moves the model-size knob: a smaller student trained on a bigger teacher's outputs keeps most of the domain quality at a fraction of the arithmetic, and it is why startups ship a 14B instead of licensing a 70B - the student decodes 5x faster on the same card
  • 6VRAM buys seats, bandwidth buys tokens: a Mac Studio holds 43 seats of a quantized 70B and streams 11 tokens/sec per seat, while a 4090 holds none and would stream 28.8 per stream if it fit. The card choice is two separate checks, and interviewers score answers that name both

The trade-offs to name out loud

Precision vs quality

4-bit weights cut the memory bill 4x and double-pair decode speed, but the quality bill is real and stack-specific: INT8 costs about a point, 4-bit about three, and stacking 4-bit KV on 4-bit weights is the combination that crosses the floor. The professional answer is to pick a target metric, measure the stack against it, and keep a fallback config on disk - not to assume "quantized models are fine now".

VRAM vs bandwidth in card choice

A 96 GB unified-memory machine and a 24 GB consumer card both hold seats, but they decode differently: the unified-memory machine trades bandwidth (400 GB/s) for room, the consumer card trades room for bandwidth (1008 GB/s). Long-context pods need the VRAM, interactive pods need the bus, and a fleet plan that mixes both cards by workload is stronger than a fleet plan that buys one size.

Distill down vs serve up

Serving the 70B keeps full quality and pays in cards, concurrency, and speed; distilling to a 14B pays a one-time training bill and rents that back every request as faster decode and more seats. The breakeven is usage-weighted, and startups that measure it choose the student; the interview answer names the student's real failure mode - quality on inputs the teacher never generated.

Buy the card, compress the stack

The quant-stack walkthrough

The tier walkthrough beside this one decides who is allowed to enter; the router decides which door they use; this one decides whether you own the building. You are serving one open-weights model on one card you bought with money, not with a cloud contract, and every decision is a compression decision taken in the same order: how many brains in the box (model size), how finely you cut the brain (weight precision), how finely you cut the notepads (KV precision), how long each notepad must be (context), and which card sits under all of it. Watch three numbers instead of one: the concurrent seats the card can hold, the tokens per second a stream decodes, and the quality the stack has left.

The knobs

The model

Model size: 8B

Open weights means you choose the brain: a smaller brain leaves seats and speed behind, and distillation is how startups shrink one without losing the domain.

Weight precision: FP8 / INT8

The first knob every startup turns: 4-bit halves the model again and doubles decode, and its quality bill is small when the quant was calibrated.

The cache

KV-cache precision: 8-bit

The cheap knob: halving KV precision is nearly free quality-wise and doubles the seats that hold long contexts.

Context per seat (tokens): 8192

Every seat buys its own KV at full context length; the per-seat rent is the context length times the KV bytes per token.

The hardware

The card: RTX 4090, 24 GB

VRAM buys seats, but memory bandwidth buys tokens per second. Consumer cards beat big-VRAM cards on decode exactly when the model is small enough to fit.

of weights the brain takes at this precision

8 GB

KV rent each seat pays at 8192 tokens per seat

0.54 GB

concurrent seats on the card, floor 4

26

tokens/sec per stream through the card memory bus, floor 20

126.0

representative quality score out of 100, floor 96

98.5

the capital bill for the card, paid once

$1,600

The card at this stack

Weights held resident (the brain, read every token)8.0 GB of weights, 126.0 tokens/sec per stream
KV rent paid by live seats (the notepads)26 seats x 0.54 GB per seat
weights 8 GB of the 24 GB the card carries seat KV 13.96 GB vacant headroom 0.2% could grow one more seat or a longer context
the card holds the stackpass8 GB of weights leave room for 26 concurrent seats at 8192 tokens inside the 22 GB the card frees up
quality survives the compressionpassrepresentative score 98.5 against the 96 floor: INT8 weights cost about 1 point, 4-bit about 3, 8-bit KV half a point, 4-bit KV about 1.5
decode beats interactive pacepass126.0 tokens/sec per stream: a 8B-class read (8 GB) through the card's memory bus each token, floor 20/s

The quant ledger

The stack holds: 26 concurrent seats fit and every stream decodes at 126.0 tokens/sec with a representative quality score of 98.5. The three compression decisions stack - each one was paid by a different part of the plan, memory by precision, speed by brain size, nothing by quality beyond the points already spent.

Model size

A 8B brain carries 128 KB of KV per token at BF16 (8 kv heads, 32 layers). Every GB you remove from it buys seats on the card and tokens per second on the bus.

Weight precision

FP8 / INT8 puts 8 GB of weights on the card and asks the bus for 8 GB per token: 126.0 tokens/sec per stream. The precision step is why decode jumps in exact doublings.

KV-cache precision

8-bit KV makes each seat rent 0.54 GB: the cache bill is nearly invisible next to the weights, and cutting it is the cheapest quality-point on the card.

Context per seat (tokens)

8192 tokens per seat is the pod's lease term: shorter seats hold more tenants, and the per-seat rent of 0.54 GB is what the seat floor of 4 streams is measured against.

The card

The RTX 4090, 24 GB card frees 22 GB and moves 1008 GB/s: VRAM sets how many tenants fit, bandwidth sets how fast each one decodes. It costs $1,600 once, not per hour.

Mattered vs noise (which knobs actually moved the stack)

Model size: matteredWeight precision: matteredKV-cache precision: matteredContext per seat (tokens): matteredThe card: mattered

Load a famous startup bill, then fix the stack yourself

KV bytes per token at BF16 (Llama 3 / Qwen GQA geometry)

3B, 28 layers, 112 KB/token8B, 32 layers, 128 KB/token14B, 48 layers, 192 KB/token32B, 64 layers, 256 KB/token70B, 80 layers, 320 KB/token

Python Implementation

example.py
Loading...
Now try it yourself
3 challenges with test cases and AI feedback
Practice Now

Complexity Analysis

1481216n²nlog n1n (input size)
COMMON OPERATIONS
Array
Access:O(1)
Search:O(n)
Insert end:O(1)*
Insert mid:O(n)
Hash Map
Get/Set:O(1)*
Delete:O(1)*
Search value:O(n)
Iterate:O(n)
Linked List
Access:O(n)
Search:O(n)
Insert head:O(1)
Delete known:O(1)
Binary Search
Search:O(log n)
Insert:O(log n)
Balanced BST
Search:O(log n)
Insert:O(log n)
Delete:O(log n)
Heap
Peek min/max:O(1)
Push:O(log n)
Pop:O(log n)
Heapify:O(n)
Graph (BFS/DFS)
Traversal:O(V+E)
Dijkstra (heap):O((V+E) log V)
Merge / Quick Sort
Sort:O(n log n)
Space (merge):O(n)
Space (quick):O(log n)

* amortized average case

READY TO TEST YOURSELF?

Put Quantization & the Startup Stack into practice

The best way to lock in what you've learned is to write code. Solve real interview-style problems right now.

Next: Buying the Fleet

Lock in $4.99/mo forever

Joining the founding waitlist locks the $4.99/mo founding price for you, at the lowest price we will ever run. First 100 members. No payment now.

One email about the founding offer and the launch. No spam, unsubscribe anytime.
Quantization & the Startup Stack
Next: Buying the Fleet