Module 7
AdvancedTransformers and Large Language Models
Open the black box of modern LLMs: tokenization and RoPE, attention and FlashAttention, the decoder-only Transformer, pretraining and scaling laws, fine-tuning and alignment, reasoning models, mixture-of-experts and hybrid architectures, and how inference really works.
What you'll be able to do
- โExplain how text becomes tokens with byte-level BPE, how embeddings work, and how RoPE encodes relative position
- โImplement scaled dot-product, multi-head and grouped-query attention from scratch and explain how FlashAttention computes it exactly and fast
- โBuild a modern decoder-only Transformer (pre-norm, RMSNorm, SwiGLU, causal masking) and control generation with temperature, top-p and min-p
- โReason about data curation, scaling laws, Chinchilla compute-optimal training and inference-aware overtraining
- โCompare SFT, LoRA and QLoRA, RLHF, DPO and newer preference methods, and RL from verifiable rewards
- โDecide when reasoning models and test-time compute are worth their cost, and explain how RL trains them
- โExplain mixture-of-experts, long-context techniques, state-space and hybrid models, and multimodal tokenization
- โAnalyze LLM serving: the KV cache, why decoding is memory-bound, continuous batching, PagedAttention and speculative decoding
Lessons
- 1
Tokenization and Embeddings
How raw text becomes tokens with byte-level BPE, how tokens become vectors, and how rotary position embeddings (RoPE) tell a model where each token sits.
30 minโก 110Free preview - ๐
The Attention Mechanism
Build scaled dot-product, multi-head and grouped-query attention from scratch in NumPy, understand what queries, keys and values do, and see how FlashAttention computes exact attention fast.
32 minโก 125Pro - ๐
The Transformer Architecture
Assemble attention, RMSNorm, SwiGLU feed-forward layers and residual connections into a modern decoder-only Transformer, count its parameters, and generate text with temperature, top-p and min-p sampling.
34 minโก 130Pro - ๐
Pretraining and Scaling Laws
How LLMs learn from next-token prediction on trillions of curated tokens, what scaling laws predict, what Chinchilla changed, and why modern models are deliberately trained far past the compute-optimal point.
34 minโก 130Pro - ๐
Fine-Tuning and Alignment
Turn a pretrained base model into a helpful, honest assistant with supervised fine-tuning, LoRA and QLoRA, RLHF, DPO and newer preference methods, and reinforcement learning from verifiable rewards.
36 minโก 135Pro - ๐
Reasoning Models and Test-Time Compute
Why chain-of-thought works, how reinforcement learning produces models that think before answering, how to trade inference compute for accuracy with sampling, voting, verifiers and longer thinking, and when reasoning helps or hurts.
34 minโก 135Pro - ๐
Modern LLM Architectures
Beyond the dense Transformer: mixture-of-experts, long-context techniques and their limits, state-space and hybrid models, and how images, audio and video become tokens.
34 minโก 135Pro - ๐
LLM Inference Under the Hood
How LLMs are served efficiently: prefill versus decode, the KV cache, why decoding is memory-bound, continuous batching and PagedAttention, prefix caching, quantization and speculative decoding.
34 minโก 135Pro