The model had Omega>1 (profitable trade selection) but MaxDD 41-50% (catastrophic drawdown timing), causing negative total returns despite winning trades. Root cause: zero reward gradient between 0% and 25% DD. The only drawdown consequence was the hard capital floor at 25% which terminates the episode with reward=-10. Fix: compute_drawdown_penalty() in trade_physics.cuh — smooth linear ramp from 0 at dd_threshold (2%) to -5.0 at the capital floor (25%). Applied every step, not just at trade exit, so the model learns to reduce position size DURING drawdowns. - Added compute_drawdown() and compute_drawdown_penalty() to trade_physics.cuh - Wired dd_threshold and w_dd from config through to CUDA kernel - Added to all 3 TOML profiles (smoketest, localdev, production) Early results: MaxDD dropped from 88.9% → 36.6% by epoch 3. Q-values went negative in drawdown states — the model is learning. 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;