Open Source

GPU Training Lab

Production-grade ML training notebooks. DPO, RLHF, LoRA, Diffusion, Audio, Vision — all runnable for free on Kaggle T4x2 or Google Colab.

44
Notebooks
23
Serving track
Free
GPU Required
Will it fit? → Model + GPU + conversation length. Does it fit, and how many people can talk to it at once? The Serving Console → The full model: throughput, TTFT and cost per million tokens — with every step of the arithmetic shown.
Preference Datachosen vs rejected
SFTinstruction tuning
DPO / RLHFalignment
EvaluationLLM-as-Judge
Deployed Modelaligned & evaluated
ServingvLLM · quantized · speculative

How DPO Works

DPO skips reward modeling and RL entirely. It trains the model directly on human preference pairs using a reformulation of the RLHF objective.

Old Way: RLHF (3 stages)

1 Collect preference data
2 Train a reward model
3 Run PPO to align LLM
Complex, unstable, slow

New Way: DPO (1 stage)

1 Collect preference data
2 Train LLM directly on pairs
_
Simple, stable, fast
loss = -log( sigmoid( β · [ log(P/P_ref)_chosen - log(P/P_ref)_rejected ] ) )

β controls conservatism. Higher β = model stays closer to the original.

THE BRIDGE Train → Serve Quality Gates

From Fine-Tune to Production

The missing link between training and serving: the artifact contract, merge-vs-adapter, a quality regression gate built before you optimize, quantize-then-re-gate, a serving config derived from capacity math, the SLO gate at N−1, and rollback triggers.

Runs on: CPU (no GPU) • also tools/e2e_pipeline.py as a CI release gate
START HERE Diagnostic No GPU

The Serving Playbook

The front door to the 23-notebook serving track. Paste your metrics and get a ranked diagnosis with the evidence for each finding, an ordered plan budgeted by accuracy risk and effort, a verification checklist, and a self-test that asserts the track's shared physics.

Runs on: CPU (no GPU) • Start here if you have a symptom
DPO KTO ORPO SimPO Free GPU

Alignment Showdown: DPO vs KTO vs ORPO vs SimPO

Train the same model with 4 different alignment methods. Compare quality AND training performance side by side.

Model: Qwen2.5-0.5B • Stack: LoRA + DeepSpeed ZeRO-2
RLHF DPO LoRA ZeRO-3 Free GPU

Full Alignment Pipeline: SFT → DPO → RLHF

The complete 3-stage alignment pipeline on Qwen2.5-0.5B. SFT teaches instruction following, DPO aligns offline, PPO/RLHF aligns online.

Model: Qwen2.5-0.5B • Stack: LoRA + ZeRO-3 (model parallelism)
LoRA QLoRA Full Fine-Tune Free GPU

LoRA vs QLoRA vs Full Fine-Tuning

Train all 3 methods on the same model and data. Compare GPU memory, speed, and output quality side by side.

Model: TinyLlama 1.1B • Comparison: 100% vs ~1% params
DPO LoRA Free GPU

DPO Training from Scratch

Direct Preference Optimization on TinyLlama. Learn how DPO works by training it yourself with real preference pairs.

Model: TinyLlama 1.1B • Stack: TRL DPOTrainer + LoRA
DPO DeepSpeed Ray LoRA

Distributed DPO with DeepSpeed & Ray

Production-grade distributed training. Same code scales from 1 GPU to 100 GPUs with Ray Train orchestration.

Stack: TRL + LoRA + DeepSpeed ZeRO-2 + Ray Train
SFT + DPO DeepSpeed LoRA Free GPU

Free Distributed SFT + DPO

Two-stage alignment on free Kaggle GPUs. SFT teaches instruction following, then DPO aligns with preferences. Auto-detects your hardware.

Platform: Kaggle 2xT4 (free) • Stack: Accelerate + ZeRO-2
Vision LoRA QLoRA DPO Free GPU

Multimodal Fine-Tuning: LoRA + QLoRA + DPO

Fine-tune LLaVA 7B vision-language model. LoRA in 8-bit, QLoRA in 4-bit, then DPO to prefer detailed image descriptions.

Model: LLaVA 1.5 7B • Pipeline: LoRA → QLoRA → DPO → Merge
Diffusion LoRA Multi-GPU Free GPU

