From aa28540175f39b419c3a5e4bf4b81438661bda3b Mon Sep 17 00:00:00 2001 From: jgrusewski Date: Sun, 3 May 2026 01:03:21 +0200 Subject: [PATCH] sp7(state): register loss-balance controller state slots + fix stale doc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 4 new ResetEntries × 4 slots each cover ISV[297..313). Sentinel 0 triggers Pearl A first-observation bootstrap on fold boundary, matching the existing Pearl 2/3/4/5/6/8 pattern. Also: corrected the stale sp5_budget_cql description claiming a non-existent "regime_stability allocator" (per feedback_trust_code_not_docs); clarified sp5_budget_c51 / sp5_budget_ens to reflect SP7 ownership. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../src/trainers/dqn/state_reset_registry.rs | 30 +++++++++++++++++-- docs/dqn-wire-up-audit.md | 4 ++- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/crates/ml/src/trainers/dqn/state_reset_registry.rs b/crates/ml/src/trainers/dqn/state_reset_registry.rs index 76d378d50..dfb113ffb 100644 --- a/crates/ml/src/trainers/dqn/state_reset_registry.rs +++ b/crates/ml/src/trainers/dqn/state_reset_registry.rs @@ -575,7 +575,7 @@ impl StateResetRegistry { RegistryEntry { name: "sp5_budget_c51", category: ResetCategory::FoldReset, - description: "ISV[BUDGET_C51_BASE=190..194) — per-branch C51 loss budget share (driven by flatness × (1 - BASE_IQN) × BASE_C51_SHARE). SP5 Pearl A sentinel 0 at fold boundary so the new fold's first pearl_2_budget_update launch fires the first-observation replacement (Task A3).", + description: "ISV[BUDGET_C51_BASE=190..194) — per-branch C51 loss budget share. SP7 (2026-05-03): driven by the loss-balance controller using flatness-modulated target ratio (C51/IQN ≤ 1.0×flatness). Pearl A sentinel 0 at fold boundary; consumer-side bootstrap = C51_BOOTSTRAP_BUDGET = 0.05 in fused_training.rs::compute_adaptive_budgets. (Pearl 2 no longer writes this slot post-SP7.)", }, RegistryEntry { name: "sp5_budget_iqn", @@ -585,12 +585,12 @@ impl StateResetRegistry { RegistryEntry { name: "sp5_budget_cql", category: ResetCategory::FoldReset, - description: "ISV[BUDGET_CQL_BASE=198..202) — per-branch CQL loss budget share (zero in Pearl 2; CQL gating remains under the existing regime_stability allocator). SP5 Pearl A sentinel 0 at fold boundary (Task A3).", + description: "ISV[BUDGET_CQL_BASE=198..202) — per-branch CQL loss budget share. SP7 (2026-05-03): driven by the loss-balance controller (`loss_balance_controller_kernel`) using flatness-modulated target ratio (CQL/IQN ≤ 2.0×(1−flatness)). Pearl A sentinel 0 at fold boundary; consumer-side bootstrap = CQL_BOOTSTRAP_BUDGET = 0.02 in fused_training.rs::compute_adaptive_budgets.", }, RegistryEntry { name: "sp5_budget_ens", category: ResetCategory::FoldReset, - description: "ISV[BUDGET_ENS_BASE=202..206) — per-branch ensemble loss budget share (1 - IQN - C51 - CQL, clamped to ≥0). SP5 Pearl A sentinel 0 at fold boundary (Task A3).", + description: "ISV[BUDGET_ENS_BASE=202..206) — per-branch ensemble loss budget share. SP7 (2026-05-03): consumer reads with sentinel-aware bootstrap = ENS_BOOTSTRAP_BUDGET = 0.02; Ens is currently not actively driven (no loss-balance target ratio defined for Ens vs IQN). Pearl A sentinel 0 at fold boundary. (Pearl 2 no longer writes this slot post-SP7.)", }, RegistryEntry { name: "sp5_flatness", @@ -617,6 +617,30 @@ impl StateResetRegistry { category: ResetCategory::FoldReset, description: "ISV[Q_VAR_PER_BRANCH_BASE=222..226) — per-branch Q-value variance (mean over batch×branch-actions). SP5 Pearl A sentinel 0 at fold boundary (Task A1).", }, + // SP7 (2026-05-03): loss-balance controller per-branch + // Wiener-state EMAs. Both halves of the Pearl A contract + // (sentinel 0 at fold boundary so the controller's + // `old_budget < EPS_DIV` cold-start branch fires). + RegistryEntry { + name: "sp7_lb_diff_var_cql", + category: ResetCategory::FoldReset, + description: "ISV[LB_DIFF_VAR_CQL_BASE=297..301) — per-branch EMA of (candidate_cql − old_cql)² used as Wiener α numerator for the CQL budget controller. SP7 Pearl A sentinel 0 at fold boundary so α resets cleanly when budgets re-bootstrap.", + }, + RegistryEntry { + name: "sp7_lb_sample_var_cql", + category: ResetCategory::FoldReset, + description: "ISV[LB_SAMPLE_VAR_CQL_BASE=301..305) — per-branch EMA of (cql_norm)² used as Wiener α denominator for the CQL budget controller. SP7 Pearl A sentinel 0 at fold boundary.", + }, + RegistryEntry { + name: "sp7_lb_diff_var_c51", + category: ResetCategory::FoldReset, + description: "ISV[LB_DIFF_VAR_C51_BASE=305..309) — per-branch EMA of (candidate_c51 − old_c51)² used as Wiener α numerator for the C51 budget controller. SP7 Pearl A sentinel 0 at fold boundary.", + }, + RegistryEntry { + name: "sp7_lb_sample_var_c51", + category: ResetCategory::FoldReset, + description: "ISV[LB_SAMPLE_VAR_C51_BASE=309..313) — per-branch EMA of (c51_norm)² used as Wiener α denominator for the C51 budget controller. SP7 Pearl A sentinel 0 at fold boundary.", + }, // SP5 Task A1: Wiener-state companion reset. The wiener_state_buf // now covers SP4 (71 producers × 3 = 213 floats) + SP5 (110 × 3 = 330 // floats) = 543 floats total. The SP5 triples start at offset 213. diff --git a/docs/dqn-wire-up-audit.md b/docs/dqn-wire-up-audit.md index e1efd28bb..9709f2550 100644 --- a/docs/dqn-wire-up-audit.md +++ b/docs/dqn-wire-up-audit.md @@ -3881,7 +3881,9 @@ extended. No producer kernel yet — that arrives in the next commit. (docstring polish in commit `sp7(isv): refresh SP5_PRODUCER_COUNT docstring for T1 slot growth`) **Subsequent landings** (this entry will be extended commit-by-commit): -- T2: state-reset registry entries. +- T2 (commit ⟨pending⟩): 4 SP7 ResetEntries + corrected `sp5_budget_cql` + description (was claiming a non-existent "regime_stability allocator") + + clarified `sp5_budget_c51`/`sp5_budget_ens` to reflect SP7 ownership. - T3: kernel `.cu` file. - T4: build.rs cubin manifest. - T5: trainer struct + launcher fn.