Theory
Explain probability, cross entropy, attention, tokenization, optimization, and scaling in plain language.
LLM ML Course
A practical course for transformer theory, PyTorch implementation, decoding, fine-tuning, RAG, agents, and interview-ready reasoning.
North Star
Explain probability, cross entropy, attention, tokenization, optimization, and scaling in plain language.
Implement the core building blocks with clear shapes, masks, losses, schedules, and edge cases.
Reason about context length, KV cache memory, batching, serving latency, fine-tuning, RAG, and evaluation.
Study Rhythm
Curriculum
The course is LLM-first: start with ML math and PyTorch, then build transformers, decoding, fine-tuning, retrieval, agents, evaluation, and production serving. The attached PDFs informed the drill topics, especially the hand-written coding questions.
Set up Python, PyTorch, notebooks, Git, experiment logs, and a reproducible local study loop.
Lab: run a tensor shape notebook and save a one-page setup note.
Linear models, logistic regression, softmax regression, KL, cross entropy, likelihood, and gradients.
Lab: derive softmax cross entropy and implement it with stable logits.
Tensors, broadcasting, autograd, modules, losses, normalization, optimizers, and training loops.
Lab: implement stable softmax, CE, layer norm, RMSNorm, AdamW, and clipping.
BPE intuition, vocabulary tradeoffs, embedding lookup, tied embeddings, and sequence length budgeting.
Lab: write a tiny BPE merge trainer and tokenizer for toy text.
Scaled dot-product attention, masks, MHA, GQA, MQA, FFN, SwiGLU, residual paths, and normalization order.
Lab: implement single-head attention, expand it to multi-head attention, then test a packed-document attention mask.
Learned positions, sinusoidal encodings, RoPE, ALiBi-style bias, context extension, and extrapolation risks.
Lab: apply RoPE to Q/K and test shape preservation.
Causal language modeling, teacher forcing, next-token loss, masking, perplexity, and data mixing.
Lab: train a tiny character LM and inspect failure modes.
Greedy, beam search, temperature, top-k, top-p, repetition penalty, no-repeat n-gram, stop conditions, and speculative decoding.
Lab: implement sampling helpers, then sketch when an assistant model can speed up target-model decoding.
Prefill, decode, cache layout, GQA/MQA memory savings, context windows, batching, and throughput/latency tradeoffs.
Lab: estimate KV memory for a model and batch under different context lengths and KV-head counts.
SFT, instruction tuning, preference tuning, DPO-style objectives, LoRA, adapters, and eval gates.
Lab: implement a LoRA linear layer and count trainable parameters.
Chunking, embeddings, retrieval, reranking, grounding, tool schemas, memory, and failure analysis.
Lab: build a tiny retrieval eval with exact-match and groundedness notes.
Planning, tool calls, state, retries, guardrails, multi-turn memory, and when not to use an agent loop.
Lab: design an agent trace schema and write three failure-case tests.
Unit tests, golden sets, pairwise eval, rubrics, judges, hallucination checks, safety, and regression gates.
Lab: write a small eval suite for instruction following and retrieval grounding.
Continuous batching, PagedAttention concepts, quantization, autoscaling, observability, cost, and rollback.
Lab: choose a serving plan for an interactive assistant with cost and p95 latency targets.
Explain-first coding tasks for ML math, PyTorch components, transformers, decoding, KV cache, LoRA, and BPE.
Lab: solve five prompts in 45 minutes and review edge cases.
Read the primary LLM papers and official docs in a practical order: architecture, position, efficient attention, serving, adaptation, preferences, RAG, and agents.
Lab: summarize one source into "what problem, what method, what tradeoff, what implementation test."
Implementation Spine
Stable softmax, cross entropy, BCE with logits, clipping, log-sum-exp, label smoothing, and safe masking.
LayerNorm, RMSNorm, residual links, attention, MHA, GQA, MQA, FFN, SwiGLU, RoPE, and LoRA.
AdamW, warmup cosine schedules, gradient accumulation, early stopping, EMA, eval loops, and checkpointing.
Systems Lens
Prefill is parallel over prompt tokens; decode is often memory-bandwidth bound one token at a time. KV cache turns repeated attention over old tokens into reads from cached keys and values.
Sampling settings, context packing, retrieval precision, tool schemas, and evaluation gates directly shape user-visible correctness, latency, cost, and trust.
Practice
Implement stable softmax for an arbitrary dimension. Explain why subtracting the max does not change the probabilities.
Implement scaled dot-product attention with both padding and causal masks. Explain the shape of every intermediate tensor.
Implement nucleus sampling and explain why sorting positions must be mapped back to original token IDs.
Sketch incremental decoding pseudocode. Explain how cache size scales with layers, batch, heads, sequence length, and head dimension.
Research Backbone
The course uses the PDFs as topic/index references, then fills the material from public papers and official documentation. Start with the Transformer paper, then connect each later source to a concrete PyTorch or serving exercise.
FlashAttention, PyTorch SDPA, GQA, vLLM / PagedAttention, RAG, and HELM.