jgrusewski
874cff04a0
spec: Phase 3 cost-driven hold timing — replaces min_hold_bars
...
Gem: per-trade implementation shortfall cost (already exists)
Pearl: continuous inventory penalty (holding_cost_rate * |position| * dt)
Novel: graduated churn penalty for rapid flips (not a hard gate)
Removes: min_hold_bars, enforce_hold(), adaptive hold extension
Adds: holding_cost_rate, churn_threshold_bars, churn_penalty_scale
ISV shifts from hold enforcement to risk tolerance modulation
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-18 00:27:40 +02:00
jgrusewski
6b2cbc2965
spec: detailed Phase 2 implementation — workspace isolation, double buffer, determinism
...
Phase 2a: branch parallel — cuBLAS workspace isolation per branch stream,
buffer isolation verified, backward join before trunk reduction.
Phase 2b: aux parallel — per-trainer workspace (128MB additional), 4 aux
streams, dependency graph within aux_child detailed.
Phase 2c: double buffer — ping-pong experience buffers (3GB additional),
collection/training stream separation, replay buffer staleness analysis,
child graph re-capture for buffer pointer swap.
Determinism: CUDA Graph replay is bit-identical via fixed dependency edges.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-18 00:12:14 +02:00
jgrusewski
e54b9e5abd
spec: Phase 2 multi-stream graph parallelism — designed for future implementation
...
forward_child: 4 branch streams fork after h_s2, join before loss
aux_child: IQL/IQN/attention on parallel streams
Uses CU_STREAM_CAPTURE_MODE_RELAXED with fork-join events as graph edges
Existing branch_streams[4] + events in batched_forward.rs ready to activate
Target: <40s epochs (from <80s Phase 1)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-18 00:09:40 +02:00
jgrusewski
45d8f4661c
plan: rewrite Task 9 for child graph architecture
...
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-17 23:58:32 +02:00
jgrusewski
d1693930ab
spec: child graph architecture — composable sub-graphs instead of flat capture
...
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-17 23:54:07 +02:00
jgrusewski
2bc704f966
spec: Plan Phase 2 — 6 pearls/gems/novels for adaptive planning
...
P11: Counterfactual conviction drift (current vs entry conviction)
P12: Regime-plan alignment (regime shift invalidates plan)
G11: Temporal plan decay (conviction fades with time)
G12: Multi-exit strategy (partial profit taking via magnitude branch)
N17: Recursive plan revision (living plan, update mid-trade)
N18: Hindsight plan labels (learn optimal plan from trade outcomes)
N19: Plan ensemble (3 plans → agreement confidence signal)
All flow through ISV → Mamba2 → temporal attention pathway.
Learn from bad trades (N18 hindsight), exploit winners (G12 partial
exits, N17 plan extension on conviction increase).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-17 09:01:53 +02:00
jgrusewski
750b228ed9
plan: Trade Plan Head — 5 tasks, hierarchical plan-based trading
...
Task 1: PORTFOLIO_STRIDE 23→30, plan slots ps[23-29]
Task 2: trade_plan_forward kernel + 4 weight tensors (82→86)
Task 3: Plan activation + enforcement in env_step
Task 4: Direction lock in action_select + counter-plan Q (N14)
Task 5: Smoke test + compute-sanitizer
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-17 00:48:18 +02:00
jgrusewski
102adf7703
spec: fix trade plan head — ps[23-29] (was 16-22 collision), STRIDE 23→30
...
Portfolio slots ps[15]-ps[19] are Kelly accumulators (active).
Plan params moved to ps[23]-ps[29]. PORTFOLIO_STRIDE grows 23→30.
Fixed asymmetry: scales profit_target only (not stop_loss).
Clarified epsilon mid-plan: overridden by direction lock (intended).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-17 00:44:20 +02:00
jgrusewski
1acb23cb24
spec: Trade Plan Head — hierarchical plan-based trading
...
Plan head outputs 6 params at entry: target_bars, profit_target,
stop_loss, scale_aggression, conviction, asymmetry. Model commits
to plan, bar-by-bar execution constrained. Auto-exit on target/stop/time.
Pearls: P8 learned stops, P9 Kelly conviction, P10 options framework.
Gems: G8 asymmetric R/R, G9 pyramiding, G10 learned termination.
Novels: N13 plan-conditioned Q, N14 counter-plan evaluation,
N15 plan replay priority, N16 ISV-modulated plan parameters.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-17 00:41:05 +02:00
jgrusewski
ddb7b170bc
plan: Tick Microstructure Intelligence — 4 tasks, OFI_DIM 8→20
...
Task 1: IncrementalMicrostructureCalculator (12 new features, O(1)/tick)
Task 2: fxcache OFI_DIM 8→20 atomic update (15 files, 30+ locations)
Task 3: Extend precompute pipeline with MicrostructureState
Task 4: Regenerate fxcache + smoke test + compute-sanitizer
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-17 00:02:02 +02:00
jgrusewski
1d958c7ab9
spec: Phase 4 adaptive minimum hold time — prevent coin-flip exits
...
3-bar base + regime_stability extension (0-12) + confidence extension
(0-3) = adaptive 3-18 bar minimum hold. Only prevents exits, not
entries. Targets 100-200K trades instead of 619K.
Pearl: P7 hard minimum hold. Gem: G7 regime-conditioned extension.
Novel: N12 ISV-driven hold confidence.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-16 23:51:45 +02:00
jgrusewski
e6b3fffa6d
spec: fix 4 critical issues from review — OFI_DIM cascade, deploy atomicity
...
1. Enumerate all 6+ files with hardcoded OFI_DIM=8 literal
2. Document atomic deploy requirement (code + fxcache together)
3. Rename Depth Renewal Rate → Order Count Flux (MBP-10 approximation)
4. Fix Intra-Bar Momentum to Welford online covariance (O(1), no Vec)
5. Clarify snapshot() is pure read, non-mutating, idempotent
6. Fix precompute time: 8s CPU + 5min I/O = ~5-10min total
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-16 23:43:55 +02:00
jgrusewski
a2587fd087
spec: Tick-Level Microstructure Intelligence — 12 new features from MBP-10
...
OFI_DIM: 8→20. IncrementalMicrostructureCalculator: O(1) per tick.
Pearls: OFI trajectory, realized variance, Hawkes trade intensity.
Gems: book pressure gradient, spread dynamics, aggression ratio,
queue depletion, depth renewal rate.
Novels: intra-bar momentum, microstructure regime score, order flow
acceleration, toxicity gradient, speculative H100 inference (N10),
mid-bar regime early warning (N11).
Databento (GLBX.MDP3, mbp-10) for all tick data. IBKR execution only.
fxcache single format, regenerate all files.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-16 23:39:36 +02:00
jgrusewski
2acaaeaacd
spec: Phase 3 dynamic inference brain — feature gating + temporal routing
...
7 adaptive pathways modulated by ISV at inference: feature gating
(WHICH features matter), temporal routing (HOW MUCH history per
feature), branch gating, gamma mod, risk budget, Mamba2 decay,
branch confidence. Model adapts to unseen regimes in 2-3 bars.
Pearls: P6 feature-level ISV gating.
Gems: G6 per-feature temporal routing.
Novels: N8 dynamic inference adaptation, N9 graceful cold start.
4 new weight tensors (78-81), 4608 params. Tasks 14-16.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-16 23:11:39 +02:00
jgrusewski
b0d67f0f8a
spec: Phase 2 regime awareness — ISV_DIM 8→12, cross-regime adaptation
...
4 new ISV signals: regime_velocity (d(ADX)/dt + d(CUSUM)/dt),
regime_disagreement (|norm_ADX - norm_CUSUM|), regime_transition_ema,
regime_stability (1 - sigmoid(5*velocity)).
Pearls: P4 regime velocity, P5 regime disagreement.
Gems: G4 regime-aware ISV, G5 soft regime mixture.
Novels: N6 cross-regime Mamba2 decay, N7 regime-conditioned gamma.
Tasks 10-13 added for Phase 2 implementation after core ISV.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-16 23:06:12 +02:00
jgrusewski
6dd2f3e68b
plan: Introspective State Vector — 9 tasks, pure GPU implementation
...
Task 1: ISV scratch scalars (piggyback on existing kernels)
Task 2: isv_signal_update GPU kernel + temporal history
Task 3: ISV encoder MLP + weight tensors 68→78
Task 4: Drift-conditioned gamma (C51 scalar→per-sample buffer)
Task 5: Branch confidence routing (replaces regime_branch_gate)
Task 6: Risk branch wider input SH2→SH2+9
Task 7: Recursive confidence head (predict own TD-error)
Task 8: Target network ISV online-only
Task 9: Smoke test + compute-sanitizer verification (0 errors)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-16 22:46:54 +02:00
jgrusewski
60a82d538b
spec: Introspective State Vector (ISV) — model self-awareness module
...
Replaces hardcoded Q-drift penalty with learnable self-awareness:
8 ISV signals (q_drift, grad_norm, td_error, ensemble_var, velocity,
reward, atom_util, loss) computed by pure GPU kernel, fed through
encoder MLP (8→16→8) for branch gating + drift-conditioned gamma +
risk branch input. Includes recursive confidence head (predict own
TD-error), branch confidence routing (replaces regime_branch_gate),
and temporal ISV memory (K=4 rolling buffer with learned decay).
10 new weight tensors (68→78), 582 new params, ~39KB VRAM.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-16 22:40:23 +02:00
jgrusewski
685746231b
plan: Training Environment Alignment — 5 tasks, 3 phases
...
Phase 1: Position-gated episodes (h100.toml + done flag + soft reset)
Phase 2: Adapt rank norm (skip zeros) + remove hardcoded Q-drift
Phase 3: Aligned Sharpe metrics (un-annualized per-trade)
Phase 4: Build verification + smoke test
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-16 21:49:19 +02:00
jgrusewski
3e683f1053
spec: adapt components instead of removing — DSR on trade P&L, rank non-zeros only
...
Components were fighting a broken signal, not broken themselves.
With correct signal: adapt DSR to trade-level, rank only non-zero
rewards, keep commitment as soft signal, let E1 enrichment handle
Q-drift instead of hardcoded kernel penalty.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-16 21:44:35 +02:00
jgrusewski
4a32b9f8b0
spec: Training Environment Alignment — single path to close the 45× gap
...
Root cause: training environment differs from validation backtest in 3 ways:
1. 100-bar episodes force exits (val runs continuous) → position-gated done
2. Rank normalization destroys sparse trade-level reward → remove it
3. Different Sharpe computation (per-trade vs per-bar, different annualization)
Single execution path:
Phase 1: Episode alignment (100→5000 bars, position-gated done, soft reset)
Phase 2: Reward alignment (remove rank norm, raw trade P&L to replay)
Phase 3: Metrics alignment (un-annualized per-trade Sharpe, both paths)
Expected: training Sharpe within 2× of validation with same weights.
Removes 5 unnecessary shaping components that fought the broken signal.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-16 21:38:06 +02:00
jgrusewski
a83b4a97f1
results: raw_next fix verdict — training Sharpe +0.19 avg, peak 1.02, WinRate 25%
...
Root cause: experience collector used raw_next (future price) for P&L,
creating 1-bar action-reward misalignment. 30+ H100 runs couldn't
overcome this. Fix: use raw_close only + trade-level P&L.
Result: WinRate 45%→25% (selective), Sharpe 0→+0.19 avg,
peak 1.02 (3 times), PF 1.09, 67% positive epochs.
First genuine asymmetric trading strategy in the project.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-16 20:22:27 +02:00
jgrusewski
8d413f7759
plan: Self-Improving Training Loop — 6 tasks, 9 enrichments
...
Enrichment module (enrichment.rs) + training loop wiring:
E1-E3: Q-correction, adaptive epsilon, dynamic gamma
E4-E5: Trade autopsy per-branch LR, ensemble agreement
E6-E8: Winner distillation, hindsight labels, curriculum weights
E9: State confidence (deferred — needs K-means kernel)
~215 lines Rust, no new CUDA kernels. 6 tasks.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-16 17:34:14 +02:00
jgrusewski
b111713330
spec: Self-Improving Training Loop — 9 enrichments, eval-as-training
...
Every epoch's validation backtest feeds back into the next epoch:
E1: Q-value reality check (bias correction, replaces drift penalty)
E2: Adaptive epsilon (performance-driven, replaces schedule)
E3: Dynamic gamma (from trade duration, replaces manual annealing)
E4: Trade autopsy (per-branch LR scaling from error rates)
E5: Ensemble agreement tuning (auto-tune epistemic gate)
E6: Winner distillation (boost top 10% trades in replay)
E7: Hindsight optimal labels (correct actions for losers)
E8: Curriculum weights (oversample failure regimes)
E9: State confidence (tradability scores from eval)
Zero hardcoded schedules. The model adapts from its own performance.
~215 lines Rust, no new CUDA kernels. ~15s overhead per epoch.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-16 17:30:01 +02:00
jgrusewski
5c4f153f26
plan: Learned Risk Management — 6 tasks, 5th branch risk_budget [0,1]
...
3 CUDA kernels (forward, apply, backward), NUM_WEIGHT_TENSORS 64→68,
per-sample CVaR alpha + commitment lambda, separate Adam, ~33K params.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-16 01:32:16 +02:00
jgrusewski
b5f7074907
feat: trade-level reward attribution + learned risk management spec
...
REWARD: Replace per-bar noise (SNR~0.01) with trade-level P&L attribution.
Trade closes → reward = realized segment P&L (already computed).
Holding → reward = -0.0001 * |position| (tiny holding cost).
Flat → reward = 0. Removed dense OFI/inventory/DSR per-bar noise.
SPEC: Learned Risk Management — 5th branch risk_budget [0,1] gates
all protection mechanisms per-sample. Model learns WHEN to take risk.
CVaR alpha, commitment lambda, magnitude ceiling all scaled by R.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-16 01:29:11 +02:00
jgrusewski
3f3d32d5ba
spec: trade-level reward attribution + exploration risk budget + homeostatic regularization
...
Two fundamental fixes for training Sharpe breakthrough:
1. Trade-level rewards: replace per-bar noise (SNR=0.01) with trade
P&L attribution (SNR=0.1-0.5). C51 atoms model trade outcome
distributions, not random walk noise.
2. Exploration risk budget: protection stack (CVaR, epistemic gate,
commitment, DSR) scaled by iqn_readiness². Loose during exploration,
tight when converged. Model can discover edges before being punished.
Also: homeostatic regularization spec (unified adaptive penalties).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-16 01:24:03 +02:00
jgrusewski
33a6c35684
spec: add G11-G15 — Q-anchoring, predictive coding, Sharpe reward, confidence replay, commitment
...
5 new pearls for closing val/OOS gap to <15%:
G11: Q-value anchoring to Flat baseline (focus on alpha)
G12: Predictive coding auxiliary loss (self-supervised trunk)
G13: Sharpe-aware reward shaping (align reward with goal)
G14: Confidence-weighted replay (suppress noise samples)
G15: Action commitment penalty (anti-churn beyond costs)
Total: 15 generalization components, ~550 LOC.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-15 20:46:05 +02:00
jgrusewski
29876469f0
spec: update success criteria — val/OOS gap < 15% as primary target
...
Primary goal: val/OOS Sharpe gap < 15%. If val_Sharpe drops to 25
post-generalization, OOS should be > 21. If val drops to 15, OOS > 13.
OOS Sharpe > 10 sustained as secondary target.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-15 20:40:44 +02:00
jgrusewski
5b3183504f
plan: OOS Generalization Enhancement — 9 tasks, 10 components
...
3-layer defense: compress (AdamW+L1, gamma anneal, regime dropout),
align (cost curriculum, walk-forward), exploit (epistemic gate, branch
independence, counterfactual, temporal consistency).
~480 lines total. Companion to OOS Performance Enhancement plan.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-15 20:33:03 +02:00
jgrusewski
0c52b3d185
fix: spec self-review — correct walk-forward layout and weight decay mask
...
Walk-forward: strictly chronological, no future leakage.
Weight decay mask: indices 0-7 (trunk + value head), not just trunk.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-15 20:27:45 +02:00
jgrusewski
72283d9ebd
spec: OOS Generalization Enhancement — 10 components for capacity redirection
...
3-layer defense: compress capacity (AdamW, L1-sparse, gamma anneal,
regime dropout), align objectives (transaction cost curriculum, purged
walk-forward), exploit structure (epistemic-gated magnitude, branch
independence, counterfactual augmentation, temporal consistency).
4 novel techniques (G5, G6, G9, G10), 3 novel adaptations (G7, G8, G4).
Companion spec to OOS Performance Enhancement (training dynamics).
Target: OOS Sharpe > 5 sustained across multiple market regimes.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-15 20:24:06 +02:00
jgrusewski
57a17c6d81
plan: add Tasks 9d-9e — Q-mean drift regularization + new component LR warmup
...
Task 9d: Q-mean EMA drift penalty (lambda=0.01) in C51 grad kernel.
Prevents +0.47 Q-mean drift observed in train-vpb4w.
Task 9e: 500-step LR warmup for new tensor groups (regime gate,
adaptive atoms, Mamba2, multi-horizon). Prevents gradient shock
on new components introduced to trained network.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-15 19:43:50 +02:00
jgrusewski
31ad6d5dec
plan: add Tasks 9a-9c — missing backward/training for atoms, Mamba2, multi-horizon
...
Task 9a: Adaptive atom position training via atom entropy gradient.
Numerical finite-difference gradient on spacing_raw, SGD at LR=1e-3.
Task 9b: Mamba2 BPTT backward through K=8 scan steps.
d_W_A/B/C accumulated, separate Adam at LR=1e-4.
Task 9c: Multi-horizon C51 loss — 3 n-step passes (1/5/20 bar),
3 C51 loss launches, regime-weighted gradient blend (ADX-based).
Fixes the "untrained component" gap identified in plan review.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-15 19:22:27 +02:00
jgrusewski
f2ddba5189
plan: OOS Performance Enhancement — 9 tasks, 8 components
...
Task 1: 3 CUDA kernels (regime gate, adaptive atoms, mamba2 scan)
Task 2: Adaptive DSR (training Sharpe EMA → w_dsr scaling)
Task 3: CVaR objective (risk-sensitive Bellman target)
Task 4: Regime branch gating (20 params, ADX/CUSUM → branch importance)
Task 5: Adaptive atom positions (204 params, learned C51 spacing)
Task 6: Ensemble heads (config 1→3, existing infrastructure)
Task 7: Mamba2 temporal scan (12K params, 8-bar context)
Task 8: Multi-horizon prediction (144K params, 1/5/20 bar horizons)
Task 9: Build verification
NUM_WEIGHT_TENSORS: 50→64 across tasks 4,5,8.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-15 18:56:34 +02:00
jgrusewski
d0b70b6c8a
spec: OOS Performance Enhancement — 8 components for closing val/OOS gap
...
1. CVaR objective (risk-sensitive Bellman target, adaptive α)
2. Adaptive DSR (training Sharpe EMA drives w_dsr weight)
3. Ensemble heads (3 heads, epistemic uncertainty for exploration)
4. Mamba2 temporal scan (K=8 bar context, O(K) selective scan)
5. Multi-horizon prediction (1/5/20 bar value heads, regime-blended)
6. Adaptive atom positions (learned C51 spacing via softmax — NOVEL)
7. Regime-conditioned branch gating (ADX/CUSUM → branch importance — NOVEL)
Designed from live H100 analysis: val_Sharpe=45 but training_Sharpe=-1..+1.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-15 18:44:18 +02:00
jgrusewski
76b1655e07
spec: Component 13 + full train-vpb4w results + backtracking bug analysis
...
train-vpb4w results:
- Peak val_Sharpe=54.59 (2.3× baseline), plateau at 51.11 from epoch 23
- Backtracking NEVER triggered despite 6 frozen epochs — detection bug
- Root cause: only checks Q-gap freeze, not val_Sharpe freeze
- avg_grad=10 constant but weights frozen — Adam momentum cancellation
Component 13: val_Sharpe freeze detection as second backtracking trigger.
Adds |val_sharpe - prev| < 0.01 check alongside Q-gap velocity check.
Adds diagnostic logging for plateau detection progress.
Full metrics table and findings documented for next iteration.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-15 08:52:17 +02:00
jgrusewski
ed3504bd45
spec: add Components 10-12 from live H100 plateau analysis
...
Observed train-vpb4w freeze at epoch 23 (val_Sharpe=51.11):
- avg_grad=10.0 (nonzero!) but Q-stats FROZEN for 4+ epochs
- Root cause: Adam momentum converged to fixed point, not zero gradient
Component 10: Targeted Adam momentum reset for branch weights only
(indices 8-41). Lighter than full rewind, preserves trunk convergence.
Component 11: Q-gap target attractor for spread gradient. Amplifies
spread when Q-gap is below target, reduces when above. Prevents
spread from being too weak at high Q-gap levels.
Component 12: Cosine LR schedule with warm restarts (T=20 epochs).
LR decay prevents overshoot, restart jumps break fixed points.
Half-momentum at restart preserves gradient direction.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-15 08:46:21 +02:00
jgrusewski
f14440be55
plan: add Tasks 10-11 — Q-mean centering + atom entropy recovery (execute first)
...
Task 10: q_mean_reduce + q_mean_subtract two-phase kernel. Zero params.
Fixes Q-mean drift 0→+0.47 from bootstrapping bias.
Task 11: Adaptive entropy_coeff based on utilization_ema. Zero params.
Fixes atom utilization collapse 100%→20%.
Execution order: 10, 11, then 1-9.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-15 08:40:09 +02:00
jgrusewski
5b895f9347
spec: add Components 8+9 — Q-mean drift correction + atom utilization recovery
...
Observed in train-vpb4w (live H100 run):
- Q-mean drifts 0→+0.47 over 18 epochs (bootstrapping bias)
- Atom utilization drops 100%→20% (distributional collapse)
- val_Sharpe peaks 54.59 then decays to 31.52
Component 8: Mean-center Q-values before action selection pipeline.
Zero params, preserves ranking, prevents drift accumulation.
Component 9: Adaptive atom entropy regularization. Ramps entropy_coeff
when utilization drops below 50%. Uses existing c51_grad_kernel param.
Both are zero-param fixes moved to top of implementation order.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-15 08:37:49 +02:00
jgrusewski
d5e270e18b
fix: Components 2+5 fully GPU — zero CPU compute, zero copies
...
xLSTM: qlstm_step kernel reads q_stats_buf directly on device, updates
C matrix on device, writes context[8] to device buffer. qlstm_train_step
runs SGD on device. No DtoH readback.
RK4 ODE: liquid_tau_rk4_step kernel reads per_branch_q_gap_ema (device),
context (device), writes liquid_mod (device). No pinned memory — plain
CudaSlice. Replaces CPU update_liquid_tau entirely.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-15 08:35:40 +02:00
jgrusewski
fcf34ac5c8
plan: Supervised Architecture Transfer — 9 tasks, 7 components
...
Task 1: 7 CUDA kernels (quantile, graph, KAN, diffusion, OFI concat)
Task 2: Quantile Q-select (replaces epsilon-greedy, zero params)
Task 3: Graph message passing (4 directed edges, 60 params)
Task 4: KAN spline gates (replaces sigmoid, 9,216 params)
Task 5: Diffusion Q-refinement (3-step denoise, 2,772 params)
Task 6: TLOB microstructure injection (widen order/urgency FC)
Task 7: xLSTM temporal context (CPU matrix memory, 528 params)
Task 8: RK4 adaptive ODE (replaces Euler in liquid tau)
Task 9: Build verification + smoke tests
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-15 08:29:51 +02:00
jgrusewski
9c4c97cf8d
spec: Supervised Architecture Transfer — 7 concepts from KAN/xLSTM/Diffusion/TGNN/Liquid/TFT/TLOB
...
1. KAN spline activations → adaptive branch gates (learnable activation shape)
2. xLSTM matrix memory → temporal Q-value context (trajectory pattern detection)
3. Diffusion denoising → iterative Q-refinement (uncertainty-conditioned)
4. TGNN gating → cross-branch graph message passing (structural coordination)
5. Liquid RK4 ODE → higher-order training dynamics (adaptive Euler/RK4)
6. TFT quantile outputs → uncertainty-driven exploration (replaces epsilon-greedy)
7. TLOB MBP-10 → direct microstructure injection to order/urgency branches
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-15 08:19:18 +02:00
jgrusewski
d5414bec25
spec: Component 6 early termination — PLATEAU_EXHAUSTED after 12 attempts
...
3 rewinds × 4 routes = 12 max attempts. Failed = improvement rate below
threshold over 10 epochs. On exhaustion: save best model, exit cleanly,
log "structural change needed". Saves ~3 hours H100 vs frozen training.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-14 23:46:27 +02:00
jgrusewski
f5985cff14
spec: add Component 6 — Trajectory Backtracking (single GPU)
...
Checkpoint ring buffer ranked by improvement rate, plateau detection
via liquid tau velocity, informed perturbation cycle (Adam reset,
shrink-perturb, temp boost, LR×2), depth-limited rewind. ~150 lines
in training_loop.rs, zero CUDA changes. Recovers from plateaus that
prevention mechanisms (spread gradient, liquid tau) fail to avoid.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-14 23:38:05 +02:00
jgrusewski
cc232f644d
plan: Cross-Pollinated Branch Intelligence — 9 tasks, 64 steps
...
Task 1: Dead code cleanup (11 items across 6 files)
Task 2: 6 CUDA kernels (VSN, GLU, Q-attention, selectivity)
Task 3: Weight layout 26→42 + separate buffers + liquid_mod pinned
Task 4: VSN + GLU forward integration
Task 5: VSN + GLU backward integration
Task 6: Cross-branch Q attention (624 params, 2-head on 12 Q-values)
Task 7: Liquid tau per-branch dynamics (replaces spread_velocity)
Task 8: Mamba-2 selective replay (learned PER curriculum)
Task 9: Build verification + smoke tests
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-14 23:26:13 +02:00
jgrusewski
0cfb2c7786
fix: 6 concerns in Cross-Pollinated Branch Intelligence spec
...
1. Variable Selection: static → input-dependent bottleneck (true TFT VSN)
2. Q Attention: add direct gradient via Expected SARSA target integration
3. Liquid Tau: modulates IQL scales via separate liquid_mod[4] buffer
4. Selectivity: per_sample_loss proxy (per-sample grad norms infeasible at 32GB)
5. GLU gate: zero-init W_gate/b_gate → sigmoid(0)=0.5 (stable start)
6. Weight layout: updated for 8 VSN bottleneck matrices (indices 26-33)
NUM_WEIGHT_TENSORS: 26 → 42. Total new params: ~297K.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-14 23:14:41 +02:00
jgrusewski
8a9424b6eb
spec: Cross-Pollinated Branch Intelligence — 5-component unified design
...
Combines TFT Variable Selection, GLU Gating, Cross-Branch Q Attention,
Liquid adaptive tau, and Mamba-2 Selective Replay into unified branch
architecture. Plus 11-item dead code cleanup.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-14 23:06:18 +02:00
jgrusewski
f49ae6858e
fix: Layer 3 plan — add Q_dir normalization by delta_z
...
Raw E[Q] ~ 0.1 while h_s2 ~ 1.0 post-ReLU. Without normalization,
Q_dir columns learn 10x slower. Dividing by delta_z scales to ~1-10.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-14 22:30:29 +02:00
jgrusewski
8d2ed799e6
plan: direction-conditioned magnitude head (Layer 3) — 7 tasks
...
Tasks: CUDA kernel, param widening, forward conditioning, backward split,
zero-init, experience collector, H100 integration test.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-14 22:19:41 +02:00
jgrusewski
234870d966
spec: direction-conditioned magnitude head (Layer 3)
...
Magnitude FC input changes from h_s2[B, SH2] to [h_s2; Q_dir][B, SH2+3].
Direction E[Q] values (3 scalars per sample) are computed from branch 0
logits and concatenated. w_b1fc grows by 3*adv_h parameters (768 for AH=256).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-04-14 22:14:49 +02:00