LESSON 5.2 · Engineering · 130 min

SFT: rewrite behavioral priors with demonstrations

SFT: rewrite behavioral priors with demonstrations. Learn instruction data, masks, packing, and chat templates and complete: Run a small LoRA SFT. Part of the “Make the Model an As

Learning objectives

  1. Explain what problem “SFT: rewrite behavioral priors with demonstrations” solves without hiding behind terminology.
  2. Trace the variables and causal links across instruction data, masks, packing.
  3. Complete “Run a small LoRA SFT” and judge the result with evidence rather than intuition.

Core concepts

instruction data

instruction data is part of the lesson’s causal model. State its inputs, outputs, invariants, and failure mode; then verify it with a hand-check or a minimal experiment before moving to an optimized implementation.

masks

masks is part of the lesson’s causal model. State its inputs, outputs, invariants, and failure mode; then verify it with a hand-check or a minimal experiment.

packing

packing is part of the lesson’s causal model. State its inputs, outputs, invariants, and failure mode; then verify it with a hand-check or a minimal experiment.

and chat templates

and chat templates is part of the lesson’s causal model. State its inputs, outputs, invariants, and failure mode; then verify it with a hand-check or a minimal experiment.

Build and verify

Run a small LoRA SFT

  • Predict: write the expected output, trend, or failure before running code.
  • Build: implement only the minimum components needed to answer the question.
  • Verify: compare with a baseline or trusted implementation; save seeds, parameters, and raw outputs.
  • Transfer: change one shape, dataset, scale, or workload condition and explain whether the conclusion still holds.

Open the complete interactive lesson