FixTheRobot Explore Robotics / Large Language Models

Learning track

Learn Large Language Models from Scratch

Understand how large language models work by building a GPT-style model step by step. Learn tokenization, attention, Transformers, pretraining, fine-tuning, evaluation, and modern LLM engineering through theory and hands-on implementation.

12 of 12 modules are complete. 65 of 65 theory lessons and 35 of 35 labs are open (12 of the labs are PyTorch notebooks). Items marked coming soon are not yet available. Start with the first lesson.

What you will learn

By the end of the track you can explain how an autoregressive language model generates text, build tokenizers and training data, implement attention and a GPT-style Transformer in PyTorch, pretrain a small model, control text generation, fine-tune for classification and instructions, adapt models efficiently with LoRA, evaluate models honestly, and build applications around them with retrieval and tools. The method is understand, implement, train, evaluate, improve, apply: understanding through implementation, not through calling an API.

Understand, implement, train, evaluate, improve, applySix boxes in a row: understand, implement, train, evaluate, improve, apply, with an arrow from improve back to implement.UnderstandImplementTrainEvaluateImproveApplyiterate
The teaching loop of the track. Every module follows it at a different scale.

Who it is for

Students and engineers who can read Python and want to understand LLMs from the inside, including robotics learners who will meet language models in the Physical AI and Vision-Language-Action tracks. You do not need prior machine-learning experience.

Prerequisites

  • Python: functions, lists, dictionaries and classes. The browser labs run Python in your browser; no installation is needed.
  • Maths: vectors and matrices (a dot product, a matrix product), the idea of a derivative, and basic probability. Each lesson recalls what it uses.
  • For the notebook labs: a computer or hosted notebook where you can install PyTorch. A GPU is optional; every notebook has a CPU-friendly path with a tiny model.

What you will build

A tokenizer and data pipeline, scaled dot-product and multi-head causal attention, a GPT-style Transformer, a training loop, samplers, a classifier and an instruction-following model, a LoRA experiment, an evaluation harness, a small retrieval application, and in the capstone a complete, evaluated LLM system with a written report. These are small educational models; they do not match the capabilities of production LLMs, and the track says so wherever it matters.

How the track works

The three kinds of content in this track
KindWhere it runsWhat it is for
Theory lessonYour browserIntuition, mathematics with tensor shapes, worked examples, common mistakes and three knowledge-check questions.
Browser labYour browser (Python via Brython)Pure-Python exercises on the mechanics: tokenizers, attention arithmetic, sampling, metrics, memory estimates. Graded automatically on hidden cases. These are educational simulations, not trained models.
PyTorch notebook labYour computer or a hosted notebookReal PyTorch implementation and training of small models, with self-checks inside the notebook. The site cannot run these for you.

Primary reference and further resources

The curriculum follows Sebastian Raschka’s book Build a Large Language Model (From Scratch): see the book companion site, the official code repository and the publisher page. The explanations, examples and exercises on this site are original; each lesson links to the matching book chapter and code. Modules 8 to 11 add optional modern material from research papers and official documentation, clearly marked as going beyond the book’s core path.

Connection to Physical AI and VLA

This track covers language models themselves. How a language model is connected to a robot (grounding, skills, safety layers, vision-language-action policies) is taught in the Physical AI and VLA tracks and is linked, not repeated, here. Module 11 shows why a model must never bypass a robot’s safety layer, and how tool calling and structured outputs connect to validated robot functions.

Module 1

Understanding Large Language Models

What a language model is, how next-token prediction becomes text generation, how training differs from inference, what scale means, and the plan for building a GPT-style model.

You will be able to: explain autoregressive generation as repeated next-token prediction; distinguish training, inference, pretraining and fine-tuning; read parameter counts, token counts and context windows; state what LLMs can and cannot do and describe the build plan.

All 7 items available

Module 2

Text Data and Tokenization

Normalising text, building vocabularies, byte-pair encoding, special tokens, input-target pairs, sliding windows, batching and data splits.

You will be able to: turn raw text into token IDs and back; build a vocabulary and explain subword tokenization with byte-pair encoding; construct input-target pairs for next-token prediction; batch data correctly and avoid leakage between training and validation sets.

