774d7552a08e72f1415a5ee869f799290ee4c821
Smoke smoke-test-gwfn8 on fd24b5383 showed mean(|reward|) hitting
5054 at F0 ep2 despite all known multiplicative modifiers being
structurally bounded (conviction in (0,1) via sigmoid at line 7579,
cf_flip in +/-1, drawdown in [-5*w_dd,0], shaping_scale in [0,1]). The
inflater is somewhere in the pre-composition or modifier chain that
isn't currently visible in HEALTH_DIAG.
Adds 12 per-sample diagnostic buffers + reduction kernel + HEALTH_DIAG
emit for min/mean/max at every checkpoint in the reward chain:
- per-component (r_popart, r_trail, r_micro, r_opp_cost, r_bonus)
- r_weighted (post-composition, pre-modifier)
- post-modifier sequential (post_dd, post_inv, post_churn, post_conv)
- sanity checks (position_abs, conviction)
Implementation:
- 12 new per-sample CudaSlice<f32> buffers in gpu_experience_collector
(alloc_episodes * alloc_timesteps each); zero-init at every (i,t)
in the kernel entry block before any early-return; written at
each checkpoint with NULL-tolerant guards.
- new reward_chain_diag_reduce_kernel.cu: single-block 256-thread
block-tree-reduce over the 12 buffers, three lockstep reductions
(sum/min/max) per buffer in shared memory; outputs 36 floats
(3 stats x 12 buffers) to a 36-slot mapped-pinned scratch buffer
on the trainer; no atomicAdd per feedback_no_atomicadd, pure GPU
compute per feedback_no_cpu_compute_strict, mapped-pinned host
visibility per feedback_no_htod_htoh_only_mapped_pinned.
- trainer: cubin load, mapped-pinned 36-f32 output, set_sp11_reward_
chain_diag_bufs setter, launch_sp11_reward_chain_diag_reduce
launcher, read_sp11_reward_chain_diag host accessor.
- training_loop.rs: wires the 12 collector buffers post-construction
(mirror of the popart-component wire-up); HEALTH_DIAG `reward_
chain_diag` emit added immediately after `reward_split` — launches
reduction kernel, syncs stream, reads the 36 floats.
- build.rs: adds reward_chain_diag_reduce_kernel.cu to the cubin
manifest.
- docs/dqn-wire-up-audit.md: new section documenting the
instrumentation scope, additions, exclusions (no ISV slots, no
state-reset registry entries), and removal plan.
No state-reset registry entry: this is a transient diagnostic, not
persistent state — buffers reset to 0 every step via the kernel
entry-block default writes (same pattern as the other per-sample
diagnostic buffers like trail_triggered_per_sample). No ISV slots
are added: the host reads the mapped-pinned scratch directly to keep
this lightweight and avoid permanent ISV growth.
Will be removed in a follow-up commit once the inflater is identified
and properly fixed per pearl_bounded_modifier_outputs_require_
structural_activation.
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%