Stable Diffusion LoRA Fine-Tuning

Teach Stable Diffusion a new style or concept. LoRA on UNet attention layers — tiny adapters (~1MB), same results.

Model: SD 1.5 (860M UNet) • Method: LoRA on attention layers
ViT LoRA ZeRO-2 Free GPU

Image Classification with Vision Transformer

LoRA fine-tune ViT-base on Food-101. A text transformer that reads image patches instead of words.

Model: ViT-base 86M • Data: Food-101 (101 categories)
Audio LoRA ZeRO-2 Free GPU

Audio: Whisper Speech Recognition

Fine-tune Whisper-small for speech-to-text with LoRA. Multi-GPU with DeepSpeed on freely available FLEURS data.

Model: Whisper-small 244M • Data: FLEURS English (500 examples)
VLM LoRA ZeRO-2 Free GPU

Multimodal VLM Training

Fine-tune Qwen2-VL-2B on image+text data with LoRA and multi-GPU acceleration.

Model: Qwen2-VL-2B-Instruct • Stack: LoRA + ZeRO-2
Full Fine-Tune ZeRO-3 Free GPU

Full Fine-Tuning (No LoRA)

Actually train all 124M parameters of GPT-2 end-to-end. ZeRO-3 shards the entire model across GPUs + CPU.

Model: GPT-2 124M • Data: OpenWebText subset
LoRA ZeRO-2 Free GPU

Simple Multi-GPU Training (Starter)

The simplest possible distributed fine-tuning notebook. GPT-2 + LoRA + DeepSpeed on 500 Alpaca examples. Start here.

Model: GPT-2 124M • Data: 500 Alpaca examples
Benchmark DDP ZeRO-2 ZeRO-3 Free GPU

Multi-GPU Benchmark: 1 vs 2 GPU Strategies

Run identical training with DDP, ZeRO-2, and ZeRO-3. See exactly how much speedup and memory savings each gives you.

Configs: 1GPU • 2GPU DDP • ZeRO-2 • ZeRO-3
SFT DPO LoRA Free GPU

Post-Training: Watch Every Stage Transform a Model

See a raw model become an assistant. Generate text at Base → SFT → DPO and compare side-by-side. The simplest possible explanation of post-training.

Model: Qwen2.5-0.5B • Stages: Base → SFT → DPO (all visible)
GRPO Reasoning QLoRA Free GPU

GRPO: Teach a Model to Reason (DeepSeek-R1 Method)

Train Qwen2.5-1.5B to solve math problems using pure RL. No reward model, no CoT data — just "is the answer correct?" The algorithm behind DeepSeek-R1.

Model: Qwen2.5-1.5B • Dataset: GSM8K • Algorithm: GRPO
QLoRA 4 Benchmarks 7B Model A100

Push the Limits: 7B on Colab Pro A100

QLoRA fine-tune Qwen2.5-7B on A100 40GB. 2048-token sequences, 4-bit NF4, benchmarked on 4 Open LLM Leaderboard tasks vs Llama-2, Mistral, Llama-3.

Model: Qwen2.5-7B • Benchmarks: TruthfulQA, ARC, HellaSwag, Winogrande
Full Fine-Tune TruthfulQA Benchmark Free GPU

Modern Full Fine-Tuning for Post-Training

Full fine-tuning with modern techniques: cosine LR, gradient checkpointing, weight decay. Benchmarked against TruthfulQA (Open LLM Leaderboard).

Model: TinyLlama 1.1B • Benchmark: TruthfulQA MC2
Evaluation LLM Judge VLM Judge Free GPU

LLM-as-Judge Evaluation

Evaluate model outputs using LLM and VLM judges. Three methods: automated metrics, rule-based scoring, and model-as-judge. All local, no API needed.

Models: TinyLlama + LLaVA • Method: Self-contained evaluation
Evaluation Agent Traces Retry Loop Free GPU

Multi-Trace Agent Evaluation + Retry

Treat agent reasoning as a search over executable traces. 10 strategies × 3 benchmarks (ARC / SWE / MLE-style), 5-dim weighted scoring, hybrid trace synthesis, beam-search pruning, plus a TraceEvaluator that diagnoses failures and emits concrete retry actions. Rescues 4/4 failing strategies (26/30 → 30/30).

