Sixth phase of Arc 5. Squeezing every drop from the GPU.

Phase 43 deployed vLLM. This phase makes it faster + cheaper. Quantization, distillation, speculative decoding, batch tuning: the techniques that let you serve 2-5× more traffic on the same hardware. By phase end basecamp serves quantized + speculatively-decoded models with measured quality + throughput improvements.

These optimizations aren’t optional at scale. They’re the difference between serving 100 RPS and 500 RPS on the same GPU. Frontier AI labs (Anthropic, OpenAI, and others) all apply them aggressively. The patterns survive specific implementations.


Prerequisites


Why this phase exists

LLM serving is GPU-bound. Every percent of GPU utilization is real money. Optimization techniques compound: quantization gives 2× → batch-size tuning gives 1.3× → speculative decoding gives 1.5× → total 4× from the same hardware. Senior ML platform engineers know these techniques and when each fits.


The pattern-first frame

Same eight steps.


1. PROBLEM

You have an LLM serving at some throughput. You want more throughput, lower latency, or both, without changing hardware. The techniques are well-known; the engineering is picking the right ones for your workload + measuring the quality trade-offs.


2. PRINCIPLES

2.1 Quantization

Reduce numerical precision: FP16 → INT8 → INT4. Smaller model = less GPU memory = larger batches = higher throughput. Quality degrades at extreme quantization but is often acceptable.

→ Pattern: inference-optimization: OUTLINE this phase

Investigate:

2.2 Distillation

Train a smaller “student” model to mimic a larger “teacher.” Smaller student = faster inference + lower cost. Common for fine-tuning specific tasks where you don’t need the teacher’s full generality.

Investigate:

2.3 Speculative decoding

A small “draft” model proposes tokens; the large “verifier” model checks them in parallel. Net effect: latency drops because many tokens accept per verification step.

Investigate:

2.4 Batch size tuning

Find the batch size that maximizes GPU utilization without degrading latency unacceptably. Workload-dependent.

Investigate:

2.5 KV cache optimization

KV cache dominates LLM memory at long contexts. Optimizations: prefix sharing (multi-tenant prompts), KV cache offload (RAM/disk for cold contexts), grouped-query attention (smaller cache).

Investigate:

2.6 The optimization stack composes

Quantization + speculative decoding + batch tuning + KV optimization compose multiplicatively. The combined optimization stack is 2-5× over baseline FP16 vanilla.

Investigate:


3. TRADE-OFFS

DecisionOptionsCost
QuantizationAWQ (INT4); GPTQ (INT4); FP8 (newer); GGUF (CPU)AWQ: best INT4 quality. GPTQ: similar. FP8: newer hardware. GGUF: CPU.
DistillationCustom train; off-the-shelf smaller modelCustom: targeted, $$. Off-shelf: cheap, generic.
Speculative decodingNative vLLM; n-gram speculation; medusaNative: built-in. n-gram: cheap, lower acceptance. Medusa: research-leaning.
Optimization budgetAll optimizations; selective; noneAll: complexity. Selective: pragmatic. None: leaving perf on the table.

4. TOOLS (as of 2026-06)

Reading


5. MASTERY: Optimized inference on basecamp

[ ] Quantize Phase 43's model to INT4 via AWQ; serve via KServe
[ ] Benchmark quality (perplexity + downstream task) before/after
[ ] Benchmark throughput before/after
[ ] Enable speculative decoding in vLLM with a small draft model
[ ] Measure speculative acceptance rate; tune draft model
[ ] Tune max-batched-tokens, max-num-seqs for your workload
[ ] Profile KV cache memory; observe prefix-cache reuse
[ ] Distill one specific behavior into a smaller model (optional, time-permitting)
[ ] A/B test optimization changes via Flagger (Phase 38): observe quality stability
[ ] Document optimization stack as ADR

6. COMPARE: TensorRT-LLM or DeepSpeed-Inference

Pick one alternative optimization stack. Apply to one model. Compare results.

400-word reflection.


7. OPERATE


8. CONTRIBUTE


What ships from this phase


Validation criteria

[ ] Quantized model (INT4 via AWQ) serving via KServe
[ ] Speculative decoding enabled with measured acceptance rate
[ ] Batch tuning documented
[ ] Quality + throughput before/after benchmarks
[ ] All 9 operational depth checks
[ ] Compare reflection (400 words)
[ ] 2-3 runbooks
[ ] 1-2 ADRs
[ ] Pattern entries:
    - inference-optimization → OUTLINE
[ ] Exit Test passed

Exit Test

Time: 2 hours.

Part 1: Build (75 min)

Apply quantization + speculative decoding to a new model. Benchmark both throughput and quality.

Part 2: Articulate (45 min)

~800 words: “Walk the inference optimization stack you applied. Cite each technique’s quality trade-off and throughput gain. Explain how you’d present these trade-offs to a non-technical stakeholder.”


Anti-patterns

Anti-patternWhy
Quantizing without quality measurementSilently degraded model
Applying all optimizations at onceCan’t attribute gains or regressions
Tuning batch size on synthetic workloadProduction workload has different distribution
Ignoring KV cache analysis at long contextMajor perf left on table

Patterns touched this phase


→ Next: Phase 45: Fine-tuning + PEFT