Wave 4.2 (ef08611d3) landed cuRAND Kaiming-He weight reset as orphan-
with-tests-only. Phase 3.5.4.c creates the production caller and the
action-selection consumer atomically per spec lines 4346-4448.
Production caller in gpu_experience_collector.rs step 4-pre (BEFORE
experience_action_select):
- fan_in = cfg.adv_h = 128 (CORRECTED from Wave 4.2's audit-doc
error claiming 6528 = adv_h × num_atoms; that's total weight
count of one branch's projection, not per-unit input dim. Per
feedback_trust_code_not_docs the audit-doc error is also fixed
inline in this commit.)
- n_weights = branch_0_size × num_atoms × adv_h = 4 × 51 × 128 =
26112 (default config). Resets last 10% = 2611 directional
advantage-head weights via cuRAND curand_normal × sqrt(2/128) ≈
0.125 stddev (was wrongly documented as 0.0175).
- Branch: w_b0out (directional) only — plasticity is about
escaping stuck-in-flat regimes; targeted at directional choice.
- Seed: mix_seed(Phase-3.5.4.c-unique base) ^ t per-step
deterministic source; same (FOXHUNT_SEED, t) always yields the
same Kaiming-He samples per kernel thread.
- Trainer exposes target via new pub fn sp15_w_b0out_target()
returning (dev_ptr, n_weights, fan_in); collector consumes via
new set_sp15_plasticity_target(); training_loop wires the two.
OR-gate consumer in experience_action_select:
- New kernel arg float plasticity_m_warm threaded into the
cooldown-mask code path.
- Wave 1.B's cooldown_active = (cooldown_remaining > 0) extended
to cooldown_active = (cooldown_remaining > 0) ||
(plasticity_warm_remaining > 0).
- Flat-on-fire-bar detection — option (a), warm ≥ m_warm − 1.5f
per the trigger-then-decrement convention. The kernel sees
warm = m_warm − 1 on the fire bar; subsequent warm-up bars
observe warm ≤ m_warm − 2. New if (plasticity_fire_bar) branch
BEFORE the existing else if (cooldown_active) branch — the
fire-bar gets DIR_FLAT, subsequent warm bars get DIR_HOLD via
the OR-gate cooldown.
Two-step recovery semantics:
- Bar T (fire): plasticity launches → ISV[436]=1, ISV[438]=
m_warm then decrements to m_warm−1. action_select detects
fire-bar → dir_idx = DIR_FLAT.
- Bars T+1..T+M_warm−1 (warm): action_select OR-gate forces
dir_idx = DIR_HOLD.
- Bar T+M_warm: warm transitions to 0, OR-gate inactive, normal
Thompson/argmax resumes.
When the production caller is unwired (test scaffold path):
plasticity_m_warm passes 0.0f, the kernel's fire-bar predicate is
dead (warm == 0 too), and the OR-gate degenerates to cooldown-only
— bit-identical to the pre-3.5.4.c behaviour. Existing 3 SP15
3.5.b/3.5.3.b action_select oracle tests pass unchanged at
m_warm = 0.0f.
New behavioral oracle test plasticity_fires_force_flat_then_cooldown_
holds verifies the full sequence on RTX 3050 Ti with M_warm = 5
(shrunk from production's 200 for test runtime): bar 0 → DIR_FLAT,
bars 1-3 → DIR_HOLD, bar 4 (warm boundary) → DIR_LONG. ISV side-
effects (fired flips 0→1 then debounces, warm decrements with
underflow guard) verified bar-by-bar.
Eval/backtest path passes m_warm = 0.0f because plasticity is a
training-only mechanism (during deterministic eval the weights must
remain frozen at their checkpoint values).
Atomic per feedback_no_partial_refactor: kernel + caller + consumer +
trainer plumbing + 4 launcher-call-site updates (1 production
collector + 1 eval-path + 2 test scaffolds) + new behavioral test +
audit-doc fan_in inline correction + new audit-doc entry all in this
commit. No fallback. SP15 Phase 3.5 recovery-dynamics chain is now
end-to-end production-wired (3.5.2 + 3.5.3 + 3.5.4 + 3.5.4.c +
3.5.5 + 3.5.5.b all firing).
Verified: cargo check -p ml --features cuda clean; cargo check -p ml
--features cuda --tests clean; CUDA_COMPUTE_CAP=86 cargo test -p ml
--test sp15_phase1_oracle_tests --features cuda -- --ignored
--nocapture 34 of 34 SP15 oracle tests green (5 plasticity + 3
action_select + 3 cooldown + 23 others); cargo test -p ml --features
cuda --lib HOLDS the Wave 4.3 baseline (946 pass / 13 fail) on RTX
3050 Ti — no new regressions.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
ml
10-model ML ensemble for the Foxhunt HFT system, built on Candle v0.9.1.
Models
- DQN (Rainbow) — deep Q-network with prioritized replay, dueling heads, noisy nets
- PPO — proximal policy optimization with GAE, LSTM policies, clip-higher
- TFT — temporal fusion transformer for multi-horizon forecasting
- Mamba2 — state space model for sequence prediction
- Liquid Networks — biologically inspired networks for non-stationary data
- TLOB — transformer-based limit order book analysis
- KAN — Kolmogorov-Arnold networks
- xLSTM — extended LSTM architecture
- TGGN — temporal graph neural network
- Diffusion — diffusion-based generative model
Key Modules
ensemble— model ensemble coordination and confidence aggregationhyperopt— PSO-based hyperparameter optimization with per-model adapterstrainers— unified training loops (DQN, PPO, supervised)inference—InferenceAdaptertrait for predictioncheckpoint— model checkpointing and restorationevaluation— walk-forward evaluation pipeline
Usage
use ml::dqn::DQN;
use ml::ppo::PpoTrainer;