jgrusewski d6d846f896 cleanup(gems): delete G6/G10 scaffolding — 263 LOC of measured-sub-noise dead code
Follow-up to commit 1961857c2 (which unwired G6/G10 from the training loop
based on V7-gem measurement showing their penalties were sub-noise). That
commit left the kernels, Rust wrappers, buffers, and readback accessors in
place as scaffolding — intended for "easy re-wire if future evidence changes".

Post-unification multi-trial results (commit 69211af40 + N=5 trials this
session) confirm G6/G10 decisions were sound:
  - Best Sharpe median: 32.4 (session baseline: ~18) — 1.8× improvement
  - q_gap median: 2.6 (baseline: 0.05-0.4) — 6× better action separation
  - sharpe_ema mean: +16.7 (baseline: often negative)

With the unification landed and dramatically improved training dynamics, the
G6/G10 scaffolding is now clear dead weight. Delete with confidence per
V7 methodology (measure, then commit to the decision).

Removed:
  - branch_independence_penalty kernel definition (.cu, ~50 LOC)
  - temporal_consistency_penalty kernel definition (.cu, ~55 LOC)
  - branch_indep_kernel / temporal_consistency_kernel fields + loads
  - branch_indep_penalty_buf / temporal_per_sample_buf /
    temporal_penalty_buf allocations + field declarations + Self init
  - compute_branch_independence() / compute_temporal_consistency() fns (~70 LOC Rust)
  - branch_indep_loss_value() / temporal_loss_value() readback accessors
  - read_gem_losses() tuple → read_gem_g12_loss() f32 (simplified call site)

Kept:
  - G12 predictive_coding_loss + predictive_coding_backward kernels
    (real, measurable 6× variance reduction — commits e72885e8b, 69211af40)
  - predictive_loss_value() readback + HEALTH_DIAG `gems [g12_predictive=X]`
  - unified_env_step_core shared helper (commit a3b6bc2f3)

Net: −263 LOC across 4 files. No behavior change — the scaffolding had been
unwired since commit 1961857c2; this just removes the now-unused definitions.

Verified: cargo check + smoke test pass (Best Sharpe 35.73 single-trial
post-cleanup, 24.7–38.3 across 5 multi-trial runs).

Memory trail: see feedback_v7_gem_methodology.md — 3-step process
(identify signal / check better-form / measure empirically) applied across
G6/G10/G12 produced 3 different correct decisions, validating the process.

Files touched:
  crates/ml/src/cuda_pipeline/experience_kernels.cu      (−132 / +8)
  crates/ml/src/cuda_pipeline/gpu_dqn_trainer.rs         (−120 / +11)
  crates/ml/src/trainers/dqn/fused_training.rs           (−10 / +3)
  crates/ml/src/trainers/dqn/trainer/training_loop.rs    (−1 / +1)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-21 11:28:07 +02:00

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
No description provided
Readme 849 MiB
Languages
Rust 88.2%
Cuda 7.7%
Python 1.3%
Shell 1.1%
PLpgSQL 0.8%
Other 0.8%