Speculative-decoding inference server
Serve two open models with and without speculative decoding, measure speedup, acceptance rate by traffic type and tail latency at several batch sizes, and autoscale on queue wait.
The capstone and what it builds on
- 1Speculative-Decoding Inference ServerThe capstone brief
- 2Speculative Decoding - Draft, Verify, RepeatPhase 7: Transformers deep dive
- 3Speculative Decoding and EAGLE-3Phase 10: LLMs from scratch
- 4Quantization: Making Models FitPhase 10: LLMs from scratch
- 5Serving Engine Internals - PagedAttention, Continuous Batching, Chunked PrefillPhase 17: Infrastructure and production
- 6EAGLE-3 Speculative Decoding in ProductionPhase 17: Infrastructure and production
- 7Inference Metrics - TTFT, TPOT, ITL, Goodput, P99Phase 17: Infrastructure and production
- 8Load Testing LLM APIs - Why k6 and Locust LiePhase 17: Infrastructure and production
- 9GPU Autoscaling on Kubernetes - Karpenter, KAI Scheduler, Gang SchedulingPhase 17: Infrastructure and production
What You'll Build
An inference service that serves two open target models through an OpenAI-compatible API, with a baseline mode and a speculative-decoding mode (a draft model, EAGLE-style heads or n-gram drafts). You publish a methodical benchmark: throughput, acceptance rate per traffic distribution, p50 and p99 at several batch sizes, cost per 1M tokens, and a Kubernetes deployment that scales on queue wait.
Requirements
- Two target models (or two target and draft pairs), optionally quantized (FP8, INT4 or GGUF), served via vLLM, SGLang, llama.cpp server or your own server.
- Baseline benchmark without speculation: tokens/s at batch or concurrency 1, 8 and 32 (or the largest your hardware allows), p50 and p99 latency and GPU or CPU utilisation.
- Speculative mode: same benchmark with speculation enabled; report speedup and acceptance rate (accepted tokens per step).
- Output equivalence check: under greedy decoding, speculative and baseline outputs match token for token on a fixed prompt set (or explain and quantify any difference).
- Draft-depth sweep: vary the number of speculative tokens (or tree width) and show where deeper drafts stop helping.
- Traffic distributions: run at least three prompt sets (for example chat, code such as HumanEval prompts, and math such as GSM8K) and report acceptance rate per distribution.
- Second model: repeat the pipeline on the second target and compare.
- Kubernetes deployment (kind or minikube is fine) exposing a
queue_wait_msmetric and an HPA or KEDA scaler on it; demonstrate scale-out when load triples. - Cost: $ per 1M output tokens using your hardware's hourly price (rental or estimated), compared with at least one hosted API's public price for context.
Constraints
- Model-agnostic: any OpenAI-compatible endpoint (including the KatalockAi API) or a local model (for example via Ollama, llama.cpp or vLLM) may be used. No named commercial model is required; record which model you used in the README. Here the models are open weights you serve yourself.
- Hardware: one GPU is recommended (a free Colab T4 or a rented single GPU). CPU path: llama.cpp with a 1.5B to 3B target and a 0.5B draft, or your own speculative loop in PyTorch on GPT-2 sized models; report what your hardware gives.
- Substitution: the lesson serves 70B and 30B MoE targets on H100 with EAGLE-3 and targets 2.5x speedup. Here small model pairs and any speculative method your stack supports are accepted; 2.5x is a stretch target and honest, well-measured results earn the credit.
- Kubernetes autoscaling can run CPU-only pods with tiny models if you have no GPU in the cluster; say so.
Stretch Goals
- Add an automatic fallback to n-gram drafts when acceptance rate drops below a threshold.
- Measure acceptance when the draft is mismatched to the target version and build an alert.
- Compare two serving engines on the same model pair.
How to Submit
- Public GitHub repo with
serve/(configs),bench/(load generator, prompt sets, results),k8s/(manifests, HPA or KEDA),report/(plots and tables) andREADME.md. - README: hardware, models and drafts, how to reproduce each benchmark, the full results tables and plots, what changed and why speedup varies, and limitations.
- Paste the baseline vs speculative table, the per-distribution acceptance table and the autoscaling log.
How It's Reviewed
Professor Katalock reads your repository and the evidence you paste, and scores each criterion out of 100. You pass with a weighted total of 70 or more and no criterion below 40. A copied or padded submission is flagged and fails.
Submit
Push your work to a public GitHub repository with a README that explains how to run it, then paste the evidence below. Up to 3 reviews a day, free.
- Baseline vs speculative table (tokens/s, p50, p99 at each load level) for both models
- Acceptance rate per traffic distribution and the draft-depth sweep
- Greedy output-equivalence check result
- Autoscaling log or plot under tripled load
- Cost per 1M tokens calculation with assumptions
Reviews are done by AI against the rubric above. They check the evidence in your repository; they are not a substitute for a human code review, and a review can be wrong. If you think it is, improve the README so the evidence is unmistakable and resubmit.