โ† Curriculum
๐Ÿค–

Module 7

Advanced

Transformers 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.

Your progress

0/8

4.5 hoursโšก 1035 XP
Start module

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. 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.

  2. ๐Ÿ”’

    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.

  3. ๐Ÿ”’

    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.

  4. ๐Ÿ”’

    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.

  5. ๐Ÿ”’

    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.

  6. ๐Ÿ”’

    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.

  7. ๐Ÿ”’

    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.

  8. ๐Ÿ”’

    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.