Wiring Language Models
From tokens and Transformers to RAG, tools, agents, fine-tuning, and production LLM systems -- how to wire a language model into a reliable, useful, secure piece of software.
Free to read now, no account needed: Readiness -- from text to Transformers. Create a free account to open the other chapters, take the quizzes and keep your progress.
- Chapter overview
- NLP, neural NLP, Transformers, and LLMs: the map ~14 min
- Language modeling as next-token prediction ~18 min
- Sparse representations recalled ~16 min
- Tokens and embeddings recalled ~15 min
- From recurrence to attention ~17 min
- Attention by hand ~24 min
- The Transformer block and decoder-only models ~20 min
- Softmax and cross-entropy recalled ~14 min
1 Tokenization π
Create a free account to open this chapter.
- Characters, words, and subwords ~16 min
- Byte-pair encoding by hand ~24 min
- Vocabulary, special tokens, and the cost of a token ~18 min
2 Embeddings for meaning and retrieval π
Create a free account to open this chapter.
- Word, sentence, and document embeddings ~18 min
- Measuring similarity: cosine vs. Euclidean ~20 min
- Dense retrieval: why embeddings power search ~18 min
3 How an LLM generates text π
Create a free account to open this chapter.
- Logits, softmax, and the next-token distribution ~16 min
- Temperature, top-k, and top-p ~18 min
- Context window and KV cache ~15 min
4 Pretraining at scale π
Create a free account to open this chapter.
- The pretraining objective, at scale ~16 min
- Data, compute, and scaling laws ~17 min
- What pretraining alone produces -- a base model ~15 min
5 The modern model landscape π
Create a free account to open this chapter.
- Base, instruct, chat, and reasoning models ~15 min
- Parameters, context length, and quantization ~17 min
- Cost, latency, and throughput trade-offs ~16 min
6 Calling models from Python π
Create a free account to open this chapter.
- The message abstraction -- roles and parameters ~18 min
- Streaming, errors, retries, and rate limits ~20 min
- Cost logging and the running ledger ~18 min
7 Prompting as programming π
Create a free account to open this chapter.
- Instructions, context, examples, and constraints ~16 min
- Few-shot prompting and templates ~18 min
- Failure modes, and a first look at prompt injection ~18 min
8 Structured generation π
Create a free account to open this chapter.
- JSON schemas and constrained decoding ~20 min
- Function-call argument shapes ~18 min
- Validation with Pydantic, retries, and guardrails ~20 min
9 Why models need external knowledge π
Create a free account to open this chapter.
- Hallucination and the knowledge cutoff ~16 min
- The RAG shape: chunk, embed, search, inject, generate ~20 min
- A worked RAG example: end to end ~20 min
10 Vector search and hybrid retrieval π
Create a free account to open this chapter.
- Exact and approximate nearest-neighbor search ~20 min
- Metadata filtering and hybrid search ~22 min
- Reranking ~18 min
11 Advanced RAG and context engineering π
Create a free account to open this chapter.
- Query rewriting and HyDE ~18 min
- Parent-child chunking and context compression ~18 min
- The context budget: retrieval vs. stuffing vs. summarizing ~20 min
12 Giving models tools π
Create a free account to open this chapter.
- Tool schemas and the tool loop ~20 min
- Permissions, confirmation, and tool security ~20 min
- Error handling and tool results ~18 min
13 What is an agent? π
Create a free account to open this chapter.
- The agent loop: plan, act, observe, reflect ~22 min
- State and memory ~16 min
- When a workflow beats an agent ~18 min
14 Agent architectures π
Create a free account to open this chapter.
- ReAct and planner/executor patterns ~18 min
- Router and multi-agent/supervisor patterns ~17 min
- Stateful graphs, human-in-the-loop, and framework vs. native ~18 min
15 Model Context Protocol π
Create a free account to open this chapter.
- Resources, tools, and prompts ~16 min
- Servers, clients, and permissions ~17 min
- A small MCP example in Python ~15 min
16 Building LLM applications π
Create a free account to open this chapter.
- From single-purpose calls to composed systems ~16 min
- Seven project patterns: an architecture walkthrough ~20 min
- Eval before you build: the course-wide harness ~15 min
17 Do you need fine-tuning? π
Create a free account to open this chapter.
- The adaptation ladder as a decision chain ~18 min
- When prompting and RAG stop being enough ~16 min
- Cost, latency, and maintenance once you fine-tune ~16 min
18 Parameter-efficient fine-tuning π
Create a free account to open this chapter.
- Supervised fine-tuning, the basics ~16 min
- LoRA and QLoRA, by the numbers ~22 min
- Data prep, overfitting, forgetting, and merging ~18 min
19 Post-training π
Create a free account to open this chapter.
- Instruction tuning and preference data ~18 min
- Reward modeling and RLHF ~20 min
- DPO, KTO, GRPO, and distillation ~20 min
20 Evaluating language models π
Create a free account to open this chapter.
- Exact match, F1, BLEU, and ROUGE ~20 min
- Perplexity, recalled, and human evaluation ~18 min
- LLM-as-judge: pairwise comparison and rubrics ~20 min
21 Evaluating RAG and agents π
Create a free account to open this chapter.
- Retrieval metrics: recall, precision, and context relevance ~20 min
- Generation metrics: faithfulness, groundedness, and answer relevance ~20 min
- Agent metrics, and the reusable eval harness ~22 min
22 LLM failure modes and attacks π
Create a free account to open this chapter.
- Prompt injection and jailbreaking, a deeper look ~22 min
- Tool abuse, excessive agency, and data leakage ~22 min
- Context and retrieval poisoning ~22 min
23 Building safer LLM applications π
Create a free account to open this chapter.
- Input and output validation ~20 min
- Permissions, sandboxing, and least privilege ~20 min
- Audit logging and defense in depth ~22 min
24 Fast and affordable π
Create a free account to open this chapter.
- Caching, batching, and quantization, recalled ~18 min
- Prompt compression and context management ~17 min
- Routing and cascades: the cost ledger's payoff ~22 min
25 Production LLM application architecture π
Create a free account to open this chapter.
- The application server's shape ~16 min
- Async processing, streaming, and caching at the systems level ~17 min
- What this course doesn't own: generic MLOps, and where it lives ~12 min
26 Beyond text π
Create a free account to open this chapter.
- Vision-language models and image understanding ~22 min
- Document understanding, OCR, and speech ~20 min
- Multimodal embeddings and multimodal RAG ~22 min
27 Reasoning models and test-time compute π
Create a free account to open this chapter.
- What "reasoning" means here -- observable behavior, not extraction ~16 min
- Self-consistency as sampling plus verification ~20 min
- Search-augmented test-time compute ~16 min
28 Capstone: wire a complete LLM system π
Create a free account to open this chapter.
- The capstone brief and the 11-point architecture document ~24 min
- Composing your system from this course's pieces ~20 min
- What good documentation and a real demo look like ~18 min
Appendices
Reference chapters on the tools the course uses. Dip in when a lab or a section sends you here; they are not part of the course exam.
A Appendix A: Three Execution Paths π
Create a free account to open this chapter.
- Colab and browser-based cloud environments ~12 min
- Running models locally: CPU and GPU ~12 min
- Hosted API access: keys and environment variables ~14 min
B Appendix B: The Hugging Face Ecosystem π
Create a free account to open this chapter.
- The Hub: models, datasets, and cards ~16 min
- transformers and tokenizers ~18 min
- Datasets, Evaluate, Accelerate, PEFT, and TRL ~18 min
C Appendix C: Running Models Locally π
Create a free account to open this chapter.
- Ollama and llama.cpp: two local-inference runners ~12 min
- GGUF, quantized models, and VRAM budgets ~15 min
- vLLM: local batching and throughput ~12 min
D Appendix D: Technology Watch π
Create a free account to open this chapter.
- How to read a model card or a new tool's documentation ~14 min
- How to evaluate whether a new tool is worth adopting ~14 min
- A dated snapshot -- September 2026 ~12 min