Hands-on labs
41 runnable notebooks that turn the questions into code you have run yourself. "Open in Colab" runs them on Google's free GPU in your own Google account; nothing runs on this site's server.
Build an LLM from scratch 0/14
Write every part of a GPT-style model in PyTorch, then pretrain, fine-tune and align it. From Sebastian Raschka's LLMs-from-scratch.
- Tensors, autograd and a training loop: the PyTorch you need for everything after it.
- Tokenise text, build a byte-pair encoding pipeline and a sliding-window data loader.
- Train, encode and decode with your own byte-pair encoder.
- From simple attention to causal, multi-head attention, one step at a time.
- Assemble layer norm, the feed-forward block, residuals and the full GPT architecture.
- Training loop, loss curves, decoding strategies and loading pretrained GPT-2 weights.
- Turn the GPT model into a spam classifier and measure it.
- Format an instruction dataset, fine-tune, then score the responses with another model.
- Add low-rank adapters to the model and fine-tune only those.
- Align the instruction model with direct preference optimisation.
- See what changes from GPT to a modern architecture: RoPE, RMSNorm, SwiGLU, grouped-query attention.
- Count the compute in a GPT forward pass.
- Add a key-value cache to the GPT model and measure the speed-up.
- Replace the feed-forward block with routed experts.
Applied LLMs, chapter by chapter 0/12
Twelve notebooks from Hands-On Large Language Models, from tokens to RAG to fine-tuning. Built for the free Colab T4 GPU.
- Load an open model and generate text.
- Compare tokenizers and explore token, word and contextual embeddings.
- Trace a forward pass, the KV cache and the language-modelling head.
- Representation models, zero-shot embeddings and generative classifiers.
- Embed, reduce, cluster and label documents with BERTopic.
- Prompt components, in-context learning, chaining and reasoning prompts.
- Model I/O, memory and a simple ReAct-style agent.
- Dense retrieval, reranking and a small RAG pipeline.
- CLIP embeddings and a vision-language model that chats about images.
- Contrastive learning and fine-tuning sentence-embedding models.
- Fine-tune BERT for classification, few-shot with SetFit.
- Supervised fine-tuning with QLoRA, then preference tuning with DPO.
Fine-tune and align 0/6
Supervised fine-tuning, LoRA and QLoRA, DPO and ORPO on free Colab GPUs, with LlamaFactory for config-driven training.
- Fast, memory-efficient supervised fine-tuning on a free Colab GPU.
- Supervised fine-tuning on the free tier with TRL.
- Improve a supervised fine-tuned model with direct preference optimisation.
- Combine supervised fine-tuning and preference alignment in one pass.
- Fine-tune with LoRA or QLoRA from a config file or the LlamaBoard web UI, then chat with and export the result.
- Ready-made configs for supervised fine-tuning, reward modelling, PPO, DPO and KTO across 100+ open models.
Quantize, merge and serve 0/8
Shrink models with GPTQ, GGUF and EXL2, merge them, and put them behind an OpenAI-compatible API.
- 8-bit quantization from first principles, absmax and zero-point.
- Quantize an open model to run on consumer hardware.
- Quantize to GGUF for CPU and laptop inference.
- Quantize and run EXL2 models for fast GPU inference.
- Greedy, beam search, top-k and nucleus sampling, with code.
- Combine fine-tuned models without any GPU training.
- Ground a chatbot's answers in a knowledge graph.
- Expose a fine-tuned model behind an OpenAI-compatible endpoint.
Agents 0/1
Notebooks that build and evaluate a tool-using agent.
- Notebooks that give a support agent actions, then planning, with test cases to evaluate it.
Free courses to go deeper
Applied LLMs Mastery
A 10-week course from foundations and prompting to RAG, evaluation and building apps.
Agentic AI crash course
Ten parts: agent types, tools, agentic RAG, MCP, planning, memory and multi-agent systems.
AI evals for everyone
Ten chapters on reference datasets, metrics, production monitoring and the eval process.
Build a Large Language Model (From Scratch)
Sebastian Raschka's full repository, with exercises and many bonus notebooks.
Hands-On Large Language Models
Jay Alammar and Maarten Grootendorst's companion notebooks, built for free Colab GPUs.
LlamaFactory
Zero-code fine-tuning for 100+ open models: LoRA, QLoRA, DPO, PPO and more.