v7 smoke (train-fv4s8, commit 23b89a90e) eval pod hit
CUDA_ERROR_ILLEGAL_ADDRESS at fold 0:
Error: DQN fold 0 GPU evaluation failed: GpuBacktestEvaluator::evaluate
failed for fold 0: Model error: eval_done_event synchronize:
DriverError(CUDA_ERROR_ILLEGAL_ADDRESS, "an illegal memory access was encountered")
The {:#} anyhow chain fix from Phase 8.3+9 made the failure mode visible.
Diagnosis from code (no second smoke needed): the closure-based
evaluate() path never sets b0_size..b3_size, leaving them at the
default 0. env_step kernel's decode_*_4b helpers do action/(b1*b2*b3)
→ divide-by-zero → garbage decoded indices → out-of-bounds memory
read → CUDA_ERROR_ILLEGAL_ADDRESS at next event-sync.
The production `evaluate_dqn_graphed` path sets b-sizes via
`ensure_action_select_ready` (which also lazy-allocates intent buffers
the closure path doesn't need). The closure-based `evaluate()` path
used by eval-baseline never calls it.
Fix:
1. Add pub fn `GpuBacktestEvaluator::set_branch_sizes(&mut self,
dqn_cfg: &DqnBacktestConfig)` — sets b0..b3_size only, no
buffer allocation.
2. Add defensive guard in `evaluate()` that bails with
`MLError::ConfigError` if any b-size is zero. Future regressions
produce a clear error instead of an opaque CUDA illegal-address.
3. Wire `set_branch_sizes(&dqn_cfg)` call in
`evaluate_dqn_fold_gpu` between `DqnBacktestConfig::from_network_dims`
and the closure-based `evaluator.evaluate(...)`.
Pearls honoured:
- feedback_no_hiding: zero-b-size now surfaces as ConfigError
rather than CUDA illegal-address downstream
- feedback_no_partial_refactor: closure-path was a partial wire-up
from pre-factored-action days; set_branch_sizes brings it into
parity with the CUBLAS production path for action decoding
- pearl_no_deferrals_for_complementary_fixes: v7's chain-exposing
fix surfaced this; lands immediately not after another smoke
Verification:
cargo check -p ml --example evaluate_baseline --features cuda # clean
Note on PPO/supervised paths:
Their evaluate() calls also lack set_branch_sizes and will now
trip the defensive guard. Those paths haven't actually run eval
since STATE_DIM grew past 54 — the silent failure mode had been
masking it. Future Phase will either wire their action conventions
(PPO: 5-exposure; supervised: signal thresholds) or delete the
dead paths per feedback_no_partial_refactor.
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;