CUDA kernel: cooperative_load_tile() + matvec_leaky_relu_shmem() cache weight matrices in shared memory (SRAM), reducing HBM traffic 32x (1.76TB→55GB). Block size increased to 256 threads for better SHMEM utilization. Trainer hot-path: replace to_vec2 full-tensor CPU readbacks with GPU-native flatten_all/min/max/mean_all (4 scalar readbacks). Merge two Q-diagnostic forward passes into one. Deferred max_priority flush (1 GPU→CPU sync/epoch instead of ~8/batch). Fix StagedGpuBuffer::flush() dimension mismatch: used raw experience state.len() (45) instead of gpu.state_dim() (48 aligned), causing slice_scatter crash [500,48] vs [n,45] when CPU experiences flush into GPU-aligned replay buffer. Fix hardcoded state_dim=48 in optimal_n_episodes() — now uses dynamic state_dim from network config (correct for OFI-enabled 56-dim states). Dynamic episode auto-scaling guard: only auto-scale when gpu_n_episodes≥128 (production), respecting explicit test overrides (gpu_n_episodes=2). Tests: 874 ml + 392 ml-dqn = 1266 pass, 0 fail. Co-Authored-By: Claude Opus 4.6 <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;