Skip to main content

Module skillbake

Module skillbake 

Source
Expand description

Native DTG-MA skill bake (Patent 2) — no Python, no torch.

The certified recipe of converter/make_skill_l1fcd.py, in Rust on the FcdModel f32 replica:

  • Phase A — a trainable L1 mask over FFN neurons (one logit per neuron, applied to the input of down_proj as σ(m)): pure LM loss on the task corpus + a progressive L1 penalty. Every 30 steps the binarized mask (σ>τ) is scored on held-out chunks; the best checkpoint — the denoising bottom — is restored at the end. Pruning noise neurons IMPROVES the model before it starts to hurt.
  • Phase B — FCD: the FFN of the last N layers trains against the same LM loss with the hard mask active (cosine LR), held-out gated, best checkpoint restored.

Attention (softmax and GDN alike) is FROZEN and carries no gradient — exactly like the reference recipe (torch.no_grad() around the attention branch): the backward walks the residual stream through the FFN chain only, which is what makes a pure-Rust backward small.

Structs§

AnswerSpan
Supervised chat records scored on the assistant’s answer only: every target from the first token after start (the rendered generation prompt, e.g. <|Bot|></think>) through the first end token (the turn terminator) carries the LM loss; the prompt is context. This is the multi-token sibling of focus_tokens — a JSON verdict, a number, a sentence — where a one-token label does not fit.
AttnGrads
Their gradients (f64 accumulators), same shapes.
AttnMasters
Trained attention + norm masters of a full-layer FCD layer (f32).
BakeArtifacts
The trained artifacts: everything the defrag writer needs, f32.
BakeCheckpoint
BakeHyper
Hyper-parameters — defaults are the certified recipe.
BakeReport
What the bake measured and produced.
HeldTags
Held records’ tags (e.g. the benchmark family of each validation record): the names, and one name index per held record.
TokenText
Decoded text per token id (see AnswerSpan::values).

Functions§

answer_targets
The scored target range (first, last) (inclusive, indices into ids) of one record, or None when the record carries no answer.
answer_values
The target positions of each top-level value of the JSON object an answer span holds ({"q1": "option_24", "q2": 3} → two groups), in order. A token overlapping a value’s characters belongs to it, so a token that merges a quote with the label’s first letters is graded with the label. Positions are indices into ids, within first..=last.
mask_init_logit
mask_init_logit_for
Mask logit at step zero, solved for the loop depth.
mask_step_scale
Learning-rate scale for the mask step, given the loop depth.
replica_score_file_mask
Score a WRITTEN specialist through the replica’s own math (f32 dequant of whatever the file carries) with the file’s binary mask held hard — the decomposition probe that tells “the requant at write cost the quality” from “the runtime applies the mask differently”. Returns (bare, masked) held-PPL over the chunks.
skill_bake
The whole recipe. log receives progress lines.