pub struct BakeHyper {Show 35 fields
pub steps_a: usize,
pub steps_b: usize,
pub l1_init: f64,
pub l1_step: f64,
pub eval_every: usize,
pub lr_a: f64,
pub lr_b: f64,
pub tau: f32,
pub fcd_layers: usize,
pub batch: usize,
pub fcd_batch: usize,
pub seed: u64,
pub target_sparsity: f64,
pub l1_mult: f64,
pub mask_init: f32,
pub softplus_l1: bool,
pub checkpoint_accuracy: bool,
pub checkpoint_min_accuracy: Option<f64>,
pub checkpoint_min_balanced_accuracy: Option<f64>,
pub checkpoint_raw_priority: bool,
pub align: usize,
pub uniform_inter: bool,
pub focus_tokens: Vec<u32>,
pub focus_follow_tokens: Vec<u32>,
pub answer_span: Option<AnswerSpan>,
pub mask_logits: Option<Vec<Vec<f32>>>,
pub soft_fold: bool,
pub fcd_attn: bool,
pub fcd_sgd: bool,
pub through_attn: bool,
pub checkpoint_dir: Option<String>,
pub held_tags: Option<HeldTags>,
pub mask_linear: bool,
pub lin_l1: f64,
pub lin_logits: Option<Vec<Vec<f32>>>,
}Expand description
Hyper-parameters — defaults are the certified recipe.
Fields§
§steps_a: usize§steps_b: usize§l1_init: f64§l1_step: f64§eval_every: usize§lr_a: f64§lr_b: f64§tau: f32§fcd_layers: usize§batch: usizeIndependent fixed-length records per optimizer step. The loss is normalized over all focused targets in the batch.
fcd_batch: usizeFocused records per cached final-FFN optimizer step. This is separate
from batch because Phase A stores every layer’s activations while a
one-layer FCD cache stores only two hidden vectors per record.
seed: u64§target_sparsity: f64Target sparsity (0..1). When >0, the best checkpoint must have at least this fraction of neurons pruned; if none qualifies the highest-sparsity checkpoint is used.
l1_mult: f64L1 aggression multiplier: scales both l1_init and l1_step.
1.0 = harder pruning push, <1.0 = softer.
mask_init: f32Effective unlooped mask logit at step zero. The per-visit value is solved so that the product over loop visits equals sigmoid(init). 2.0 preserves the native recipe; 4.0 reproduces the older DTG-MA trading notebooks’ near-identity start.
softplus_l1: boolPenalize softplus(logit), whose derivative is sigmoid(logit), instead of penalizing sigmoid(logit) itself. This reproduces the older DTG-MA recipe and avoids an extra (1-sigmoid) attenuation near an open gate.
checkpoint_accuracy: boolSelect Phase-A checkpoints by held-out hard balanced accuracy when focused class tokens are configured. Otherwise held-out PPL remains the checkpoint metric.
checkpoint_min_accuracy: Option<f64>Optional strict lower bound for a focused checkpoint’s raw accuracy. A checkpoint is eligible only when its measured accuracy is greater than this value. This lets callers impose a natural-distribution majority guard instead of selecting from a balanced holdout.
checkpoint_min_balanced_accuracy: Option<f64>Optional strict lower bound for focused balanced accuracy. Combined
with checkpoint_min_accuracy, this prevents a majority-only mask
from becoming the shipped specialist.
checkpoint_raw_priority: boolWhen a joint accuracy guard is configured, rank eligible checkpoints by raw accuracy first, then balanced accuracy and PPL. The historical balanced-first selector remains the default for compatibility.
align: usizeRound each layer’s kept-neuron count UP to a multiple of this (0/1 = off). 32 keeps the defragged FFN on grouped codecs (in % 32 == 0) and SIMD kernels off their scalar tails.
uniform_inter: boolForce one FFN width across all layers (the max aligned count) — the whole-token GPU graphs require a uniform intermediate size.
focus_tokens: Vec<u32>When non-empty, LM loss is accumulated only where the next token is one of these ids. The whole chunk is still forwarded as context. This is useful for supervised corpora with a long input and a one-token answer, where ordinary all-token LM loss would drown the task signal in prompt reconstruction.
focus_follow_tokens: Vec<u32>Optional token(s) that must immediately follow a focused target.
Supervised ChatML uses the one-token label followed by <|im_end|>;
this prevents label names mentioned inside the user instruction from
being mistaken for answer positions.
answer_span: Option<AnswerSpan>Score the assistant’s answer span of each chat record instead of
every token (or one-token labels). Exclusive with focus_tokens.
mask_logits: Option<Vec<Vec<f32>>>Start Phase A from these mask logits (one row per virtual layer,
e.g. a previous run’s archaeology selected_logits) instead of
the uniform init — so a mask trained once can be FCD-polished
again, or Phase A resumed, in a separate run (--steps-a 0 keeps it).
soft_fold: boolPatent 2 Soft-Fold compilation: the neurons that survive τ keep their LEARNED gain σ(m) (folded into down_proj by the writer) instead of being snapped to 1. Evaluation and Phase B then run that exact function (σ(m) above τ, 0 below), so what is scored is what ships.
fcd_attn: boolFull-layer FCD: Phase B also trains the attention projections (q/k/v/o, the projected head gate) and both norm gains of the FCD layers — the notebook’s “unfreeze the last N layers entirely”.
fcd_sgd: boolPhase B with plain SGD under the same global-norm clip, the DTG-MA
notebooks’ FCD (lr 2e-4–5e-4), instead of Adam. Adam’s first step
moves every trained weight by about lr_b; clipped SGD moves all of
them together by at most lr_b in L2.
through_attn: boolPhase A’s mask backward also runs through every frozen attention (and GDN) branch, as autograd does in the DTG-MA notebooks: the mask can then shape what a later position reads from an earlier one (a coefficient copied from the prompt into the answer). Off = the older, cheaper gradient along the residual and FFN path only.
checkpoint_dir: Option<String>Write every Phase-A evaluation’s mask logits to
<dir>/phase-a-step-<n>.json as it happens (a --mask-from input),
so a long run survives being stopped.
Tags of the held records (in held order before the length sort): held scores then report per-tag verdict accuracy and gate on its macro average.
mask_linear: bool--mask-scope linear: the mask sits on the output rows of every
projection (GDN in-projections and out_proj, q/k/v/o, gate, up, down —
the DTG-MA notebooks’ DTGMALinear) instead of on the FFN neurons;
the FFN neuron gates stay open. CUDA resident step only.
lin_l1: f64The notebooks’ sparsity term for mask_linear: λ · the mean over
projections of each projection’s mean gate.
lin_logits: Option<Vec<Vec<f32>>>A previous run’s linear_logits (per layer, FcdModel::lin_modules
order) to start from.