Labs

Hands-on labs with runnable code. Some run fully offline with zero installs (great for verifying you understand the mechanics); others need an API key or GPU (production-shaped). Every lab maps to a phase and feeds the Capstone.

Labs

#LabRuns offline?Phase
01OpenAI SDK Fundamentalsneeds API key1, 10
02Local Inference with Ollamaneeds Ollama6
03RAG Pipeline from Scratchneeds API key9
04Agent with Tool Callingneeds API key10
05Build an Eval Harness✅ scorers.py offline12
06Tokenizer & KV-Cache Calculator✅ fully offline2, 6.02
07vLLM Serving & Benchmarkneeds GPU7.01
08Build an LLM Gateway✅ gateway.py offline8
09Hybrid Search from Scratch✅ fully offline9.05
10Structured Output & Validation✅ validate.py offline10.02
11Unit-Economics Cost Calculator✅ fully offline15.05
12Observability & Load Test✅ load_test.py offline7.08
13LoRA / QLoRA Fine-Tuneneeds GPU13.02
14Prompt-Injection Red-Team✅ redteam.py offline14.01

Start here (no setup needed)

These run with just Python 3 (zero installs) — do them first to cement the mechanics:

python3 lab-06-tokenizer-and-kv-cache/kv_cache_calc.py --params 70 --bits 4 --ctx 32768 --batch 8 --bandwidth 3350
python3 lab-11-cost-calculator/cost_calc.py
PYTHONHASHSEED=0 python3 lab-09-hybrid-search/hybrid_search.py
python3 lab-05-eval-harness/scorers.py
python3 lab-08-llm-gateway/gateway.py            # routing + fallback + metering
python3 lab-14-prompt-injection-redteam/redteam.py   # attack leaks vs architecture contains
python3 lab-10-structured-output/validate.py     # constrained != correct
python3 lab-12-observability/load_test.py        # p50/p95/p99 under load

How labs fit together

  • Fundamentals: 06 (memory/speed math), 09 (retrieval), 05 (eval), 11 (cost).
  • Applied: 01 (SDK), 03 (RAG), 04 (agents), 10 (structured output), 14 (security).
  • Production: 02/07 (serving), 08 (gateway), 12 (observability), 13 (fine-tuning).
  • Integrate them all in the Capstone.

The offline labs are deliberately dependency-free so you can run them anywhere and verify your mental model. The numbers they print are the numbers you quote in interviews (interview-prep/).