jgrusewski 1961857c22 gem(G6+G10): measurement says redundant — unwire (V7 methodology applied)
Empirical data from commit 61ab27ff3 across 14 captured epochs of the
TD-propagation smoke test:

  HEALTH_DIAG[N]: ... gems [g6_branch_indep=X g10_temporal=Y g12_predictive=Z]

  G10 temporal_consistency: 0.000000 to 0.000002  (essentially zero)
  G6  branch_independence:  0.000102 to 0.000273  (~1e-4)
  G12 predictive_coding:    0.07 to 9657.83       (real signal)

Verdict by V7-gem methodology — when an existing mechanism already
covers the signal, wiring backward adds gradient noise without value:

  G10: spectral_norm (already wired on all 12 weight tensors) enforces
       a global Lipschitz constraint that subsumes per-pair Lipschitz on
       similar-state pairs. Cosine similarity between consecutive h_s2
       samples is almost never > 0.95 anyway. Penalty value is below
       floating-point noise.

  G6:  NoisyNets injects different parameter noise per layer; the 4
       advantage branches are already 99.99% diverse. Penalty value is
       4 orders of magnitude smaller than G12's working signal.

  G12: KEEP — backward already wired in commit e72885e8b, demonstrably
       reduced Best Sharpe variance from [13, 22] to [17.99, 19.56]
       (~6× tighter). Real gem.

Changes:
  - Removed compute_branch_independence + compute_temporal_consistency
    calls from submit_aux_ops (no per-step kernel launches for G6/G10)
  - Removed g6/g10 columns from HEALTH_DIAG (kept g12)
  - Added comment block in submit_aux_ops documenting WHY they were
    measured-then-removed (V7 methodology trail for future-readers)

What stays for now (deletable in a follow-up cleanup):
  - branch_independence_penalty kernel + branch_indep_kernel field +
    branch_indep_penalty_buf alloc
  - temporal_consistency_penalty kernel + temporal_consistency_kernel
    field + temporal_per_sample_buf + temporal_penalty_buf allocs
  - branch_indep_loss_value() / temporal_loss_value() readback methods
  - read_gem_losses() pass-through (now returns (g6=0, g10=0, g12=value))
  - compute_branch_independence + compute_temporal_consistency Rust fns

Keeping these as scaffolding means: if future evidence (different env,
different scale, different model) shows the underlying signal IS material
in some regime, re-wiring is just adding the call back to submit_aux_ops.
The measurement infrastructure stays in place.

Files touched:
  crates/ml/src/trainers/dqn/fused_training.rs        (-12 / +14)
  crates/ml/src/trainers/dqn/trainer/training_loop.rs (-13 / +9)

Verified: cargo check passes. Smoke test should now match the G12-only
baseline variance of [17.99, 19.56] (next session can verify).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-21 09:57:04 +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%