All courses

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.

Level: advanced3 lessons
01 — Before you start

Prerequisites

This course continues on from Deep Learning for NLP. Before you start, you'll need:

  • The previous course, or its equivalent
    A Transformer written from scratch in NumPy. Attention, backpropagation and cross-entropy are not explained again.
  • Intermediate Python
    Functions, classes, NumPy. In the last block, also files, processes and JSON.
  • A terminal
    Knowing how to open one, move between directories and run a script. The last block lives in it.
02 — Content

Syllabus

1 of 5 blocks · 3 lessons published
01From 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.3 of 9 lessons · 1h 20m
02From Predicting Text to Following InstructionsSupervised fine-tuning, the reward model, RLHF and the full derivation of DPO.8 lessons · coming soon
03Talking to the Model Is ProgrammingThe prompt as a specification, chain of thought, structured output, retrieval and how to evaluate.7 lessons · coming soon
04The Bridge: from Text to ActionsCalling tools, the loop, errors as observations, permissions and memory.7 lessons · coming soon
05A Coding Agent in the TerminalThe loop with a real local model, file tools, compaction, sandbox, subagents and a benchmark.9 lessons · coming soon
03 — About Gustavo

Your instructor

Gustavo Torres Guerrero

Gustavo Torres Guerrero

Holds a B.S. in Computer Science and a Master's in Mathematics and Computing from the University of Cantabria, Spain. Following four years as a software developer and five years in university teaching and research, I have spent over seven years working as an independent consultant and instructor, specializing in programming, mathematics, and artificial intelligence.

Author's note

This course was built with the help of AI tools, which I used to review, correct and polish the writing of my notes and materials, greatly speeding up the process. The content, the approach and the structure are guided by me, and every explanation, paragraph and equation has been carefully reviewed to ensure its clarity, coherence and reliability. Many lessons also include interactive explorables that reinforce the learning. I hope you find it useful. And if you ever get stuck or want to move faster, book a session with me: I'll be glad to help.

04 — Frequently asked questions

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 5 GB. A computer with 16 GB of RAM and no GPU is enough; with 8 GB there is a smaller model that also works.

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 last lesson points the real tool at the same model and compares the two on the same tasks.

Start today

Ready to build an agent?

Start with the first lesson. You don't need an account to read, or to install anything until the last block.

Start the course