Method: Tree-of-Thought + executable traces • Hooks: Anthropic / OpenAI / HF (optional)
Serving Measured Free GPU

Serving Fundamentals: KV Cache & Batching

The mental model behind every serving engine, measured live: prefill vs decode, KV-cache memory math (GQA/MLA), TTFT/TPOT, and a continuous-batching simulator that shows where the 2× comes from.

Model: Qwen2.5-0.5B • Method: Measured on T4 + pure-Python simulators
Serving vLLM Free GPU

vLLM: PagedAttention & a Real Server

Run the engine behind most self-hosted LLM APIs: PagedAttention explained, throughput vs Hugging Face measured, prefix caching demonstrated, then a live OpenAI-compatible server load-tested with 32 concurrent clients.

Model: Qwen2.5-0.5B • Stack: vLLM V1 engine + OpenAI SDK
Serving AWQ / GPTQ Free GPU

Quantized Serving Showdown

One model, four formats — FP16, AWQ-int4, GPTQ-int4, NF4 — benchmarked head-to-head for memory, batch throughput, single-user speed, and accuracy. Includes why the QLoRA trick is not a serving format.

Model: Qwen2.5-1.5B ×4 formats • Stack: vLLM + bitsandbytes
Serving Speculative Free GPU

Speculative Decoding & the Frontier

Losslessly faster generation: draft-model speculation (3B + 0.5B on one T4), prompt-lookup decoding, the acceptance-rate math, EAGLE-3/Medusa/MTP, and the 2025 frontier — disaggregated prefill/decode, KV infrastructure, RadixAttention.

Models: Qwen2.5-3B + 0.5B draft • Method: HF assisted generation + vLLM
Serving Interactive D3 No GPU

Serving Internals, Visualized

Four interactive D3 visualizations you can scrub and animate: a KV-memory explorer, static-vs-continuous batching as a live Gantt, the PagedAttention block pool frame by frame, and a speculative-decoding accept/reject strip.

Runs on: CPU (no GPU) • Stack: pure-Python sims + D3.js
Serving Observability No GPU

Reading the Logs: vLLM Observability

Read a serving engine line by line: the 4 startup lines that decide your capacity, the periodic stats heartbeat, Prometheus histograms (percentiles computed by hand), a triage playbook, and an animated incident where KV saturation leads TTFT by 12 seconds.

Runs on: CPU (no GPU) • Stack: log/metrics parsers + D3 dashboard
Serving Benchmark No GPU

Benchmarking, SLOs & Capacity Planning

Why most LLM benchmarks lie (closed-loop testing, means instead of tails), an open-loop Poisson load generator, finding the latency knee, goodput under an SLO, and $ per million tokens across GPUs and optimizations.

Runs on: CPU (no GPU) • Stack: queueing simulator + interactive cost explorer
Serving Structured Output No GPU

Structured Output & Guided Decoding

Build a token-masking FSM from scratch and watch a random number generator emit perfect schema-valid JSON. Then the real thing: xgrammar, guided_json, tool calling, and the traps (including how max_tokens still breaks your JSON).

Runs on: CPU (no GPU) • Stack: hand-built FSM + D3 mask viewer + vLLM
Serving Multi-GPU No GPU

Distributed & Multi-Replica Serving

Tensor parallel vs replicas, modeled and plotted against your latency SLO; the all-reduce communication tax that makes TP a within-node technique; and prefix-aware routing, which can rival a hardware upgrade for free.

Runs on: CPU (no GPU) • Stack: parallelism models + router simulation
Serving Multi-LoRA Free GPU

Serving LoRA Adapters at Scale

Fifty fine-tunes, one GPU. How batched multi-LoRA keeps the expensive GEMM shared, why max_loras is a scheduling constraint rather than a memory knob, and the tenancy economics that turn 50 GPUs into one.

Models: 1 base + N adapters • Stack: PEFT + vLLM LoRA
Serving NVIDIA + AMD No GPU

The Hardware Roofline: NVIDIA vs AMD

The roofline derived specifically for LLM inference across T4→B200 and MI210→MI355X: the exact batch size where decode stops being memory-bound, why quantization moves it, and why 192GB of VRAM changes your topology more than raw FLOPS do.

