jgrusewski 423b36646f feat(dqn-v2): Plan 4 Task 1B-i — VSN kernel module landing (additive, no callers)
Two new CUDA kernel files registered in build.rs (kernel count 60 → 62,
all compile clean under nvcc sm_80). Module is additive — ZERO production
callers; consumers wired in 1B-ii/iii/iv.

vsn_feature_selection_kernel.cu (262 LOC, cubin 31,392 B):
- vsn_softmax_and_gate_forward: per-sample (B blocks × 256 threads)
  numerically-stable softmax over 6 feature groups + per-feature gate-
  multiply with passthrough for the 7-element padding tail.
- vsn_softmax_and_gate_backward: full softmax-over-groups Jacobian
  (d_logit[g] = mask[g] * (d_dot[g] - sum_h(mask[h] * d_dot[h]))) plus
  per-feature d_state via mask broadcast. Per-block shmem tree reduce
  for d_dot, no atomicAdd.

vsn_mask_ema_kernel.cu (78 LOC, cubin 6,688 B):
- vsn_mask_ema_update: single-block 256-thread reduction over the per-
  sample mask buffer → 6-element batch-mean → per-slot EMA into
  ISV[first..first+6). Mirrors h_s2_rms_ema_kernel.cu's shmem-reduce
  pattern exactly. Producer-only.

Caller-side cuBLAS GEMMs (Linear_1[g] / ReLU / Linear_2[g]) feed logits
to the forward kernel — mirrors gpu_grn.rs's contract pattern. Layout
row-major [B, state_dim_padded] for state, [B, num_groups] for the mask.
All reductions GPU-side per pearl_cold_path_no_exception_to_gpu_drives.md.

No checkpoint break, no fingerprint change, no new param tensors, no new
ISV slots in this commit. cargo check clean at 11 warnings (baseline
preserved); cargo build compiles 62/62 cubins clean (was 60). Smoke
deferred to 1B-iii where the forward orchestrator wire-in actually
validates something — multi_fold_convergence byte-identical to the post-
bottleneck-fix baseline (geom-mean 39.27 / per-fold 6.53 / 80.11 / 66.72).
2 new Orphan-by-design rows (will retire at 1B-iii).

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