After 16+ SP-runs producing WR pinned at ~0.435 — and a session-end smoke
showing SP22 H6 vNext K=3 head architecture moves WR to 0.458 only via
degenerate Hold-collapse (PF erodes 1.45 → 1.08) — pivot to a research-
honest architecture: distributional supervised alpha + meta-labeling gate +
Coverage-Gated Kelly execution, integrated through a novel GPU-native
publish-subscribe Belief Bus substrate.
This is a DESIGN doc only. No implementation yet. v1 → v4 evolution captured
in the doc itself; v4 is research-honest with explicit prior-work citations:
- Bellemare/Dabney distributional RL (already shipped in foxhunt SP5+)
- Lopez de Prado triple-barrier + purging + meta-labeling
- Vovk/Romano/Gibbs-Candès conformal prediction foundations
- Sun-Yu 2025 NeurIPS CPTC (change-point-aware CP)
- Gan et al. 2025 NeurIPS arXiv:2510.26026 (CP for infinite-horizon RL —
we PORT Algorithm 1 directly in Phase 7, not invent)
- Zhu-Zhu ICML 2025 AlphaQCM (QCM variance estimation, adopted)
- Berti-Kasneci 2025 TLOB (motivates MLP baseline)
Honest novelty narrowed to three claims after literature review:
1. Belief Bus substrate — GPU-native pub/sub bus with per-slot
distributional semantics + conformal coverage + causal DAG metadata.
Extends our existing 539-slot ISV pattern (already novel architecture
vs published trading systems). The substrate integration is not in
literature.
2. Application domain — imbalance-bar HFT futures + MBP-10 microstructure +
triple-barrier labels. Existing distributional CP + DRL papers use
daily stocks, general RL benchmarks, or alpha formula discovery.
3. Adaptive controllers + per-slot conformal coverage — every adaptive
quantity in the system (Kelly priors, reward caps, Adam β1, regime
probabilities) gets conformal coverage attached. Not seen in
literature.
Tiered success criteria recalibrated per CFTC 2014 E-mini HFT study
(median firms hit ~55% WR / PF 1.2-1.4):
- Minimum viable: WR ≥ 50% AND PF ≥ 1.4 → deploy
- Goal: WR ≥ 53% AND PF ≥ 1.7
- Stretch: WR ≥ 55% AND PF ≥ 2.0 (original v1 target — aggressive
top-quartile HFT)
Eight phases with explicit falsification gates:
Phase 0: Purged walk-forward + bar audit (Lopez de Prado hygiene)
Phase 1a: MLP baseline alpha (cheapest falsification)
Phase 1b: TLOB/Mamba2/Liquid encoders
Phase 1C (conditional): tick-resolution if bar fails
Phase 2: Multi-head IQN + QCM + class weights
Phase 3: Belief Bus substrate
Phase 4: CPTC calibration
Phase 5: Coverage-Gated Kelly execution (deployment trigger if viable)
Phase 6: Production wiring + 2-week shadow mode
Phase 7 (optional): Port arXiv:2510.26026 conformal-DRL Q-residual
Phase 7 specifically detailed with concrete Algorithm 1 port (~1100 LOC
total), tunable params (k=5-10 ours vs 1-5 paper, due to γ=0.99 vs 0.8),
and falsification gate (empirical coverage ≥ 88% + PF improvement ≥ 0.2).
Deferred indefinitely (research-grade risk too high):
- Neural SDE (training instability per Kidger 2021)
- Hawkes process bar replacement (O(N²) MLE prohibitive at HFT scale)
- Multi-asset portfolio
- Learned in-trade exit head
Total minimum-viable path: Phases 0-6 ~6-8 weeks engineering + 20 hours
L40S compute. Falsification gates at every step.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
36 KiB
FoxhuntQ-Δ — Belief Bus + Conformal Distributional RL for HFT Futures (v4 final design)
Status: DESIGN v4 (final, research-honest). Implementation pending.
Date: 2026-05-14
Author session: SP22 H6 vNext close-out → production-inference audit → multi-round literature review
Branch (start point): sp20-aux-h-fixed @ 19bb3bc3c
Version history
- v1 — initial brainstorm: decoupled supervised alpha + small RL execution
- v2 — research-backed critique: added Phase 0 (purging + bar audit), softened goals to tiered, MLP baseline, meta-labeling framing, class weights
- v3 — ambitious novel math: Hawkes + Neural SDE + conformal layered combination ("FoxhuntQ-Stochastic")
- v4 — research-honest final: drops Neural SDE (training instability) + Hawkes-as-substrate (O(N²) MLE prohibitive), cites prior work explicitly, positions Belief Bus as the genuine novelty
TL;DR (v4)
FoxhuntQ-Δ is a GPU-native trading system applying already-published math (distributional RL + conformal prediction + change-point adaptation) to an underexplored domain (imbalance-bar HFT futures with MBP-10 microstructure) through a novel substrate (Belief Bus — a GPU-resident publish-subscribe bus with per-slot distributional semantics + conformal coverage + causal DAG metadata).
We are not inventing the math layer. We are integrating mature components into a coherent GPU-native system, applied to a domain where the existing literature is sparse. Honest positioning: applied research + systems engineering, not theoretical breakthrough.
What we tried and what failed (16+ SP-runs of evidence)
| Pattern | Outcome | Failure mode |
|---|---|---|
| Per-bar branching DQN with C51/IQN dueling | WR pinned at ~0.435 | Per-bar decisions on per-trade objectives |
| Aux head on shared trunk | Aux starves Q (or Q starves aux) | Shared trunk gradient competition |
| Aux head on separate trunk (K=2/K=3/K=5) | One-shot bootstrap then frozen | Label-diversity feedback loop |
| Atom-shift from outcome prediction | WR=0.458 via Hold-collapse, PF=1.08 | One-sided risk signal |
| Per-bar dense reward shaping | Sharpe-gaming without alpha | Reward-shape gaming |
| Plan-conditioning | No movement | Plan head untrained (no backward) |
| Dueling V+A combined naively | Q(Flat) attractor | V/A unidentifiable |
| TD(λ) for credit assignment | Doesn't bridge horizon gap | Trade lifecycles >> TD horizon |
Common failure mode: per-bar Q over 108 actions confuses signal-extraction (alpha) with execution-policy. Every fix tunes the same wrong machine harder.
Goals (calibrated to literature)
Per project_goal_wr_55_pf_2 + CFTC 2014 E-mini HFT study (median HFT WR ~55% with PF 1.2-1.4):
| Tier | WR | PF | Status |
|---|---|---|---|
| Minimum viable | ≥ 50% | ≥ 1.4 | Beats DQN baseline; deploy if reached |
| Goal | ≥ 53% | ≥ 1.7 | Top-half of measured HFT firms |
| Stretch | ≥ 55% | ≥ 2.0 | Original goal; aggressive top-quartile HFT |
Stretch is aspirational; deployment decision triggered at minimum-viable.
Prior work this design builds on
Honest citation list. Components are mature; combination + domain are ours.
Foundation papers (established, well-cited)
| # | Citation | Year | What it gives us |
|---|---|---|---|
| 1 | Bellemare, Dabney, Munos. "A Distributional Perspective on RL" (PMLR 70:449-458) | 2017 | C51 — categorical distributional Q. Already implemented in foxhunt SP5+. |
| 2 | Dabney et al. "Distributional RL with Quantile Regression" (AAAI) | 2018 | QR-DQN. Already implemented. |
| 3 | Dabney et al. "Implicit Quantile Networks" (ICML) | 2018 | IQN. Already implemented in foxhunt SP5+. |
| 4 | Vovk, Gammerman, Shafer. Algorithmic Learning in a Random World | 2005 | Conformal prediction foundation. |
| 5 | Romano, Patterson, Candès. "Conformalized Quantile Regression" (NeurIPS) | 2019 | CQR — combines quantile regression with conformal. |
| 6 | Gibbs, Candès. "Adaptive Conformal Inference Under Distribution Shift" (NeurIPS) | 2021 | ACI — online CP recalibration under shifts. |
| 7 | López de Prado. Advances in Financial Machine Learning | 2018 | Triple-barrier labeling, purging + embargo, imbalance bars, meta-labeling. |
2024-2025 papers we directly build on
| # | Citation | Venue | Why it matters |
|---|---|---|---|
| 8 | Chernozhukov et al. "Distributional Conformal Prediction" (PNAS) | 2021 | CQR applied to daily stock returns; coverage holds across volatility regimes. Validates conformal-on-finance. |
| 9 | Sun, Yu. "Conformal Prediction for Time-series Forecasting with Change Points" (arXiv:2509.02844 / NeurIPS 2025) | 2025 | CPTC — explicit change-point handling via latent state prediction; asymptotic validity without stationarity. Drop-in for our adaptive CP. |
| 10 | "Conformal Prediction Beyond the Horizon: Distribution-Free Uncertainty for Infinite-Horizon RL" (arXiv:2510.26026 / NeurIPS 2025) | 2025 | Critical: CP wrapping any DRL estimator with finite-sample coverage. Uses pseudo-returns + weighted subsampling. We port this algorithm instead of inventing. |
| 11 | Berti, Kasneci. "TLOB: A Novel Transformer Model with Dual Attention" (arXiv:2502.15757) | 2025 | TLOB transformer for LOB. Also reveals MLPLOB (simple MLP) often matches transformers — motivates our MLP baseline. |
| 12 | Zhu, Zhu. "AlphaQCM: Alpha Discovery in Finance with Distributional Reinforcement Learning" (ICML 2025, PMLR 267:80463-80479) | 2025 | Different problem (formula discovery, not execution) but introduces QCM (Quantiled Conditional Moment) for unbiased variance from IQN quantiles. We adopt QCM as our IQN uncertainty estimator. |
Architecture papers (validate ISV / Belief Bus pattern)
| # | Citation | What it gives us |
|---|---|---|
| 13 | LMAX Disruptor design notes (Thompson et al.) | Shared-memory ring buffer pub/sub at ~600 ns. Validates pub/sub-without-broker. |
| 14 | NVIDIA CUDA Unified Memory docs | Zero-copy pub/sub between CPU and GPU at 100-500 ns. Our mapped-pinned ISV uses this. |
| 15 | Bacry, Mastromatteo, Muzy. "Hawkes Processes in Finance" (arXiv:1408.5497) | 2015 |
| 16 | Kidger et al. "Neural SDEs as Infinite-Dimensional GANs" (PMLR 139) | 2021 |
Our internal foundation (already shipped)
The full SP1-SP22 series of ISV slots, adaptive controllers, GPU kernel infrastructure. See MEMORY.md and docs/dqn-wire-up-audit.md for details. The relevant items:
- ISV signal bus — 539 named slots, mapped-pinned, GPU-resident, ~100-500 ns latency. Genuinely ours.
- Distributional Q (C51 + IQN) — fully implemented; the algorithm in [10] wraps exactly this.
- Triple-barrier outcome labels —
trade_outcome_label_kernel.cuimplements [7]'s pattern in CUDA. - Imbalance bars — Lopez de Prado [7]; bar-distribution audit in Phase 0.
- Wiener-α adaptive smoothing, Pearl A bootstrap, per-class CE weights — adaptive controller patterns that extend naturally to Belief Bus.
- PER replay buffer — for distributional Q.
What's genuinely ours (the narrowed claim)
Three things hold up under rigorous review:
1. The Belief Bus as substrate
ISV is a 539-slot mapped-pinned GPU pub/sub for adaptive control state, but every slot is a scalar. The Belief Bus extends each slot to a Belief:
struct Belief {
float mean; // point estimate (current ISV value)
float std; // uncertainty
float conformal_q90; // 90% coverage radius (per-slot CP)
uint32_t n_obs; // observations contributing (Pearl A bootstrap state)
uint32_t last_update; // step counter (staleness check)
float decay_rate; // half-life for freshness
uint8_t causal_parents[4]; // DAG metadata: up to 4 slots this depends on
}
32 bytes per Belief; a 1024-slot bus is 32 KB on the L40S. Still mapped-pinned. Still ~500 ns latency.
Novelty: per-slot conformal coverage + causal DAG metadata on a microsecond-latency GPU pub/sub bus is not in published literature. Components (distributional state, pub/sub, causal DAGs) are individually known; the GPU-substrate integration with financial controllers is the contribution.
2. Application to imbalance-bar HFT futures
Existing distributional CP + DRL papers use:
- Daily stock returns (Chernozhukov 2021)
- General RL benchmarks (arXiv:2510.26026)
- Alpha formula discovery (AlphaQCM)
We apply to:
- Imbalance bars (Lopez de Prado event-driven sampling)
- MBP-10 full 10-level depth (rare in published trading ML)
- Triple-barrier outcome labels with sparse multi-class structure
- Plan-conditioned execution (target_bars × profit_target × stop_loss × conviction × asymmetry × trail_distance)
- Single-symbol concentration (ES.FUT specialization, not multi-asset portfolio)
This is application-novel and matches our 38 GiB of MinIO data.
3. Adaptive controllers + conformal coverage everywhere
SP11-style adaptive controllers (signal-driven Wiener-α smoothers, no tuned constants) extended to maintain conformal coverage on every adaptive quantity in the system. Not just alpha is calibrated — every reward cap, every Adam hyperparameter, every Kelly prior has conformal coverage attached to its Belief Bus slot. Per feedback_adaptive_not_tuned extended to per-belief coverage guarantees.
Architecture
FoxhuntQ-Δ
Imbalance bars (17.8M from fxcache) + raw MBP-10 (35 GiB MinIO)
│
▼
┌──────────────────────────────────────────────────────┐
│ Multi-Resolution Encoder │
│ Phase 1a: MLP baseline (2-layer GELU 256-d) │ ← cheap falsification
│ Phase 1b: TLOB / Mamba2 / Liquid CfC │ ← reuse ml-supervised/
│ Output: features for distributional alpha │
└────────────────────┬─────────────────────────────────┘
│
▼
┌──────────────────────────────────────────────────────┐
│ Distributional Alpha (IQN — already implemented) │
│ Outputs: 32 quantiles of E[return | enter] │
│ Existing GPU kernels (SP5+) │
│ QCM-derived variance (per AlphaQCM ICML 2025) │ ← new uncertainty est
└────────────────────┬─────────────────────────────────┘
│
▼
┌──────────────────────────────────────────────────────┐
│ CPTC Calibration Layer │
│ Latent regime predictor (HMM / Random Forest) │
│ Online adaptive conformal per regime │
│ Outputs: P_calibrated + conformal_q90 │
│ Algorithm: arXiv:2509.02844 (CPTC, NeurIPS 2025) │
└────────────────────┬─────────────────────────────────┘
│
▼
┌──────────────────────────────────────────────────────┐
│ Belief Bus (ISV-2) │ ← novel substrate
│ alpha_drift = Belief{μ, σ, q90, parents} │
│ regime = Belief{p_dist, n_obs, decay} │
│ q_magnitude = Belief{Q_dir, drift_T} │
│ kelly_prior = Belief{wins, std, decay} │
│ ...all current ISV slots upgraded │
│ GPU pub/sub at ~500 ns; mapped-pinned coherence │
└────────────────────┬─────────────────────────────────┘
│
▼
┌──────────────────────────────────────────────────────┐
│ Coverage-Gated Kelly Execution │
│ f* = (2·P_calibrated − 1) · max_kelly · │
│ (1 − q90/q90_max) · │
│ (1 − regime.drift_T) │
│ Deterministic; no RL training required for MVP │
└────────────────────┬─────────────────────────────────┘
│
▼
┌──────────────────────────────────────────────────────┐
│ Lifecycle Manager (unchanged from current) │
│ Profit/Stop/Timeout enforcement │
└──────────────────────────────────────────────────────┘
│
┌────────────────────┴ (optional Phase 5+) ────────────┐
▼ ▼
┌─────────────────────┐ ┌──────────────────────┐
│ Conformal-DRL Q │ │ Hawkes intensity │
│ (residual on Kelly) │ │ as Belief Bus feature│
│ Port arXiv:2510. │ │ (not as bar sampler) │
│ 26026 algorithm │ │ │
└─────────────────────┘ └──────────────────────┘
Failure-mode resolution
| Current DQN failure | FoxhuntQ-Δ resolution |
|---|---|
| WR pinned at 0.435 | Alpha is supervised + calibrated; WR is a tunable threshold on calibrated probability |
| Hold-attractor | "Hold" isn't a Q action; default is "pass" (no per-bar Q reward for inaction) |
| Label-diversity collapse | Alpha trains on dense bar-level labels — full distribution always |
| PF erodes when WR rises | PF controlled by Kelly sizing weighted by uncertainty; alpha controls WR; decoupled |
| Overconfident softmax | Conformal coverage replaces softmax confidence — distribution-free guarantee |
| Adam loss-weight no-op | Each component has ONE loss; no per-loss weight tuning |
| Reward-shape gaming | Reward = realized P&L at trade close; no per-bar shaping |
| Dueling V/A unidentifiable | No Q-net needed for MVP; Kelly is closed-form |
| Plan-head untrained | No separate plan head — plan is INPUT feature to alpha |
| Label leakage (H=60 horizon) | Phase 0 implements Lopez de Prado purging + embargo |
| Imbalance-bar EWMA explosion | Phase 0 bar-distribution audit; dollar-bar fallback if needed |
| Class imbalance in triple-barrier | Phase 2 inverse-frequency class weights |
Phased implementation plan
Each phase has explicit falsification gates. Compute costs estimated for L40S at our scale.
Phase 0 — Validation harness + bar audit (~2-3 days)
Goal: literature-standard data hygiene.
- Implement purged walk-forward in
crates/ml-core/src/validation/ - Embargo window calc from horizon H
- Bar-distribution audit (inter-arrival times, drift over time, EWMA equilibration check)
- Compare to dollar-bar alternative
- Output:
docs/plans/2026-05-XX-foxhuntq-phase0-report.md
Gate: none (hygiene, not falsification).
Phase 1a — MLP baseline alpha (~1-2 days)
Goal: cheapest test that signal exists.
- 2-layer GELU MLP (256-hidden) over fxcache features
- Binary CE loss on
aux_sign_label(purged variant) - Single fold, 20% holdout
- Gate: validation accuracy > 0.52 (vs 0.50 random baseline)
Falsification: if MLP pins at 0.50-0.52 even with purging, trigger Phase 1C (tick-resolution).
Phase 1b — Sophisticated encoders (~3-5 days)
- TLOB transformer (reuse
ml-supervised/tlob/) - Mamba2 SSM (reuse
ml-supervised/mamba/) - Liquid CfC (reuse
ml-supervised/liquid/) - Same purged walk-forward, same binary CE
- Gate: best single-arch > 0.55
Falsification: if no arch exceeds 0.55, complex encoders aren't helping; trigger Phase 1C.
Phase 1C — Tick-resolution (conditional, ~5-7 days)
Only if Phase 1a + 1b both falsify. Directly tests bar-resolution hypothesis from project_bar_resolution_is_actual_architecture.
- Raw MBP-10 → tick-level feature pipeline
- Tick-time labels (forward N-tick direction)
- MLP + TLOB baselines at tick resolution
- Gate: tick-res > 0.55 where bar-res was < 0.52
Falsification: if tick-res also fails, fundamental signal absence; FoxhuntQ-Δ does not proceed.
Phase 2 — Multi-head alpha + IQN distributional output (~5-7 days)
Goal: alpha produces a full distribution (not just direction), with class-weighted multi-head training.
- Add IQN output head to Phase 1's best encoder (reuse existing IQN GPU kernels from SP5+)
- Add trade-outcome 3-class head (Profit/Stop/Timeout) with per-batch inverse-frequency CE weights (restoring deleted task #51's scope, per Lopez de Prado class-imbalance handling)
- Add next-bar return quantile loss (5 quantiles)
- Adopt QCM (Quantiled Conditional Moment) from AlphaQCM ICML 2025 for unbiased variance estimation from IQN quantiles
- Multi-fold purged walk-forward
- Gate: trade-outcome CE < 1.0 (vs ln 3 = 1.099 uniform) AND direction accuracy > 0.55
Phase 3 — Belief Bus substrate (~5-7 days)
Goal: extend ISV → Belief Bus; migrate existing controllers.
- Define
Beliefstruct + GPU kernel ABI (32-byte slots) read_belief(),update_belief_observation(),belief_decay_tick()kernels- Migration shim: every current ISV slot auto-upgrades to a
Belief{mean=ISV.val, std=Wiener-derived, conformal_q90=0_initial} - Producer→consumer protocol with causal DAG validation
- FoldReset registry extended for Belief slot lifecycle
- Visualization: HEALTH_DIAG-equivalent showing per-belief uncertainty
- Gate: all current SP-* controllers run unchanged through Belief Bus shim; lib tests pass
Phase 4 — CPTC calibration layer (~5-7 days)
Goal: change-point-aware adaptive conformal on alpha outputs.
- Latent regime predictor (start with HMM, ~5 states; can upgrade to learned later)
- Online conformal recalibration per-regime with forgetting factor
- Algorithm: arXiv:2509.02844 (Sun & Yu, CPTC, NeurIPS 2025) ported to Rust+CUDA
- Outputs flow into Belief Bus as
alpha.conformal_q90 - Gate: empirical coverage on out-of-sample fold ≥ 88% at target 90% (5% slack acceptable for finite-sample)
Phase 5 — Coverage-Gated Kelly execution (~3-5 days)
Goal: closed-form sizing using calibrated probability + conformal uncertainty.
- Read
alpha.mean,alpha.q90,regime.drift_Tfrom Belief Bus - Compute
f* = (2P − 1) · max_kelly · (1 − q90/q90_max) · (1 − regime.drift_T) - Wire to existing
gpu_experience_collectoraction selection (replace action argmax with Kelly fraction → quantized to {Short, Long} × {S, M, L}) - Backtest using terminal P&L reward + existing tx_cost model
- Gate: validation PF ≥ 1.4 AND WR ≥ 50% (minimum-viable tier)
Phase 6 — Production wiring + shadow mode (~5-7 days)
FoxhuntQAdapterimplementingModelInferenceAdapter- Replace
services/trading_service/src/main.rs:255registration - Restore
trading-service.yamlreplicas: 1 - Shadow-mode 2 weeks
- Gate: shadow WR ≥ 50% over 2 weeks of live data
Phase 7 (optional) — Conformal-DRL Q residual (~1.5-2 weeks if pursued)
Goal: wrap our existing IQN distributional Q with finite-sample coverage guarantees by porting Algorithm 1 from Gan, Lu, Zhang, Liu (arXiv:2510.26026, NeurIPS 2025).
Triggered only if Phase 5 minimum-viable hits but goal tier (WR ≥ 53% / PF ≥ 1.7) doesn't — meaning Kelly-baseline leaves performance on the table that a learned Q-residual might capture.
Concrete algorithm port
The 2510.26026 algorithm is a split-conformal wrapper around any distributional RL estimator. We port directly into our existing IQN infrastructure (crates/ml/src/cuda_pipeline/gpu_iqn_head.rs).
Setup mapping:
| Paper element | Foxhunt equivalent |
|---|---|
η̂^π(s) (return distribution) |
Existing IQN 32-quantile output |
v̂^π(s) (value function) |
Mean of 32 IQN quantiles |
D_tr (train set) |
Phases 2-5 IQN training data |
D_cal (calibration set) |
Held-out fold (FoxhuntQ-Δ purged walk-forward — Phase 0) |
| Replay buffer | Existing crates/ml-dqn/src/gpu_replay_buffer.rs (extended) |
Transition tuple (S_it, A_it, R_it, S_{i,t+1}) |
Existing per-bar collector output |
Algorithm steps (port-equivalent of paper Algorithm 1):
- Training: Phases 2-5 already produce trained IQN η̂^π(s). No new training step.
- Value function: compute
v̂^π(s) = mean(IQN_quantiles(s))per bar via existing GPU reduction kernels. - Density-ratio estimator: train logistic regression
ŵ_on(s) = P(test | s) / P(cal | s)on(test_states, cal_states)features. - For b = 1:B replicates (parallel on GPU):
- Weighted-subsample
lcalibration tuples usingŵ_on - Compute k-step pseudo-return (Eq. 1 of paper):
G̃^(k)(S_it) = Σ_{h=0..k-1} γ^h · R_{i,t+h} + γ^k · sample(η̂^π(S_{i,t+k})) - Score:
V_it = |G̃^(k)(S_it) − v̂^π(S_it)| - Quantile:
q̂_{1−αξ}= ⌈l(1−αξ)⌉-th smallest of{V_it} - Interval:
Ĉ^(b)(S_test) = v̂^π(S_test) ± q̂_{1−αξ}
- Weighted-subsample
- Aggregate:
G ∈ Ĉ_final(S_test)iffΣ_b 1[G ∈ Ĉ^(b)] ≥ (1−ξ)·B
Theoretical guarantee (Theorem 1, on-policy):
\Pr(G^\pi(S_{\text{test}}) \in \hat{C}_{N,\alpha}(S_{\text{test}})) \geq 1 - \alpha - \Lambda(\hat w, \hat\eta^\pi)
where Λ has two terms: density-ratio estimation error + Wasserstein gap between true and estimated return distribution (scaled by γ^k → exponential decay with rollout length).
Tunable parameters (with our defaults)
| Param | Paper range | FoxhuntQ-Δ default | Why |
|---|---|---|---|
k (rollout steps) |
1-5 | 5-10 | γ=0.99 (ours) vs γ=0.8 (paper) — our γ^k decays slower, can afford longer rollouts |
B (resample replicates) |
50 | 20-50 | GPU-parallel; 50 is safe |
l (subsample size) |
(implicit) | ~10K | Calibration-set fraction; tune via grid |
ξ (aggregation slack) |
tuned | 0.5 | Standard B-replicate aggregation |
α (miscoverage) |
0.1 | 0.1 | 90% coverage target |
Why our setup makes the algorithm cheaper than the paper's
| Aspect | Paper experiment | Our setup |
|---|---|---|
| N (trajectories / bars) | 200-400 | 17.8M bars/fold — effectively unlimited calibration |
| T (steps) | 30 | ~1000 |
| GPU parallelism for B-replicates | CPU sequential | L40S parallel — B=50 is ~free |
| Density-ratio estimation | Logistic regression (small N) | GPU-native logistic regression (large N) — needs care, see risk #2 |
| Setting | They derive both on/off-policy | We're on-policy in Phase 5 (Kelly evaluates the policy it runs) — simpler |
Implementation breakdown
| Component | Path | LOC est. |
|---|---|---|
| Pseudo-return computation kernel | crates/ml/src/conformal_drl/pseudo_return_kernel.cu |
~80 CUDA |
| Density-ratio estimator (GPU-native logistic regression) | crates/ml/src/conformal_drl/density_ratio.rs |
~150 Rust + ~50 CUDA |
| Weighted subsampling kernel | crates/ml/src/conformal_drl/weighted_subsample_kernel.cu |
~120 CUDA |
| Score quantile (reuses radix sort) | crates/ml/src/conformal_drl/nonconformity.rs |
~60 Rust |
| B-replicate aggregation | crates/ml/src/conformal_drl/aggregate.rs |
~60 Rust |
| Belief Bus integration (writes conformal_q90 per slot) | crates/ml/src/conformal_drl/belief_publisher.rs |
~100 Rust |
| Q-residual head (small MLP on Kelly action + alpha state) | crates/ml/src/conformal_drl/q_residual.rs |
~200 Rust |
| Test harness (replicate paper Example 1 + Mountain Car parity) | crates/ml/src/conformal_drl/tests/ |
~300 Rust |
| Total NEW code | ~1100 LOC |
Risks
-
Density-ratio estimation at 17.8M-bar scale — logistic regression with 74 features may not generalize. Mitigation: regularization (L2) + cross-validation on the LR itself, OR replace with KL-importance-estimation (Sugiyama 2008) if LR fails.
-
k > 10 produces high-variance off-policy weights — multiplicative product of policy ratios. Mitigation: stick to k ≤ 10 (γ^10 ≈ 0.90 is still effective decay). For off-policy counterfactual evaluation (NOT Phase 5), this is a hard limit.
-
Coverage bound depends on Wasserstein gap — if our IQN is poorly calibrated, coverage degrades. Phase 7 ONLY makes sense after Phase 2 produces well-trained IQN. Empirical coverage on holdout must be checked: if < 85% at α=0.1, IQN needs more training.
-
Paper's experimental validation is small — synthetic 2-state MDP + Mountain Car. No financial data. We'd be the first finance application. Implementation correctness via Mountain Car parity test (replicate their Figure 2 numbers) is the regression check.
Phase 7 gate
Trigger condition: Phase 5 achieves WR ≥ 50% AND PF ≥ 1.4 (minimum-viable) but falls short of goal tier (WR ≥ 53% AND PF ≥ 1.7).
Success criterion: Phase 7 produces calibrated 90% prediction intervals on out-of-sample folds (empirical coverage ≥ 88%) AND Q-residual improves PF by ≥ 0.2 absolute over Phase 5 Kelly-only baseline.
Falsification: if coverage drops below 85% across multiple folds → IQN is mis-calibrated; investigate IQN training first before continuing CP wrapping.
Deferred indefinitely
- Neural SDE encoders — training instability (diffusion-collapse, "notoriously difficult to train" per Kidger 2021); revisit if Phase 1-5 hits ceiling
- Hawkes process bar replacement — O(N²) MLE prohibitive at HFT scale; revisit at much smaller event count if needed
- Multi-asset portfolio — single-symbol focus first
- Learned in-trade exit head — only after main path proves merit
Reuse map
Direct reuse (no modification)
crates/ml-supervised/src/tlob/ ← TLOB transformer (Phase 1b)
crates/ml-supervised/src/mamba/ ← Mamba2 SSM (Phase 1b)
crates/ml-supervised/src/liquid/ ← Liquid CfC (Phase 1b)
crates/ml/src/training/unified_trainer.rs ← UnifiedTrainable + GpuAdamW
crates/ml/src/cuda_pipeline/gpu_iqn_head.rs ← IQN (Phase 2)
crates/ml/src/cuda_pipeline/gpu_attention.rs ← Multi-head attention
crates/ml/src/cuda_pipeline/gpu_grn.rs ← GRN block
crates/ml/src/cuda_pipeline/trade_outcome_label_kernel.cu ← Lopez de Prado triple-barrier
crates/ml-core/src/cuda_autograd/ ← GpuLinear, GpuAdamW, Loss
crates/ml-dqn/src/replay_buffer/ ← PER buffer (Phase 7)
crates/ml/src/fxcache.rs ← 17.8M-bar dataset
infra/k8s/argo/train-template.yaml ← Argo workflow
scripts/argo-train.sh ← CLI dispatcher (L40S default)
Lightly modified
crates/ml/examples/train_baseline_supervised.rs + --data-source fxcache
+ multi-head losses
+ class-weighted CE
+ purged walk-forward
crates/ml/src/cuda_pipeline/aux_sign_label_kernel.cu + purged variant
NEW code (small, well-scoped)
crates/ml-core/src/validation/ ← Phase 0
purged_walk_forward.rs ← Lopez de Prado CPCV
embargo.rs ← Embargo from H
crates/ml/src/alpha/ ← Phase 1-2
mlp_baseline.rs ← Phase 1a 2-layer GELU
multi_head_adapter.rs ← Direction + Outcome + Quantile
class_weights_kernel.cu ← Inverse-frequency weights
qcm_variance_kernel.cu ← AlphaQCM variance estimation
crates/ml-core/src/belief_bus/ ← Phase 3 (THE substrate)
mod.rs
belief.rs ← Belief struct + serdes
bus.rs ← GPU pub/sub implementation
causal_dag.rs ← DAG metadata + validation
reset_registry.rs ← FoldReset extended
migration.rs ← ISV → Belief shim
crates/ml/src/conformal/ ← Phase 4
cptc.rs ← CPTC algorithm port
regime_predictor.rs ← HMM latent state
online_calibration.rs ← Per-regime quantile update
crates/ml/src/foxhuntq/ ← Phase 5
kelly_execution.rs ← Coverage-Gated Kelly
adapter.rs ← FoxhuntQAdapter
crates/ml/src/conformal_drl/ ← Phase 7 (optional)
pseudo_returns.rs ← arXiv:2510.26026 port
weighted_subsampling.rs
config/training/foxhuntq-{alpha,calibration,kelly}.toml ← per-phase configs
docs/plans/2026-05-XX-foxhuntq-phase{0,1,2,...}.md ← per-phase impl plans
Throw away (after Phase 6 ships)
crates/ml/src/ensemble/adapters/dqn.rs::DqnInferenceAdapter
← Orphan; dist_dueling untrained
crates/ml-dqn/src/dqn.rs::DQN::forward ← Bad routing through dist_dueling
Per-bar reward shaping components (sp11, sp12, popart, cf, micro, trail, bonus)
← Replaced by terminal P&L
Open questions / risks
1. Bar-resolution hypothesis untested under honest meters
Per project_label_horizon_is_bottleneck.md and project_bar_resolution_is_actual_architecture.md. Phase 1a (MLP + purged validation) is the direct test. If it falsifies at every tested encoder, Phase 1C (tick-resolution) is the deeper test.
2. CPTC requires a regime predictor
Initial: HMM-based, ~5 states (could match our K=5 regime_label output). Risk: HMM may underperform deep latent state models. Mitigation: start simple, upgrade if Phase 4 coverage falls below 88%.
3. Belief Bus migration risk
Every adaptive controller in foxhunt currently reads/writes ISV scalars. Migration to Belief slots requires careful shim. Risk: production controllers break during migration. Mitigation: phased — Belief Bus stays read-equivalent to ISV in Phase 3 (publishes Belief.mean for legacy consumers); new consumers use full Belief in Phase 4+.
4. PF ≥ 2.0 may not be achievable
Per CFTC HFT data: median firms hit ~55% WR with PF 1.2-1.4. Stretch goal may exceed realistic ceiling for our setup (no colocation, retail-scale costs). Mitigation: tiered success criteria — minimum-viable (50%/1.4) is the deployment trigger.
5. Kelly may suffice; Q optional
Phase 5 deploys Kelly-only. If WR + PF hit minimum-viable, Phase 7 may not be needed. Saves substantial complexity.
6. Trading service currently at replicas=0
Pre-existing latent issue (dist_dueling orphan). Phase 6 restart requires coordination + shadow mode minimum 2 weeks.
7. Backwards compatibility during transition
Keep branching_q_network + DQN trainer intact during Phases 0-6. Only delete after Phase 6 proves merit. 19bb3bc3c is the last known-DQN state.
8. Conformal coverage in non-stationary settings
Even CPTC requires the latent state model to be approximately correct. If regime shifts are truly unpredictable (no signal in latent state), CP will under-cover during shifts. Mitigation: monitor empirical coverage on holdout in Phase 4; if < 85%, widen intervals or use weighted-CP fallback.
9. Compute cost
Phase 0-5 total: ~30-50 L40S-hours compute + ~6-8 weeks engineering. Phase 7 adds ~1-2 weeks if pursued. Within budget for a major architectural revision.
Success criteria (final)
| Tier | WR | PF | Trigger |
|---|---|---|---|
| Phase 5 minimum-viable | ≥ 50% | ≥ 1.4 | Deploy via Phase 6 (shadow → live) |
| Phase 5 goal | ≥ 53% | ≥ 1.7 | Deploy + Phase 7 (Q residual) extension |
| Phase 5 stretch | ≥ 55% | ≥ 2.0 | Deploy + Phase 5+ extensions (Hawkes, Neural SDE explore) |
All measured on purged out-of-sample folds, decomposed cost model (commission + spread + slippage), no Sharpe-inflation.
Memory references
project_sp22_h6_vnext_resume.md— SP22 H6 vNext smoke verdict (this session)project_foxhuntq_architectural_pivot.md— high-level memory entrypearl_k3_head_bootstrap_then_freeze.md— label-diversity feedback looppearl_wr_pf_anticorrelation_hold_collapse.md— degenerate Hold-attractor modepearl_trade_target_rate_freeze_indicator.md— controller-lock indicatorpearl_imbalance_bar_ewma_washes_out_configured_threshold.md— bar-distribution driftproject_goal_wr_55_pf_2.md— recalibrated to tiered in v4project_label_horizon_is_bottleneck.md— alternative hypothesis (Phase 1C tests)project_bar_resolution_is_actual_architecture.md— alternative hypothesis (Phase 1C tests)pearl_reward_shape_drives_quality_over_quantity.md— deprecated; v4 uses terminal-only rewardpearl_audit_unboundedness_for_implicit_asymmetry.md— asymmetric clamp pattern still appliesfeedback_smoke_validation_before_structural_priors.md— validate Phase 1 before merit tuningfeedback_kill_runs_on_anomaly_quickly.md— falsification-gate disciplinefeedback_no_quickfixes.md— design over hot-patchingfeedback_adaptive_not_tuned.md— every Belief Bus slot is signal-driven
What this doc is NOT
- Not an implementation plan — phase-specific impl plans follow as separate docs.
- Not a commitment to delete DQN immediately — Phases 0-5 run parallel; deprecate after Phase 6.
- Not a theoretical breakthrough claim — all math layers are published; combination is the contribution.
- Not "another FinRL" — FinRL is high-level Python framework; FoxhuntQ-Δ is GPU-native microsecond-latency substrate.
- Not "we invented conformal-DRL" — arXiv:2510.26026 published this 2025; we port the algorithm.
- Not "we invented adaptive CP for time series" — Sun & Yu 2025 published CPTC; we use it.
- Not claiming SOTA on any standard benchmark — claiming applied-research value on an underexplored domain (imbalance-bar HFT futures with MBP-10).
The honest pitch:
FoxhuntQ-Δ ports validated 2021-2025 ML research (distributional RL, conformal prediction, change-point CP, distributional CP for finance) to imbalance-bar HFT futures, integrated through a novel GPU-resident publish-subscribe Belief Bus substrate with per-slot distributional semantics and causal DAG metadata. The math layer is published; the substrate is ours; the application domain is underexplored. Target: WR ≥ 50% and PF ≥ 1.4 at minimum-viable, ≥ 55% / ≥ 2.0 stretch.