d_value_logits, d_adv_logits (+ MSE/CQL scratch): bf16 → f32 - Native atomicAdd(float*) replaces atomicAddBF16 CAS loop - Eliminates bf16 accumulation overflow in gradient kernels - Gradient value clamping ±100 removed (unnecessary with f32) - NaN guards removed from loss kernels Architecture: - f32 d_logits for gradient accumulation (atomicAdd-safe) - bf16 staging buffers (d_value_logits_bf16, d_adv_logits_bf16) cast via f32_to_bf16_kernel before backward dW GemmEx - dqn_saxpy_f32_kernel for gradient blending (MSE+C51 alpha) - CQL backward uses bf16 staging after f32→bf16 cast Remaining intermittent NaN (~1/2000 steps on long runs): - Source: bf16 params_buf weight precision loss → forward pass - Fix: f32 master weights (next commit) 895/895 unit + 359/359 ml-dqn tests pass. 9-11/11 smoke tests (intermittent NaN on 50-epoch runs). Co-Authored-By: Claude Opus 4.6 (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;