From ac7c52b5bec64c289796363fd438be2ce42a643e Mon Sep 17 00:00:00 2001 From: jgrusewski Date: Wed, 20 May 2026 23:27:18 +0200 Subject: [PATCH] feat(crt-train): add SMOOTHNESS_LAMBDA_RATIO const in heads.rs --- crates/ml-alpha/src/heads.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/crates/ml-alpha/src/heads.rs b/crates/ml-alpha/src/heads.rs index 8bf0202be..c179c8651 100644 --- a/crates/ml-alpha/src/heads.rs +++ b/crates/ml-alpha/src/heads.rs @@ -24,6 +24,20 @@ pub const PROJ_DIM: usize = 8; /// HEAD_MID_H define in `cuda/multi_horizon_heads.cu`. pub const HEAD_MID_DIM: usize = 64; +/// Per-horizon multiplier for the output-smoothness regularizer (CRT.train +/// intervention A). λ[h] = `smoothness_base_lambda × SMOOTHNESS_LAMBDA_RATIO[h]`, +/// computed at `PerceptionTrainer` construction and uploaded once to the +/// device buffer `smoothness_lambda_d`. Ratio scales with horizon length +/// to force slow horizons (h6000) to change ~200× more slowly than fast +/// ones (h30). See `docs/superpowers/specs/2026-05-20-crt-train-output-smoothness-design.md` §3.1. +pub const SMOOTHNESS_LAMBDA_RATIO: [f32; N_HORIZONS] = [ + 1.0, // h30: K_h / K_min = 30 / 30 + 100.0 / 30.0, // h100: ≈ 3.333 + 300.0 / 30.0, // h300: = 10.0 + 1000.0 / 30.0, // h1000: ≈ 33.333 + 6000.0 / 30.0, // h6000: = 200.0 +]; + #[derive(Clone, Debug)] pub struct HeadsWeights { pub w: Vec, // [5, 128] row-major