POST-TRAINING & DISTILLATION

MODULE 3: SFT DEEP DIVE · SCENE 07

LoRA: Why Low-Rank Adaptation Works

The ΔW = BA decomposition, target-module selection, and parameter-count math for rank and target fraction.

RANK rΔW = B·A · r=1654.7M TRAINABLE (0.78% OF 7B)
W (frozen)+B·A2 · r · d PARAMS PER MATRIXd=4096, r=16: 131K vs 16.8M FULLB INIT ZERO → ΔW=0 AT STEP 1

Fine-tune updates are empirically low-rank. A stays Gaussian, B starts at zero, so the pretrained function is preserved exactly when training begins.

ARCHITECTURE & FORMULATIONModule 3: SFT Deep Dive

Why low-rank adaptation works

Fine-tuning updates empirically live in low-dimensional subspaces: the change to a big weight matrix is close to low rank. LoRA exploits that by learning ΔW = B·A directly, freezing the original W and training only the small factors.

The Factorization

For a d×d weight matrix, full fine-tuning trains d² parameters; LoRA trains 2·r·d. With d=4096 and r=16, that is ~0.4% of the original.

Initialization

A starts Gaussian, B starts at zero — so ΔW = 0 at step one and the pretrained function is preserved exactly when training begins.

Scaling α

The update is scaled by α/r. Changing rank without re-tuning α silently changes the effective learning rate.

MATHEMATICAL FORMULATION · TRAINABLE PARAMETER SHARE
params_lora = target_frac · params_B · 10⁹ · (4·r·d) / d², frac = params_lora / (params_B × 10³M)

For 7B params with 50% of matrices targeted at r=16, d=4096: about 5.4M trainable parameters — under 0.1% of the model.

REAL-WORLD PRODUCTION ENGINEERING
  • Target all attention projections plus MLP up/down projections for quality; attention-only LoRA underperforms on style and knowledge tasks.
  • Adapter dropout and rank-stabilized scaling (rsLoRA) are common fixes when r grows past ~64.
Agent-native web · research mode

Experimental WebMCP · evolving community-group draft, not a W3C Standard or on the Standards Track.

Native status: Initializing. Registered: none

DOM → inferred capabilities · WebMCP → declared capabilities. Tools read real CUDA/Inference Atlas content. Calls may highlight temporary UI state. No backend or remote telemetry.

Local harness verifies application logic; it does not demonstrate native discovery or a browser agent.

Input schema
{
  "type": "object",
  "properties": {
    "query": {
      "type": "string",
      "minLength": 1,
      "maxLength": 300
    },
    "limit": {
      "type": "integer",
      "minimum": 1,
      "maximum": 10
    }
  },
  "required": [
    "query"
  ],
  "additionalProperties": false
}

Local log: last 100 calls while this panel is open. Inputs may contain personal text; review before sharing.

[]