All 9 items available

Module 3

Embeddings and the Mathematics of Attention

Token embeddings, positional information, queries, keys and values, scaled dot-product attention, causal masking, multi-head attention and tensor shapes.

You will be able to: explain why token IDs become vectors and how position is added; compute attention scores and weights step by step; apply a causal mask and explain what it prevents; implement multi-head causal self-attention in PyTorch and track its shapes.

All 9 items available

Module 4

Build a GPT Model from Scratch

The Transformer architecture, layer normalization, residual connections, feed-forward layers, the Transformer block, the output head, parameter counts and tensor shapes through the forward pass.

You will be able to: describe the GPT architecture and the role of every component; implement layer normalization, a feed-forward block and a Transformer block; assemble a GPT model and run a forward pass; count parameters and explain the tensor shape at each step.

All 8 items available

Module 5

Pretraining and Text Generation

The next-token objective, cross-entropy, gradient-based optimization, training loops, overfitting, learning rates, and decoding with temperature, top-k and top-p.

You will be able to: explain cross-entropy loss and perplexity for next-token prediction; describe backpropagation and AdamW at the level needed to run training; write a training loop with validation and checkpoints and diagnose a bad run; generate text with temperature, top-k and top-p and compare them.

All 9 items available

Module 6

Fine-Tuning for Classification

Adapting a pretrained language model to a labelled task with a classification head, frozen and trainable layers, metrics and failure analysis.

You will be able to: explain how supervised fine-tuning differs from pretraining; attach a classification head and choose the sequence representation; decide which parameters to freeze and which to train; evaluate a classifier and inspect its failures and data quality.

All 7 items available

Module 7

Instruction Fine-Tuning

Why pretraining does not produce instruction following, instruction datasets, prompt templates, special tokens, loss masking and evaluating responses.

You will be able to: explain why a base model does not follow instructions; format instruction-response data with a template and special tokens; mask the loss to the response tokens and justify it; evaluate instruction following against criteria and recognise contamination.

All 8 items available

Module 8

Efficient Fine-Tuning and Model Adaptation

Full versus parameter-efficient fine-tuning, LoRA, memory and compute estimates, quantization, and choosing a base model.

You will be able to: compare full fine-tuning with parameter-efficient methods; derive the LoRA update and count its trainable parameters; estimate training and inference memory; reason about quantization trade-offs and checkpoint management.

All 8 items available

Module 9

Evaluation, Inference and Reliability

Perplexity and its limits, task evaluation, sampling variability, hallucination, prompt sensitivity, reproducibility, latency, memory and responsible evaluation.

You will be able to: choose and compute metrics that match a task; measure the variability of a result and report uncertainty; identify hallucination and prompt-sensitivity failures; build a small repeatable evaluation harness and measure inference cost.

All 9 items available

Module 10

Modern LLM Architecture and Inference

How modern decoder-only models differ from a minimal GPT: rotary embeddings, multi-query and grouped-query attention, gated feed-forward layers, mixture of experts, KV caching and inference efficiency.

You will be able to: list what changed between a minimal GPT and modern open models and why; explain rotary position embeddings, MQA/GQA and SwiGLU; estimate KV-cache memory and the cost of prefill versus decode; reason about architecture trade-offs for latency, memory and quality.

All 9 items available

Module 11

Building LLM Applications

Base versus instruction-tuned models, prompting and structured outputs, embeddings and retrieval, RAG, tool calling, application evaluation and security.

You will be able to: choose between base and instruction-tuned models and design prompts; build retrieval with embeddings, chunking and grounding; validate structured outputs and tool calls before acting; identify cost, latency and security risks including prompt injection.

All 9 items available

Module 12

Capstone: Build and Evaluate Your Own LLM System

A staged project: prepare data, build the tokenizer and pipeline, train or adapt a model, evaluate reproducibly, build a small application and write the report.

You will be able to: scope an LLM project to the compute available; run and document a reproducible experiment; evaluate honestly, including failure cases; write a report that states architecture, data, training, results and limits.

All 8 items available