AI Engineering from Scratch

Cheat sheets

One poster for each topic. Each poster holds the tasks, commands, code, diagrams, defaults and fixes that you use while you work. Every fact comes from a lesson or a manual of this course.

Topics

  1. A2A ProtocolDiscover an agent, send it work, follow the task, read its errors. Pinned to A2A 1.0.1.40 rows · 2 diagrams · 13 blocks
  2. Agent Harness EngineeringThe code around the model. Loop contract, hooks, budgets, tools, gates, sandbox, traces and workbench files.33 rows · 2 diagrams · 13 blocks
  3. AI Safety and Red TeamingName the attack, detect it, measure refusals, gate the output and audit alignment. Phase 18 and 19 lessons.30 rows · 2 diagrams · 12 blocks
  4. Autonomous Agents and PermissionsRun an agent unattended with limits. Permission modes, budgets, kill switches, durable execution, approvals, rollback.24 rows · 2 diagrams · 12 blocks
  5. Classical Machine LearningFit, validate, tune and fix regression, classification and clustering models with scikit-learn.30 rows · 2 diagrams · 12 blocks
  6. Computer VisionPreprocess, convolve, classify, fine-tune, detect, segment and patchify images. PyTorch and NumPy from the lessons.37 rows · 2 diagrams · 12 blocks
  7. Training Neural NetworksPick the optimizer, init, normalization, regularization and schedule. Then debug the run when the loss misbehaves.40 rows · 2 diagrams · 12 blocks
  8. Diffusion and Generative ModelsTrain and sample a VAE, a GAN, DDPM, latent diffusion and flow matching, then measure them. Toy Python from the lessons.32 rows · 2 diagrams · 11 blocks
  9. Docker Sandboxes for AgentsRun an agent in a microVM, control its network and keys, get its commits back. sbx 0.47.0, docker-agent 1.149.0.35 rows · 2 diagrams · 12 blocks
  10. Embeddings and Vector SearchEncode text, pick a metric, size the vectors, choose an index and fix bad recall. Python, NumPy and FAISS.31 rows · 2 diagrams · 12 blocks
  11. Inference Optimization: KV Cache, Quantization, BatchingSize the KV cache, batch continuously, pick a quantization format, and measure what users feel.29 rows · 2 diagrams · 12 blocks
  12. Evaluating LLMsSpecify tasks, score them, judge with a rubric, calibrate, rank with intervals and test long context.35 rows · 2 diagrams · 12 blocks
  13. Fine-Tuning with LoRAAdd LoRA adapters, load a 4-bit base for QLoRA, mask SFT labels, train, merge and debug. PyTorch, PEFT and bitsandbytes.28 rows · 2 diagrams · 12 blocks
  14. Math for Machine LearningGradients, probability, information, optimizers, decompositions and float safety. NumPy, SciPy and PyTorch.32 rows · 2 diagrams · 12 blocks
  15. Model Context Protocol (MCP)Build, call and serve stateless MCP 2026-07-28 servers over stdio and Streamable HTTP.32 rows · 2 diagrams · 12 blocks
  16. Multi-Agent SystemsAgents, handoffs, shared state and orchestrators. Pick a pattern, vote, checkpoint and fix the known failures.31 rows · 2 diagrams · 12 blocks
  17. Prompt EngineeringWrite the prompt, add examples and reasoning, vote, and budget the context window. Python from the lessons.32 rows · 2 diagrams · 11 blocks
  18. PyTorch EssentialsTensors, autograd, nn.Module, the training loop, DataLoader and devices, from the lessons.44 rows · 2 diagrams · 12 blocks
  19. Retrieval-Augmented Generation (RAG)Chunk, index, retrieve, fuse, rerank, generate with citations and grade each stage. Python from the lessons.32 rows · 2 diagrams · 12 blocks
  20. Reinforcement LearningMDPs, value methods, policy gradients, PPO, RLHF and GRPO. Formulas, update lines and diagnostics from Phase 9.32 rows · 2 diagrams · 12 blocks
  21. Reverse Engineering with reaRead a compiled program and prove what you found. Pinned to rea-agents 6.5.0 with Ghidra 12.1.4.48 rows · 2 diagrams · 13 blocks
  22. LLM Serving with SGLangStart, query, size, measure and fix an SGLang server. Pinned to SGLang 0.5.22.40 rows · 2 diagrams · 13 blocks
  23. Tokenization and BPETrain, encode and decode a byte-level BPE tokenizer, then slice the id stream into training windows.24 rows · 2 diagrams · 11 blocks
  24. Tool Calling and Structured OutputsDeclare tools, read calls, return results, run calls in parallel, stream arguments, and force JSON that validates.29 rows · 2 diagrams · 13 blocks
  25. Transformers and AttentionCompute attention, mask it, split heads, add positions and stack the block. PyTorch and NumPy from the lessons.32 rows · 2 diagrams · 11 blocks

By phase

How to use them