"What is the single most important fact about fine-tuning LLMs regarding hardware: what is the binding constraint?" "MEMORY (VRAM), not compute. You will run out of VRAM long before you run out of FLOPs. A modern GPU can do the math for a 7B fine-tune in reasonable time; whether you can hold the working set in memory is what decides whether the job runs at all. Compute is a budget; memory is a cliff. Step over the cliff and the job doesn't go slower — it OOMs and dies." c3::ft01::recall "Name the three VRAM consumers during training." "(1) MODEL WEIGHTS — the parameters at their stored precision. (2) OPTIMIZER STATES + GRADIENTS — AdamW's FP32 master copy + first moment m + second moment v + FP16 gradient (for full FT). (3) ACTIVATIONS — intermediate forward-pass values saved for the backward pass; scales with context length, batch size, layers. Every training OOM is one of these three." c3::ft01::recall "For a 7B model, what is the weight footprint at FP16, INT8, and 4-bit?" "FP16: ~14 GB (2 bytes/param). INT8: ~7 GB (1 byte/param). 4-bit (NF4/GPTQ/AWQ/GGUF Q4): ~3.5-4 GB (0.5 bytes/param). The precision choice for the base is the single biggest VRAM lever — which is exactly why QLoRA exists (frozen 4-bit base)." c3::ft01::recall "What is the full AdamW optimizer footprint per trainable parameter, and why is it so large?" "~16 bytes per trainable param: FP16 weight (2) + FP16 gradient (2) + FP32 master copy (4) + first moment m (4) + second moment v (4). The FP32 master and two moments (12 bytes) are why full fine-tuning explodes — for a fully-trainable 7B model that's ~112 GB before any activation is stored. This is the line separating 'fine-tuning' (PEFT, cheap) from 'full fine-tuning' (a datacenter event)." c3::ft01::recall "State the rule-of-thumb training VRAM for QLoRA on a 7B model and on a 70B model, and the GPU each fits." "QLoRA (4-bit base): ~1.5-2x the 4-bit model size. 7B QLoRA ~10-16 GB -> RTX 4090 24GB ($1,500). 70B QLoRA ~48-60 GB -> 1x A100 80GB. QLoRA is the default starting method because only the ~1% adapter carries optimizer states — the frozen 4-bit base contributes none." c3::ft01::recall "State the rule-of-thumb training VRAM for FULL fine-tuning on 7B and 70B, and the GPU class each requires." "Full FT: ~16 bytes/param (weights + grads + AdamW) + activations. 7B full FT ~100-160 GB -> multi-A100 (~$50K of GPUs). 70B full FT ~1.0-1.4 TB -> 8-16x H100 multi-node. The spread between QLoRA and full FT for the same 7B model is ~10x — the price of optimizer states and full gradients." c3::ft01::recall "State the LoRA (16-bit base) rule of thumb and where 7B LoRA fits." "LoRA (16-bit frozen base): ~2-3x the FP16 model size. 7B LoRA ~18-30 GB -> A100 40/80GB, or RTX 4090 24GB with aggressive gradient checkpointing. Unlike QLoRA the base stays at FP16/BF16; unlike full FT only the ~1% adapter trains." c3::ft01::recall "What is the cost framing that makes the QLoRA-vs-full-FT choice vivid?" "Full fine-tuning a 7B needs ~$50K of H100s (multiple 80GB cards, often a node). QLoRA fine-tuning the same 7B runs on a $1,500 RTX 4090 — or free on Colab T4 for smaller bases. That's not a 20% difference; it's 'I need procurement and a budget cycle' vs 'I start tonight.' Most steering problems (FT00) don't need full FT." c3::ft01::recall "What is the three-question framework for picking a GPU class?" "(1) How big is the model? (1B/3B/7B/8B/13B/70B/405B.) (2) Full FT, or PEFT (LoRA/QLoRA)? — the 10x cost lever; default to QLoRA. (3) What context length? — the quadratic lever, most underestimated. Three numbers in, one GPU class out." c3::ft01::application "Given the three-question framework: 7B, QLoRA, 2-4K context — what GPU class?" "RTX 4090 24GB ($1,500). 7B QLoRA needs ~10-16 GB. This is the sweet spot for most real steering work — the 'I start tonight' path." c3::ft01::application "Given the three-question framework: 70B, QLoRA, 4K context — what GPU class?" "1x A100 80GB. 70B QLoRA needs ~48-60 GB (4-bit weights ~35 GB + activations). It fits comfortably on a single 80GB card." c3::ft01::application "Given the three-question framework: 7B, full fine-tuning, 4K context — what GPU class and roughly what cost?" "multi-A100 80GB (~$50K of GPUs). 7B full FT needs ~100-160 GB — ~16 bytes/param (weights + grads + AdamW) plus activations. This is the expensive path; justify it with evidence (Module FT10) before reaching for it." c3::ft01::application "A training job OOMs at step 3. You planned for a 7B QLoRA at '2K context' (~12 GB) on a 16 GB card, then loaded your real data and the longest sequences are 8K. What went wrong and what are two fixes?" "You UNDERESTIMATED CONTEXT LENGTH — naive attention is N×N, so 8K vs 2K is ~16x the attention activation memory. Fixes: (1) turn on FlashAttention 2 (quadratic->linear, effectively mandatory); (2) always size for the 99th-percentile sequence length, not the mean. Also: gradient checkpointing + lower physical batch with gradient accumulation." c3::ft01::application "Your job OOMs and you suspect batch size. What is the standard fix, and what does it cost you?" "GRADIENT ACCUMULATION: run micro-batches of size 1 or 2 and sum gradients over N steps before the optimizer step. You get the EFFECTIVE batch size of N at the PHYSICAL memory cost of 1. It costs you nothing but wall-clock time — physical batch multiplies activation memory linearly, so dropping it from 8 to 1 with grad accum of 8 cuts activations ~8x." c3::ft01::application "FlashAttention is OFF on a job with 4K+ context. What is the memory consequence and the fix?" "Naive attention materializes an N×N matrix per layer per head — DOUBLE the context, QUADRUPLE the attention activation memory. At 8K on a 7B it can exceed the weight footprint. Fix: set attn_implementation='flash_attention_2'. FlashAttention fuses the computation so memory goes quadratic->linear, plus ~20-30% faster. Effectively mandatory in 2026." c3::ft01::application "What is the inference VRAM floor for a 7B model at FP16, at 4-bit (NF4), and as a Q4_K_M GGUF — and what is added on top?" "FP16 7B ~14 GB; 4-bit (NF4) ~3.5-4 GB; Q4_K_M GGUF 7B runs in ~6 GB (incl. overhead). Add ~1-2 GB for KV cache + activations at short context (grows with context — a 70B at 32K can spend 10+ GB on KV cache alone). Inference is the FLOOR; training always costs more for the same model." c3::ft01::recall "What is gradient checkpointing, and what is the rule-of-thumb trade-off?" "Discard-and-recompute: it discards most activations during the forward pass and recomputes them during the backward pass. Rule of thumb: ~60-70% CUT in activation memory for ~30% SLOWER training. It is the cheapest GB you can buy — default to ON for anything that OOMs. Enable with gradient_checkpointing=True." c3::ft01::recall "What is AdamW 8-bit (bitsandbytes) and when does it matter?" "paged_adamw_8bit quantizes the optimizer states to 8-bit, roughly HALVING the optimizer-state footprint at negligible quality cost. For QLoRA it barely matters (adapter optimizer states are already tiny); it matters most for full FT and for LoRA with large adapter ranks. Should be your default unless you have a specific reason otherwise." c3::ft01::recall "Why does a 70B model NOT cost 10x the activation memory of a 7B (given it has ~10x the params)?" "Activation memory scales with layers × batch × seq × hidden, and hidden grows as ~params^(1/3) (not linearly). A 7B has hidden~4096/layers~34; a 70B has hidden~8900/layers~74 — only ~2x the per-token activation cost despite 10x the params. This is why 70B QLoRA (~53 GB) is only ~3.4x a 7B QLoRA (~15.5 GB) total, not 10x. The bottom-up estimator captures this; a naive linear multiplier does not." c3::ft01::analysis "For 7B full fine-tuning (~118 GB), which consumer dominates, and what is the single cheapest knob to shrink it?" "OPTIMIZER STATES + GRADIENTS dominate (~98 GB of the ~118 GB — the FP32 master + AdamW m,v + FP16 gradients over all 7B params). The single cheapest knob: SWITCH TO QLoRA. Trainable params drop from 100% to ~1%, so optimizer states collapse from ~98 GB to <0.5 GB, and total falls from ~118 GB to ~10-16 GB. Same model, ~10x cheaper. This is the entire economic argument for PEFT." c3::ft01::analysis "Why is the field rule 'QLoRA ≈ 1.5-2x the 4-bit model size' a shorthand that can mislead, and what is more trustworthy?" "The shorthand reproduces the 7B number tolerably (4-bit ~3.5 GB -> ~10-16 GB incl. overhead) but gets looser at 70B because activation overhead grows sub-linearly with params. It also conflates bare NF4 weights (~3.5 GB for 7B) with the deployed 4-bit footprint (~6 GB incl. runtime overhead). More trustworthy: a bottom-up sum of the three consumers (weights + optimizer + activations), which is what the FT01 lab builds. The multiplier is a sanity check; the sum is the plan." c3::ft01::analysis "A team budgets a single 80GB A100 for a 7B full fine-tune, reasoning '14 GB weights, plenty of room.' Why will this OOM, and what is the real budget?" "They forgot OPTIMIZER STATES in full FT. The 14 GB is the INFERENCE footprint (FP16 weights only). Training adds: FP16 gradient (14 GB) + FP32 master copy (28 GB) + AdamW m (28 GB) + AdamW v (28 GB) = ~98 GB of optimizer/grads alone, before activations (~6-18 GB). Real 7B full FT budget: ~100-160 GB -> needs MULTIPLE A100 80GB cards. The inference footprint is irrelevant to the training budget." c3::ft01::analysis "Why is Apple Silicon / MPS a viable training path for small models, and what is the catch?" "M-series Macs have UNIFIED MEMORY — the GPU and CPU share one pool, so a 64GB Mac presents ~48-58 GB of usable GPU memory with no duplication. A 7B QLoRA (~10-14 GB) fits comfortably on a 32GB Mac; a 1B QLoRA on a 16GB Mac. The catch: MPS throughput is lower than a dedicated NVIDIA card, and not every kernel is optimized. For iteration/debugging/small steering experiments, a laptop you own beats a cloud GPU you rent. First-class target for PEFT, not just a fallback." c3::ft01::analysis "Rank the five VRAM knobs by how much memory they buy you: base precision, optimizer choice, gradient checkpointing, batch size (via grad accum), FlashAttention." "Biggest lever: BASE PRECISION (FP16->4-bit quarters the weight footprint; this is QLoRA's whole point). Next: FULL FT vs PEFT (drops optimizer states ~200x by making only 1% of params trainable). Then: GRADIENT CHECKPOINTING (~60-70% activation cut for ~30% slower). Then: GRADIENT ACCUMULATION (drop physical batch 1->1, activations scale down linearly). Then: ADAMW 8-BIT (halves optimizer states, matters most for full FT). FlashAttention is separate — it changes the SCALING (quadratic->linear) rather than a flat multiplier." c3::ft01::analysis