Lessons
136 lessons in ai · advanced · page 5 of 6
- AIadvanced
The LLM Threat Model: Why the Model Cannot Defend Itself
Guardrails exist because a language model cannot reliably distinguish instructions from data. This lesson builds the threat model: the OWASP Top 10 for LLM Applications, direct and indirect prompt injection, jailbreaks, data leakage, and why tool-using agents turn a content problem into a security one.
9 steps·~14 min - AIadvanced
LIME and SHAP: Attributing a Single Prediction
Two methods dominate local explanation, and both perturb the input. LIME fits a small interpretable model near one prediction. SHAP borrows the Shapley value from game theory and is the unique attribution satisfying local accuracy, missingness and consistency. This lesson builds both mechanisms, compares KernelSHAP with TreeSHAP, and is precise about what a SHAP value does not mean.
11 steps·~17 min - AIadvanced
Gradients, Counterfactuals, and Whether to Trust an Explanation
When a model is differentiable you can attribute a prediction with calculus instead of sampling. This lesson covers plain saliency, Integrated Gradients and its axioms, Grad-CAM, then counterfactual explanations, which answer what would have to change rather than what mattered. It closes with the evidence that explanations can fail or be deliberately faked, and a protocol for checking yours.
12 steps·~18 min - AIadvanced
Training Energy-Based Models
Training an EBM means shaping an energy landscape so real data sits in valleys, but the intractable partition function blocks plain maximum likelihood. This lesson covers the push-down-push-up principle, contrastive methods (contrastive divergence, noise-contrastive estimation), score matching, and the regularized alternative that avoids sampling entirely.
8 steps·~12 min - AIadvanced
EBMs as a Unifying Lens
Why LeCun treats energy as the common language of machine learning. This lesson shows how classification, generative models, self-supervised learning, JEPA, and diffusion all read as energy-based models, ties the contrastive-versus-regularized split back to self-supervised learning, and gives an honest account of where explicit EBMs help and where they do not.
8 steps·~12 min - AIadvanced
Energy Landscapes: The EBM View
Energy-based models replace input-to-output functions with a scalar energy that scores how compatible a configuration is. This lesson covers the energy function, inference as finding the lowest-energy answer, the energy landscape picture, the link from energy to probability via the partition function, and why this framing handles problems with many valid answers.
8 steps·~12 min - AIadvanced
Beyond Negatives: Non-Contrastive and Masked Methods
How to prevent collapse without negative samples. This lesson covers distillation methods (BYOL, SimSiam) that rely on stop-gradients and asymmetry, regularization methods (Barlow Twins, VICReg) that constrain the embedding's statistics, and the masked-modeling family (MAE, BERT), then ties them to JEPA and the energy-based view.
8 steps·~12 min - AIadvanced
Contrastive Learning
The first family to make joint-embedding self-supervised learning work: pull together two views of the same image, push apart different images. This lesson covers the InfoNCE loss, SimCLR and its reliance on large batches, MoCo's momentum encoder and queue, why negatives block collapse, and the practical costs that motivated negative-free methods.
7 steps·~11 min - AIadvanced
From I-JEPA to V-JEPA: World Models and Planning
The JEPA idea becomes concrete in I-JEPA on images and V-JEPA 2 on video. This lesson covers the multi-block masking that makes I-JEPA work, how an action-conditioned video model becomes a world model, and how predicting representations enables planning by model-predictive control instead of a fixed policy.
8 steps·~12 min - AIadvanced
Inside a JEPA: Encoders, Predictors, and Collapse
Predicting a learned representation invites a trivial cheat: represent nothing. This lesson opens the JEPA machine, the context encoder, target encoder, and predictor, shows the training loop in code, explains why representation collapse is the central danger, and how asymmetry, stop-gradient, and an EMA target defeat it without negatives.
8 steps·~12 min - AIadvanced
Why Predict Representations, Not Pixels
Self-supervised learning has three families: reconstruct the input, contrast augmented views, or predict in a learned embedding space. This lesson explains why the third, the joint-embedding predictive approach behind JEPA, sidesteps both wasted capacity on unpredictable pixels and hand-crafted augmentation biases.
8 steps·~12 min - AIadvanced
Diffusion language models: generating text all at once
How diffusion was rebuilt for discrete text: masked diffusion instead of Gaussian noise, parallel refinement instead of token-by-token decoding, the speed economics that make it attractive, and the honest trade-offs against autoregressive transformers.
8 steps·~12 min - AIadvanced
Flow matching: straightening the path from noise to data
The reframing that took over frontier image generation: learn a velocity field that transports noise to data along direct paths. Conditional flow matching, rectified flow, why straight trajectories mean fewer sampling steps, and how diffusion becomes a special case.
7 steps·~11 min - AIadvanced
Guidance and samplers: steering diffusion and making it fast
How raw denoisers become text-to-image systems: conditioning, classifier-free guidance and the CFG scale, latent diffusion, the sampler zoo from DDPM to DDIM and beyond, and the distillation techniques that cut a thousand steps down to a few.
7 steps·~11 min - AIadvanced
Diffusion models: learning to create by learning to denoise
How diffusion models generate images and more: the forward process that destroys data with noise, the reverse process that learns to undo it, the surprisingly simple training objective, and the network backbones (U-Net, DiT) that make it work.
8 steps·~12 min - AIadvanced
Sparse autoencoders: reading the features hidden inside a neural network
Why neurons are polysemantic, how the superposition hypothesis explains it, and how sparse autoencoders use dictionary learning to pull a model's activations apart into monosemantic, steerable features, plus the failure modes and the top-k and gated fixes.
12 steps·~18 min - AIadvanced
Speculative decoding: making LLM inference faster without changing the output
How draft-then-verify decoding gets multiple tokens per forward pass of a large model, why rejection sampling makes it provably lossless, and where the draft comes from (small models, Medusa heads, self-speculation, EAGLE trees).
12 steps·~18 min - AIadvanced
Loop engineering: verification, orchestration, and anti-patterns
Make loops trustworthy. Adversarial verification panels, sub-agent orchestration, loop-until-dry for unbounded discovery, loop-until-budget for paid depth, multi-modal sweeps with diverse prompts, eval-driven cap selection, and the five anti-patterns — silent caps, infinite plans, drift, premature termination, thrashing — that ship to prod more than they should.
9 steps·~14 min - AIadvanced
RL in Reasoning Models: How o1, DeepSeek-R1, and Friends Think
A deep look at how reinforcement learning on chains-of-thought powers o1, DeepSeek-R1, Claude reasoning, and Gemini Thinking — covering GRPO, MCTS-style search, test-time compute scaling, and distillation into smaller models.
13 steps·~20 min - AIadvanced
RLVR and GRPO: Training LLMs with Verifiable Rewards
How Group Relative Policy Optimization turns unit tests and theorem provers into training signals — the technique behind DeepSeek-R1's leap in math and code reasoning without a reward model.
12 steps·~18 min - AIadvanced
Direct Preference Optimization: DPO, IPO, KTO, and SimPO
A deep dive into DPO (Rafailov et al. 2023) and its successors — how they reformulate RLHF as a classification problem, the math behind the implicit reward, and where each variant wins or loses against PPO-based pipelines.
12 steps·~18 min - AIadvanced
RLHF: From Christiano 2017 to InstructGPT to the Offline Era
Trace the full arc of Reinforcement Learning from Human Feedback — preference data, Bradley-Terry reward models, PPO with KL penalty, reward hacking, and why most labs have moved to offline alternatives like DPO and RAFT.
12 steps·~18 min - AIadvanced
Reinforcement Learning in 2026: Where It Ships and Where It Stalls
An honest map of RL in 2026 — the domains where it actually reaches production (LLM post-training, robotics policies, ad bidding, RLHF, reasoning models) and the places where it still cannot reliably cross the lab-to-deployment gap.
12 steps·~18 min - AIadvanced
Context Engineering for Long-Running Agents
How to manage, compress, and strategically fill the context window in long-horizon agents — covering summarization checkpoints, scratchpad memory, retrieval injection, prompt caching, and compaction triggers.
12 steps·~18 min

