Files
foxhunt/crates/ml
jgrusewski 657d7b49ec perf: dual graph forward (MSE-only) + NaN-safe scale kernel
Two optimizations:

1. Dual CUDA graph: graph_forward_mse skips C51 loss/grad/SAXPY blend
   during MSE warmup (c51_alpha=0). Eliminates 7 kernel invocations
   from the graph replay. replay_forward() routes by alpha automatically.

2. NaN-safe dqn_scale_f32_kernel: writes 0.0 directly when alpha==0
   instead of multiplying (IEEE 754: 0*NaN=NaN). Defense-in-depth for
   the C51 gradient buffer which can contain NaN from random logits.

Fold 3 epoch: 5.08s → 4.92s (under 5s target).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 20:58:54 +02:00
..

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 aggregation
  • hyperopt — PSO-based hyperparameter optimization with per-model adapters
  • trainers — unified training loops (DQN, PPO, supervised)
  • inferenceInferenceAdapter trait for prediction
  • checkpoint — model checkpointing and restoration
  • evaluation — walk-forward evaluation pipeline

Usage

use ml::dqn::DQN;
use ml::ppo::PpoTrainer;