AI Hero Club
← Course Overview

LEARNING PLAN/ Progress

Efficient LLM Inference

Use a reproducible CPU inference lab to derive prefill and decoding costs, validate KV caching, budgets, continuous batching, and quantization error, and distinguish correctness, memory savings, and speed with raw measurements.

Start with a question, derive the mechanism, then test your implementation with new inputs.

Big model efficient reasoning cover.
8 Chapter / Same full itemSection Learning Recommendations 16 HoursSeparate exercise and project reserved 16 hours

Times are author estimates that include derivation and practice. They have not been measured with learners; work through the sections at your own pace.

WHAT YOU WILL BUILD

What will you build to demonstrate understanding?

  • Indication of prefills, cache decoding and space costs by item and reconciliation of actual loads
  • Validate multi-layer cache, global mask, error prefix and absolute position window boundaries
  • Distinguishing simulations, approximation and precision by replaying scheduling and quantifying reverses
  • Keep correctness, original timing, Hash and incomplete entries on the same freezing model
What should you know before starting?
  • Can run the local Python program and understand matrix shapes
  • Understanding cause and effect attention, pre-LN, disability, location-by-position feed and complete decoder; link to relevant refresher entry first
  • Readable Multiplication, Summation, Maximum Value and Basic Probability; Cost and Error Formula for this course to spread out item by item

Use the prerequisites to choose a starting point. You can read freely and return to earlier lessons whenever you need them.

THE LEARNING ROUTE

A clear path, one step at a time.

Marked Complete by You0 / 8

Saved in this browser only. Marking a lesson complete does not mean the project has passed verification.

01

Workload and reuse

Defines the time and cost calibre to validate the cache and to establish a memory book.

01

Define the Workload Before Deriving Inference Costs

If two implementations both claim more tokens per second, how do we check that they use the same workload and time denominator?

120 minutes ↗
02

KV Caching: Verify Reuse, Positions and Windows

After retaining previous keys and values, how do we prove that chunked computation equals a full-prefix forward pass?

120 minutes ↗
03

From KV Elements to Memory Accounting and Admission Budgets

Given layers, batch size and sequence length, how do we calculate cache memory and request capacity before allocation?

120 minutes ↗
02

Implementation and quality

Distinguishing simulation schedule, approximate quantification and numerical correctness.

04

Continuous Batching: State, Timelines and Falsifiable Simulations

When a short request arrives before a long one finishes, how does continuous batching change waiting and completion times?

120 minutes ↗
05

Quantization: From Rounding Errors to Model-quality Limits

After rounding weights to a small set of levels, how do we estimate errors and distinguish fake quantization from real integer execution?

120 minutes ↗
06

Verify Exact Execution and Approximate Quality Separately

Why do small differences in cached and quantized outputs require different verification criteria?

120 minutes ↗
03

Measurement and reporting

The fixed trajectory jointly checks the equivalence and time-consuming, preserving the measurement of boundaries.

07

Measurement: Fixed Traces, Paired Repeats and Performance Limits

Is one faster timing enough? How do we check numerical equivalence and repeated run times on the same inputs?

120 minutes ↗
08

Final Project: Joint Evidence from One Frozen Build

How can one report combine theoretical costs, simulated scheduling and real CPU measurements without confusing their definitions?

120 minutes ↗

BUILD / TEST / TRANSFER

Auditable CPU Logic Laboratory

Freeze random little decoder to complete cache matching, actual KV bytes, movement control simulations, quantitative errors and fixed tracks to match; deliver source code and real receipts that can be independently downloaded.

Runtime Requirements
Python 3.12 and PyTorch 2.6.0 are recommended. A CPU is sufficient; see the project README for installation instructions.

Download the Project ↓

Read the README after extracting the archive, then follow its environment and run instructions. Reference implementations and learning tasks are provided separately.

Project Checklist

This is a personal checklist, not an automatic grade. Keep your inputs, results, failures and reproduction commands.