200f05fcefa0ff51fef85b5a66bd7b5dab3e28fc
Root cause from train-v8ztm 10-ep validation (commit1396b62ec): HEALTH_DIAG showed alpha_smoothed=0.0002 (vs ~0.5 expected steady-state), gate1=closed, var_aux:var_q ratio 290:1 — symptoms of an EGF producer chain firing < 1% as often as the consumer. The original B.11 wire-up (commit857722e77) placed `launch_sp14_q_disagreement_update`, `launch_sp14_alpha_grad_compute`, and the prerequisite `launch_sp13_aux_dir_metrics` in `process_epoch_boundary` — which runs ONCE per epoch (single call site at training_loop.rs:780, called from the per-epoch loop, not from the per-step loop in `run_training_steps_slices`). The captured backward consumer `launch_sp14_scale_wire_col` (inside launch_cublas_backward_to, replays every training step via parent graph) reads ISV[ALPHA_GRAD_SMOOTHED=393] per step, but the producer was firing only at epoch boundary — every step inside the epoch observed (steps_per_epoch − 1)-step-stale alpha values, with the EMA chain barely accumulating past sentinel between rare per-epoch updates. The plan §2550 explicitly specifies per-step cadence; the existing wire violated the plan. Fix (atomic, graph-capture-safe): - MOVED launch_sp13_aux_dir_metrics, launch_sp14_q_disagreement_update, launch_sp14_alpha_grad_compute from process_epoch_boundary into fused_training.rs:submit_aux_ops, immediately after populate_q_out. submit_aux_ops captures into the aux_child sub-graph, so each parent-graph replay re-fires the full producer chain — restoring per-step cadence. - launch_sp13_aux_dir_metrics had to migrate alongside the SP14 launches: alpha_grad_compute_kernel consumes its outputs (ISV[373/374]); leaving sp13 per-epoch while moving SP14 per-step would re-introduce the same staleness bug for aux_dir_acc reads (atomic dependency migration per feedback_no_partial_refactor). - Per-epoch launch_sp14_gradient_hack_detect circuit breaker stays in process_epoch_boundary — its lockout decrement IS one-per-epoch by design. - Forward consumers (6 launch_sp14_dir_concat_qaux sites) and backward consumers (2 launch_sp14_scale_wire_col sites) unchanged — they read the same ISV[393], but now see live per-step values instead of per-epoch staleness. Verification: - cargo check -p ml --tests --all-targets clean (no errors, no new warnings). - All 6 SP14 oracle GPU tests pass (alpha_grad_adaptive_beta, alpha_grad_schmitt_hysteresis, dir_concat_qaux_correct, gradient_hack_circuit_breaker_fires, q_disagreement_all_hold_no_contribution, q_disagreement_k4_k2_mapping). - HEALTH_DIAG validation pending L40S re-dispatch — expect alpha_smoothed to track real EGF-driven values (~0.5 in steady state). Invariants: - pearl_no_host_branches_in_captured_graph (kernels are pure GPU state machines using launch_builder + pre-loaded CudaFunction; no per-call load_cubin) - feedback_no_partial_refactor (sp13 + 2 SP14 launches migrated atomically) - feedback_wire_everything_up (all 3 producers now production hot-path, re-fire on every parent-graph replay) - feedback_isv_for_adaptive_bounds (no warmup_gate parameter — variance- driven k_aux/k_q in alpha_grad_compute_kernel handles cold-start adaptively, perc0fc28e45) Refs: train-v8ztm trajectory analysis 2026-05-07T15:59:49 HEALTH_DIAG[10] showed dir_entropy=0.6545 kill-fast breach with model converging to 64% Hold + 84% Quarter magnitude — exactly the pathology B.11 was designed to prevent by routing aux's directional signal into Q. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…
…
…
Foxhunt
Production HFT trading system in Rust.
Architecture
The workspace contains 32 crates organized as follows:
Core Libraries (16)
| Crate | Purpose |
|---|---|
trading_engine |
Order processing, FIX 4.4, IB TWS, SIMD, RDTSC timing |
risk |
VaR, Kelly, circuit breakers, kill switches, compliance |
risk-data |
Risk data types and shared structures |
trading-data |
Trading data types |
ml |
DQN Rainbow, PPO, TFT, Mamba2, ensemble inference |
ml-data |
ML data types and feature definitions |
data |
Market data ingestion and storage |
backtesting |
Replay engine, strategy tester |
adaptive-strategy |
Ensemble execution, microstructure analysis |
common |
Shared types, resilience, error handling |
storage |
S3 and local model storage |
model_loader |
Model serialization and loading |
market-data |
Market data feed handlers |
database |
PostgreSQL access layer (SQLx) |
config |
Configuration management |
tli |
CLI commands and tooling |
Services (8)
| Service | Purpose |
|---|---|
backtesting_service |
gRPC backtesting service |
broker_gateway_service |
FIX routing, broker connectivity |
trading_service |
Core trading operations |
ml_training_service |
Model training orchestration |
data_acquisition_service |
Market data acquisition |
trading_agent_service |
Autonomous trading agents |
api_gateway |
gRPC API gateway with auth |
web-gateway |
Axum REST + WebSocket gateway |
Frontend
web-dashboard/ -- React 19 + TypeScript + Vite + TradingView charts.
Building
# Check compilation (no PostgreSQL required)
SQLX_OFFLINE=true cargo check --workspace
# Run tests for a specific crate
SQLX_OFFLINE=true cargo test -p <crate> --lib
# Clippy
SQLX_OFFLINE=true cargo clippy --workspace
ML Models
Four production model architectures on Candle v0.9.1 with CUDA:
- DQN Rainbow -- Deep Q-Network with prioritized replay, dueling heads, noisy nets
- PPO -- Proximal Policy Optimization with GAE and LSTM policies
- TFT -- Temporal Fusion Transformer for multi-horizon forecasting
- Mamba2 -- State space model for sequence prediction
Each model has a standalone trainer and a UnifiedTrainable adapter for the hyperopt pipeline.
Infrastructure
- Git: Gitea at
git.fxhnt.ai(Tailscale-only), Scaleway DEV1-S - Observability: OpenTelemetry OTLP (env
OTEL_EXPORTER_OTLP_ENDPOINT) - Database: PostgreSQL with SQLx offline mode for CI
License
Proprietary. All rights reserved.
Description
Languages
Rust
88.2%
Cuda
7.7%
Python
1.3%
Shell
1.1%
PLpgSQL
0.8%
Other
0.8%