64298b34c0525c93b79428bceac38ea58c42dcb8
A7 (commit 4f13e2ca3) wired only 3 of 8 param-groups; the 5 aux-trainer
groups returned None from param_group_buffers and silently skipped.
Without this fix-up, Layer B's atomic flip would route IQN/IQL/Attn/
Curiosity Adam clamps to silently-zero ISV bounds → consumer
.max(EPS_CLAMP_FLOOR=1.0) → 1.0 clamp → catastrophic over-clamp on
aux-trainer params.
Architectural choice per A7's DONE_WITH_CONCERNS report: Option 3 (thread
aux-trainer buffers through the launcher's signature, FusedTrainingCtx
supplies them) over hoisting the launcher onto FusedTrainingCtx.
Accessors added (mirroring SP3 close-out v2's IQN online_params_ptr
template):
- IQN: online_grad_ptr/len (the only one missing — others added in v2)
- GpuIqlTrainer: full set (params/grads/adam_m/adam_v × ptr/len)
- GpuAttention: same full set
New types in gpu_dqn_trainer.rs:
- Sp4ParamGroupBufs { params_ptr, grads_ptr, adam_m_ptr, adam_v_ptr,
count } — one trainer's quartet, all four buffers same length.
- SP4AuxBuffers { iqn, iql_high, iql_low, attn } — 4-tuple (no
curiosity; see hold-out below).
Launcher signature changed:
- launch_sp4_param_group_oracles_all_groups(&self) →
launch_sp4_param_group_oracles_all_groups(&self, &SP4AuxBuffers).
- param_group_buffers(group, aux) consults aux for groups 3-6, the
existing main-DQN slicing for groups 0-2.
FusedTrainingCtx::build_sp4_aux_buffers() — anticipatory helper (Layer B
will consume; lint-suppressed until then) that constructs SP4AuxBuffers
from gpu_iqn / gpu_iql / gpu_iql_low / gpu_attention. Optional aux
trainers (gpu_iqn / gpu_attention) emit zero-count placeholders when
None so the launcher's count == 0 short-circuit silently skips.
DONE_WITH_CONCERNS — group 7 (Curiosity) is the architectural hold-out:
GpuCuriosityTrainer stores params/grads/Adam state as four separate
[w1, b1, w2, b2] sub-buffers (non-contiguous). A single (params_ptr,
count) tuple cannot describe the slice. Resolving this requires either
a per-layer launch loop (4× kernel cost) or a contiguous-flat re-layout
of the trainer; both are deeper architectural changes scoped beyond
A7's fix-up. ParamGroup::Curiosity still returns None, the launcher
silently skips, and Layer B must guard against ISV[143/151/159/167]
being the natural-zero floor for Curiosity-related clamps via
.max(EPS_CLAMP_FLOOR=1.0).
Test surface unchanged — the existing kernel-direct unit test
sp4_param_group_oracle_per_group_writes_distinct_isv_slots already
iterates g_idx ∈ 0..SP4_PARAM_GROUP_COUNT=8 with synthetic Box-Muller
buffers, validating all 8 groups at the kernel level. The fix-up only
changes the production launcher's API; the launcher has no callsite
yet (Layer B will add it).
cargo check -p ml --lib --tests clean. Test binary compiles.
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%