Language Models:
from the Transformer to the Agent
Build, from scratch and on your own machine, a modern language model and the coding agent that turns it into a tool.
Prerequisites
This course continues on from Deep Learning for NLP. Before you start, you'll need:
- The previous course, or its equivalentA Transformer written from scratch in NumPy. Attention, backpropagation and cross-entropy are not explained again.
- Intermediate PythonFunctions, classes, NumPy. In the last block, also files, processes and JSON.
- A terminalKnowing how to open one, move between directories and run a script. The last block lives in it.
Syllabus
5 blocks · 40 lessons · ~19h reading01From the Transformer to the Language ModelA single column, real BPE, a mini-GPT trained in NumPy, how to sample from it and what each token costs.9 lessons · 4h 15m
- Una sola columna: el modelo de lenguaje causal20 min
- BPE de verdad: fusionar, no solo partir30 min
- Entrenar un mini-GPT en NumPy30 min
- Muestreo: temperatura, top-k y top-p30 min
- La caché de claves y valores: cuánto cuesta cada token30 min
- Perplejidad: medir un modelo de lenguaje30 min
- Leyes de escala: Kaplan y Chinchilla28 min
- Aprendizaje en contexto: el prompt como programa27 min
- Proyecto: el modelo hecho función30 min
02From Predicting Text to Following InstructionsSupervised fine-tuning, the reward model, RLHF and the full derivation of DPO.8 lessons · 4h
- Predecir no es obedecer25 min
- La plantilla de chat es un formato entrenado35 min
- Ajuste supervisado: máxima verosimilitud sobre un formato35 min
- Preferencias y el modelo de recompensa35 min
- RLHF: mejorar la recompensa sin alejarse32 min
- DPO: la derivación completa38 min
- De dónde salen las preferencias: humanos, constituciones y modelos20 min
- Proyecto: ajustar un modelo pequeño en Colab20 min
03Talking to the Model Is ProgrammingThe prompt as a specification, chain of thought, structured output, retrieval and how to evaluate.7 lessons · 3h 35m
- El prompt es una especificación25 min
- Cadena de pensamiento: más tokens, más cómputo25 min
- Salida estructurada: generación restringida35 min
- Embeddings y recuperación: darle al modelo lo que no sabe33 min
- La ventana de contexto es un recurso escaso27 min
- Evaluar: pruebas exactas, jueces y sus trampas35 min
- Proyecto: un asistente que recupera, responde en formato y se mide35 min
04The Bridge: from Text to ActionsCalling tools, the loop, errors as observations, permissions and memory.7 lessons · 3h 30m
- Del chat al agente: la mitad que falta25 min
- Llamar herramientas: salida estructurada con consecuencias30 min
- El bucle30 min
- Errores como observaciones30 min
- Permisos y confianza: la herramienta no es el usuario30 min
- Estado y memoria: lo que el bucle recuerda30 min
- Proyecto: un agente completo sobre un modelo guionizado35 min
05A Coding Agent in the TerminalThe loop with a real local model, file tools, compaction, sandbox, subagents and a benchmark.9 lessons · 3h 47m
- Preparar la máquina: un modelo local y la API de mensajes25 min
- El bucle con un modelo real25 min
- Herramientas: leer, buscar, editar, ejecutar30 min
- El prompt de sistema y el fichero de proyecto22 min
- Compactación: cuando la ventana se llena25 min
- Permisos y sandbox25 min
- Subagentes: un bucle dentro de otro25 min
- Un mini-benchmark: medir harness por modelo25 min
- MCP y lo que viene25 min
Your instructor
Frequently asked questions
How much does it cost?
Nothing. The course is free, and the last block runs on a local model on your own computer: no API key and no paid service required.
What do I need to know before starting?
What the previous course, Deep Learning for NLP, teaches: a Transformer built from scratch, backpropagation and cross-entropy. If you bring the same from somewhere else, that works just as well.
How long will it take?
Around 40 hours if you do the exercises and the final project. Go at your own pace; there are no deadlines.
What do I need to install?
Nothing until Block 5. The first four blocks run in the browser, Python included. Block 5 builds a terminal program against a language model running on your machine: Ollama and a model of about 2.5 GB. A computer with 8 GB of RAM and no GPU is enough; with more memory you can swap in a bigger model without changing the code.
Is there as much maths as in the first course?
At the start yes, at the end no, and that is on purpose. Blocks 1 and 2 derive; Block 3 mixes; Blocks 4 and 5 are engineering: contracts, protocols and a program that grows lesson by lesson. The title goes from the maths to the systems, and so does the course.
Do I build a real Claude Code?
You build a coding agent in the terminal with the same pieces: the loop, the tools, the system prompt, context compaction, permissions, subagents. Much smaller, and with a local model. The mini-benchmark lesson points the real tool at the same model and measures both on the same tests.