Capstone: ship your engine with correctness tests, a benchmark and a design report
A project brief for the Build an Inference Engine course: prove correctness against a reference, add one explained optimisation, benchmark honestly against the bandwidth ceiling and llama.cpp, document the design, and deliver a short report. Includes deliverables, a plan, a rubric and a checklist.
By Sandip Maity, Applied AI Engineer
You wrote a forward pass, a KV cache, a sampler, a GGUF-style loader, quantised matrix multiplication, a continuous-batching scheduler and a server, and you benchmarked a real model against llama.cpp. The capstone asks you to package that work as something another engineer could trust: correct, measured, documented and honest about its limits.
#The brief
Deliver a small engine repository with three things that people usually skip: tests that prove correctness, a benchmark you could defend and a design report. You may reuse the code from the course. The grading is about evidence.
- 1Step 1: correctnesslogits against a reference, as tests
- 2Step 2: baseline speedtokens per second against the ceiling
- 3Step 3: one optimisationchange, measure, explain
- 4Step 4: server and batchinga streaming endpoint with limits
- 5Step 5: reportdesign, numbers, what you did not do
#Deliverables
- Correctness suite: tests that load the same weights as a reference implementation and compare logits on several prompts within a stated tolerance, plus tests that the KV cache gives the same output as recomputation and that a quantised matmul stays within its error budget (forward pass, quantised matmul).
- Weight loading: a loader that opens a real model file, with metadata and tensor checks that fail loudly on a malformed file (loading weights).
- Benchmark: prefill and decode speed for a fixed model file, prompt length and generation length, with a warm-up, several runs and the spread; the bandwidth ceiling for your machine; and the same measurements for llama.cpp (the benchmark lab).
- One optimisation: for example threading across rows, a better weight layout, a fused dequantise-and-multiply, or a smarter KV cache layout, with before and after numbers and an explanation of why it should help (speed on the CPU, KV cache and sampling).
- Server: an OpenAI-style streaming endpoint with a limit on concurrent requests, a maximum context length, request timeouts and a health check, and a load test showing throughput and latency at two concurrency levels (batching and the server).
- Design report (2 to 4 pages): architecture, the main design choices and why, the measurements, the gaps against llama.cpp, and a list of what you did not build.
- README: exact commands to build, run the tests and reproduce the benchmark.
Pro content
Keep reading with Inference Academy Pro
Unlock the rest of this lesson, plus every advanced lesson, hands-on lab, the larger playground models and completion certificates.
Still to come in this lesson
- A plan
- Reading your numbers
- Rubric (100 points)
- Common mistakes
- Checklist before you finish
- Exercise
- Where to go next
You will be able to answer
- What is the first thing to prove about a new inference engine?
- Your engine decodes at 6 tokens per second on a machine whose memory bandwidth and model size give a ceiling of 12. What do you conclude?
- Which benchmark practice makes a speed claim credible?
- You add an optimisation and tokens per second rise by 4%, within the run-to-run spread. What should the report say?
- Why keep the correctness test running after you optimise?