Animated Deepdives
The Backward Pass
First-principles, illustrated deep dives into how modern AI models are built, trained, and scaled.
Showing all 75 articles
Blog Series
The VLM Architecture Gallery
Seventy-one architectures on one standardized plate, from gated cross-attention to encoders absorbed into the base model.
Teaching Language Models to See
Why a good vision encoder plus a good LLM is not yet a VLM: freezing, data mixtures, resolution, objectives and data quality in real pretraining recipes.
How Vision-Language Models Scale
How compute splits between a VLM's two towers, what vision, data, fusion and visual-token scaling studies show, and what open VLMs spend.
One Model, Many Visual Skills
How visual instruction tuning turns a pretrained VLM into one assistant: loss masking, task mixtures, format conflicts, forgetting and synthetic data.
Measuring What a VLM Can Do
What a VLM benchmark score really measures: task, data, metric and protocol, the main benchmarks by capability, and how to read a results table.
Aligning Vision-Language Models
How to teach a vision-language model to prefer answers the image supports: hallucination, image-conditioned DPO, negatives, AI judges and safety.
When Language Must Point
How VLMs show where they see: points, boxes, polygons and masks, coordinate tokens versus SAM-style decoders, granularity, grounded reasoning and metrics.
How VLMs Read Documents
How VLMs turn a page into text and structure: OCR pipelines, OCR-free parsers, token budgets, output formats, tables, reading order and evaluation.
Seeing in Time
How video VLMs sample, encode, time-stamp and compress frames, find moments, and why many video benchmarks can be solved from a single frame.
Rewarding What the Model Sees
What a verifiable reward looks like for images: IoU, OCR and execution rewards, which weights RL changes, reward hacking, and zero-advantage groups.
Thinking With Images
Why a VLM that looks once cannot think its way back to lost pixels, and how zooming, visual search, verification and tools make perception a compute axis.
VLMs That Act
What changes when a VLM's image is a screen it can change: observations, grounding as clicking, action spaces, trajectories, RL, evaluation and safety.
From VLMs to VLAs
How vision-language models become robot policies: action tokens, chunking, FAST, flow-matching experts, dual systems, data, RL and evaluation.
The Cost of a Picture
Where an image's inference cost goes in a vision-language model, and how token compression, small models, quantization and serving cut it.
Searching With Pixels
How multimodal retrieval finds the right image, page or frame, from CLIP and VLM embedders to ColPali late interaction, rerankers and cited visual RAG.
What Happens Inside a VLM
How to look inside a vision-language model: which visual tokens it uses, where image information flows into the answer, and when it ignores the image.
Models That See and Draw
How one model can both read and draw images: image tokenizers, meaning versus pixels, bridge, autoregressive and hybrid designs, and evidence on synergy.
How the Open VLM Families Were Built
A family-by-family survey of how open VLMs were built: data, encoders, resolution, training stages, RL, compute, and what actually drove capability.
PyTorch From First Principles
Build a neural network and its training loop from raw PyTorch: strides, broadcasting, autograd, losses, optimizers and hooks, each checked against torch.
The Hugging Face Stack
Run one training job through Transformers, Datasets, Trainer, Accelerate, PEFT and TRL, and check each layer against a raw PyTorch loop, number by number.
Build Attention From Scratch
Build attention in PyTorch from one head to MHA, GQA, MLA and tiled online softmax, with tests against SDPA and measured benchmarks.
Build a Modern LLM From Scratch
Build a Llama-style language model in PyTorch, step by step, inspect every tensor, then match Hugging Face logits and run real SmolLM2 weights.
Train an LLM From Scratch
Build a complete LLM pretraining system in PyTorch, from raw text to token shards, a resumable loader, AdamW, accumulation, bf16, exact resume, MFU, DDP and failure guards.
Post-Train an LLM
Take one pretrained model through SFT, DPO and GRPO. Write each loss by hand, inspect every mask, check most losses against TRL, PEFT and Hugging Face and the rest by hand, and break it on purpose.
Build a Vision-Language Model From Scratch
Assemble a working vision-language model from SigLIP and SmolLM2: image processor, projector, feature scattering, labels, masks, tiling, generation and save_pretrained, with every tensor inspected.
Train a Real VLM
Train a vision-language model in code: projector alignment, multimodal pretraining, task mixtures, text replay, tiling, packing, LoRA placement, grounding and per-task evaluation.
Post-Train a VLM
Post-train SmolVLM-256M in code: hallucination negatives on synthetic images, image-conditioned DPO, a blind-preference check, visual GRPO, freeze ablation and reward hacking.
Build an Agent Harness From Scratch
Build a coding agent from an eight-line loop: tools, validation, sandboxes, permissions, edit formats, compaction and an event log, each tested and measured.
Add Memory and Context Engineering to the Agent
Give the C10 agent working, episodic, semantic and procedural memory, a token budget and compression, then test whether memory causally improves its work.
Train an Agent With Reinforcement Learning
Build a filesystem environment, clone a scripted expert, watch distribution shift break it, then train the agent online with GRPO, real rewards and failure injection.
Building Grounded Document Intelligence
A text representation of documents that loses nothing, and grounding with masks instead of typed coordinates by joining a VLM (what) and SAM (where) end to end, connected in a closed loop.
REPLICA: Visually Faithful Document Reconstruction
Why converting a page to text loses information, and how REPLICA rebuilds it as faithful HTML with agents, checks the render, and generates training data.
Grounding Document Answers With Masks
M3Grounder grounds document answers as pixel masks: a VLM writes a token per cited span and SAM draws phrase, line and block masks, trained end to end.
Grounding Every Step of a Document Answer
DoCoG grounds every step of a document chain of thought with pixel masks, using a module between the language model and SAM and mask-safe preference training.
DocLayout-VL: Hierarchical, Open-Set, Promptable Document Layout Segmentation
DocLayout-VL treats layout as a tree of masks: a VLM writes the tree, HGC attends along it, SAM draws each region, in any vocabulary.
The Agent Evaluation Playbook
How to evaluate trajectories, state changes, reliability, safety, graders, budgets, and long-horizon failures.
What Autograd Actually Does
Backpropagation and autograd from scalar chain rules to Jacobian products, saved tensors, and checkpointing.
Why Transformers Do Not Explode
Initialization, residual paths, normalization, optimizer dynamics, precision, and the signatures of unstable training.
Choosing the Next Token
Temperature, search, truncation, penalties, grammars, and contrastive generation organized around entropy.
Teaching a Language Model to Follow Instructions
Supervised fine-tuning as behavior cloning: data construction, loss masking, distribution shift, and capability change.
How LoRA Changes a Model Without Rewriting It
Why low-rank updates work, how LoRA and QLoRA spend memory, and when adapters lose to full fine-tuning.
Inside an AI Agent Harness
The agent harness as a system: context assembly, action protocols, verification, containment, budgets, and event state.
Memory Is More Than Context
Working, episodic, semantic, procedural, and reflective memory as one bounded context-allocation problem.
How Multi-Agent Systems Actually Coordinate
When multiple agents beat one: diversity, specialization, topology, communication cost, orchestration, and failure modes.
Reinforcement Learning for Agents From First Principles
Reinforcement learning for agents: environments, reward design, credit assignment, horizons, and rollout systems.
How Attention Moves Information
Why attention exists, how Q, K, and V arise, and how the same operation becomes MHA, GQA, sliding windows, linear attention, MLA, and multimodal attention.
The Puzzle of Overparameterization
Interpolation, double descent and its limits, benign overfitting, implicit bias, function space, grokking, and what any of them explain about LLMs.
How LLMs Are Pretrained
Where pretraining data comes from, what survives curation, how mixtures and sequences are constructed, and how teams decide whether the recipe worked.
Mixing Data Without Losing Capabilities
Why tasks interfere, how sampling weights become loss weights, how to measure transfer, and what to do when a capability regresses.
How Language Models Learn to Use Tools
How models discover available tools at runtime, decide whether to call one, produce valid arguments, retrieve schemas, and learn from executable feedback.
The Making of an AI Agent
What changes when tool calls become a stateful loop: trajectory data, imitation versus RL, long-horizon credit assignment, memory, harnesses, and environments.
What Changed Inside the Transformer?
What changed between the original Transformer and today’s Llama, Qwen, DeepSeek, and GLM-class models—one design pressure at a time.
Scaling Laws from First Principles
Where C = 6ND comes from, why tokens per parameter is not a constant, and how to plan a large run from small experiments.
Reinforcement Learning from First Principles
Policy gradients, baselines, advantages, GAE, trust regions, and PPO derived first, then translated into language-model rollouts.
Teaching a Model What We Prefer
How comparisons become reward, why RLHF needs a KL leash, and how the same objective turns into DPO’s direct loss.
How Reinforcement Learning Teaches Models to Reason
What changes when answers can be checked automatically: verifiers, GRPO, DeepSeek-R1, exploration, and the limits of short RL runs.
Thinking in Tokens
Why a familiar Transformer can buy serial compute by writing, what reasoning traces reveal, and when longer thought makes answers worse.
How Models Improve Without Changing Their Weights
Longer chains, more samples, search, and verifiers—plus why the best inference budget depends on the prompt rather than one global setting.
How to Find What Is Slowing Your Model
A practical method for reading timelines and counters, using PyTorch Profiler and Nsight, diagnosing Roofline regimes, and testing optimization hypotheses.
The Serving Playbook
Continuous batching, paged KV, prefix caching, chunked prefill, disaggregation, distributed serving, speculative decoding, and goodput under SLOs.
The Mechanics of LLM Inference
Why inference becomes a different machine: autoregression, prefill, decode, KV cache, batching, bandwidth, latency metrics, quantization, and multimodal workloads.
The Parallelism Playbook
The six things a training workload can split, from DDP and ZeRO/FSDP through tensor, pipeline, context, expert, and hybrid parallelism.
Inside a Training Step
A first-principles walkthrough of tensor shapes, forward and backward passes, FLOPs, activation lifetimes, optimizer states, memory accounting, and checkpointing.
Talk Is Not Cheap
What changes when data is no longer local: PCIe, NVLink, NVSwitch, RDMA, topology, collective communication, and overlap.
Why Fast GPUs Still Wait for Memory
Arithmetic intensity and the Roofline model derived from first principles, then applied to GEMM, attention, fusion, optimizers, and real ML kernels.
Why GPUs Are Built for Deep Learning
Why CPUs and GPUs spend their transistor budgets differently—and how execution hierarchy, latency hiding, memory access, tiling, and Tensor Cores follow from that choice.
Inside a Modern Vision Encoder
What changed in the visual half of VLMs: intake geometry, resolution, objectives, connectors, and the encoders models actually ship.
One Transformer, Two Modalities
A block-by-block comparison: tokenizing versus patchifying, lookup tables versus projections, positions, masks, and heads.
An Image Is a Sentence
How Vision Transformers see, from the first patch embedding through ViT, DeiT, PVT, Swin, video transformers, and the cost of attention.
Across the CNNVerse
Thirty years of convolutional architecture, from sliding-window arithmetic and receptive fields to ResNet, EfficientNet, and ConvNeXt.
Evolution of ML Architectures
Sixty-seven years of neural architectures, including how information moves, what training costs, what inference carries, and how gradients flow backward.
How Models Know Where They Are
Absolute, sinusoidal, relative, RoPE, NoPE, 2D and Fourier features, and multimodal M-RoPE—explained visually.
What an Optimizer Actually Does
A mechanical tour from SGD to Muon: how optimizers build an update, what their state costs, and where a training step stalls.
The Geometry of Normalization
Every normalization layer from BatchNorm to Peri-LN, plus why the modality interface in a VLM is a normalization problem.
Why Neural Networks Need Nonlinearity
From sigmoid and ReLU to GELU, SwiGLU, and squared ReLU—with animated derivations and a map of what modern models use.