Covers: 13 GPUs, both vendors • Bonus: a microbenchmark that runs on CUDA or ROCm
Serving CUDA + HIP No GPU

Portable Kernels & Precision Matrix

What actually runs where: the precision × architecture support matrix (hardware vs framework vs tuned kernel), CUDA/HIP/Triton trade-offs, the vLLM flag translation table, and one Triton kernel that compiles for both vendors.

Runs on: CPU (no GPU) • Stack: Triton + capability probe
Serving What-If No GPU

The What-If Console

Every equation from the track consolidated into one interactive model: change GPU, precision, batch, or context and watch throughput, latency and $/1M tokens move. Includes tornado sensitivity, a Pareto frontier, and a section on where the model lies to you.

Runs on: CPU (no GPU) • 2,597 configurations precomputed
Serving Long Context No GPU

Long-Context Serving & KV Compression

The KV wall at 128k+ drawn across model families, then six ways through it: sliding-window and hybrid attention, MLA, FP8 KV, chunked prefill, and an eviction simulator showing exactly which tokens attention sinks and heavy-hitter policies throw away.

Runs on: CPU (no GPU) • Includes: eviction policy simulator + D3
Serving MoE No GPU

Serving Mixture-of-Experts

Total vs active parameters, the MoE roofline (why MoE decode is more memory-bound than dense at the same batch), expert parallelism's all-to-all cost, and a routing-imbalance simulator showing the straggler rank that sets everyone's step time.

Covers: Mixtral, DeepSeek-V3, Qwen3-MoE • Runs on: CPU
Serving RAG + Agents No GPU

RAG & Agent Serving Patterns

Agent prefill is quadratic in turns. The prompt-layout rule that decides your cache hit rate, the KV cache hierarchy, model cascades and their break-even escalation rate, and why semantic caching trades correctness for cost.

Runs on: CPU (no GPU) • Includes: five-strategy workload simulator
Serving Reliability No GPU

Production Hardening & Reliability

The cancellation leak that silently eats capacity, why bounded queues beat unbounded ones, per-tenant fairness, graceful drain and rollout math, a failure taxonomy, and a chaos drill that shows exactly where N−1 headroom stops being optional.

Runs on: CPU (no GPU) • Includes: admission-control + chaos simulators
Serving Deep Dive No GPU

Anatomy of a Decode Step

Where the milliseconds actually go inside one decode step: GEMMs, attention over KV, sampling, and the fixed launch overhead that dominates small batches. An interactive budget you can re-proportion, a map of which optimization cuts which slice, and a profiler that runs on CUDA or ROCm.

Runs on: CPU (no GPU) • Bonus: portable per-slice GPU profiler
Serving Kernels No GPU

Attention Kernels From Scratch

FlashAttention is usually explained with a picture. Here you implement it — online softmax, tiling, FlashDecoding's split-K, and PagedAttention as a one-line change to the loop — in NumPy, each verified against the naive version to machine precision. Then why FA-3's speed is Hopper-specific even though the algorithm is not.

Runs on: CPU (no GPU) • Verified: exact to ~1e-16 vs naive attention
Serving Composition No GPU

The Optimization Stack: Why Gains Don't Multiply

Four optimizations whose headline numbers multiply to 10× deliver 6× — and some pairs actively fight. A computed interaction matrix, bottleneck migration as you stack, and a search for the best stack under an accuracy-risk and effort budget.

Runs on: CPU (no GPU) • Includes: interaction matrix + effort frontier
Vision-Language Serving No GPU

VLM Serving: The Token Explosion

One image is 500–7,000 tokens. Image→token math for LLaVA / Qwen2-VL / InternVL, the four-phase pipeline including the CPU stage no GPU metric shows, why variable image sizes wreck batching, and max_pixels as the master dial.

Runs on: CPU (no GPU) • Covers: 4 VLM families
Vision-Language Optimization No GPU

VLM Optimization Techniques

Embedding and prefix caching (and the hash-stability trap), where visual token pruning happens and whether it frees KV, adaptive resolution routing, why the ViT stays fp16 while the LLM goes int4, video frame sampling — and which of these fight each other.

Runs on: CPU (no GPU) • Includes: pruning Pareto + interaction table