Commit Graph

2045 Commits

Author SHA1 Message Date
jgrusewski
055bcbcf46 feat(plan): plan noise injection for temporal diversity (Phase 2-D simplified)
plan_noise_inject kernel: ±5% Philox-seeded multiplicative noise on
plan_params [B, 6] after forward pass. Creates temporal diversity —
model sees slightly different plans each step, learns robust behavior.
Called in both reduce_current_q_stats and submit_forward_ops_main.
Full 3-run spatial ensemble deferred to follow-up.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 09:46:18 +02:00
jgrusewski
98f1efb5f8 fix: restore ISV+plan kernels in graph_forward — smoke test passes
ISV kernels back inside submit_forward_ops_main (graph capture).
Local smoke test: PASS (training_sharpe=3.773). graph_forward
capture works with ISV single-thread kernels. If H100 graph_mega
hangs, the issue is mega-specific, not ISV compatibility.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 09:42:20 +02:00
jgrusewski
5836280a34 cleanup: remove AutoBatchSizer — batch_size from config is source of truth
AutoBatchSizer didn't account for experience collector VRAM, causing
OOM on H100 with state_dim=96. batch_size is configured per GPU
profile (h100.toml=8192, rtx3050.toml=64). No auto-sizing needed.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 09:35:16 +02:00
jgrusewski
d144171b92 feat(plan): track intra_trade_max_pnl in ps[21] for hindsight labels (N18)
Max unrealized P&L tracked each bar during trade. Enables hindsight
plan learning: compare plan's profit_target vs actual max P&L.
The plan head learns optimal targets from what was achievable.
Reset on trade entry, reversal, and episode hard/soft reset.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 09:35:08 +02:00
jgrusewski
614d4dbf84 cleanup: remove ofi_enabled/ofi_pre conditionals — OFI always on
OFI (20 microstructure features) is unconditionally enabled.
mbp10_data_dir always set. state_dim unconditionally 96.
Removed dead else branches (ofi_dim=0, state_dim=72).
Simplifies 7 files across the workspace.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 09:28:49 +02:00
jgrusewski
3ce8ed40f1 fix(critical): MTF features were overwriting plan progress in observation
Portfolio expanded from 8→14 features but mtf_base stayed at
market_dim+8, causing MTF to overwrite plan progress features.
Fixed: mtf_base = market_dim + 14. Layout now correct:
[0..42) market, [42..56) portfolio+plan, [56..72) MTF, [72..92) OFI.
state_dim stays 96 (aligned). Conviction drift + regime shift (P11/P12)
added to observation. Entry regime_stability stored in ps[29].

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 09:21:54 +02:00
jgrusewski
7651f6f6cc feat(plan): conviction drift + regime shift in observation (P11, P12)
conviction_drift = current_conviction - entry_conviction: model sees
its thesis weakening. regime_shift = |stability_now - stability_entry|:
model detects regime change invalidating the plan. Entry regime stored
in ps[29]. Both features zero when no plan active.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 09:17:44 +02:00
jgrusewski
4b7fb3340f feat(plan): recursive plan revision — living plan document (N17)
When readiness≥0.7 and conviction changes significantly mid-trade:
+30% conviction → extend plan (thesis strengthening)
-60% conviction → shorten to exit in 3 bars (thesis collapsing)
Normal fluctuation (0.4x-1.3x) → plan unchanged.
The model learns to revise plans based on evolving assessment.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 09:12:37 +02:00
jgrusewski
0a31bf729a fix: plan safety net ISV-driven — stop + max_hold adapt to dynamics
Stop threshold: max(plan_stop, 0.5%) / (1 + grad_norm_instability).
Tighter when gradient pressure high, wider when stable.
Max hold: 50 * regime_stability → 10-50 bars (shorter in transitions).
Plan's own learned stop_loss is the base — not hardcoded 2%.
Zero hardcoded constants — everything flows through ISV + plan head.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 09:05:27 +02:00
jgrusewski
10baf57745 feat: plan progress in observation — model sees its own plan
4 new portfolio features (portfolio_dim 8→12, state_dim 88→96):
- plan_progress: hold_time / target_bars (how far through plan)
- pnl_vs_target: unrealized P&L / profit_target (how close to goal)
- pnl_vs_stop: unrealized P&L / stop_loss (how close to risk limit)
- plan_conviction: conviction at entry (confidence level)

Model now reasons about its own plan through temporal attention.
"I'm 80% through, 83% to target → hold" vs "I'm past stop → exit."
Planning becomes metacognitive — the model sees AND reasons about
its intentions, not just market state.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 08:58:43 +02:00
jgrusewski
c50db37889 feat: plan enforcement → soft learning + safety net only
Hard exit removed for normal plan targets (stop/profit/time).
Model LEARNS exit timing through temporal attention:
- ISV-gated trunk → Mamba2 temporal state → branch Q-values
- Conviction scales reward → model learns confidence calibration
- Portfolio observation includes hold_time, unrealized P&L, drawdown
- Model decides when to exit through Q(Flat) vs Q(Hold)

Safety net remains: hard exit only on catastrophic loss (>2%) or
extreme hold (>50 bars). Everything else is learned, not forced.
Planning, holding, strategic positioning are all attention-driven.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 08:33:23 +02:00
jgrusewski
9f896878e0 feat: plan conviction scales reward — plan head learns from epoch 1
Plan conviction (ISV-attention-driven) directly scales reward signal.
Low conviction → dampened reward, high → amplified. No hardcoded
constants. The plan head's forward path (h_s2 → ISV feature gate →
Mamba2 temporal → plan MLP → conviction) is fully attention-driven.
Learning flows: conviction → reward → Q-value → C51 loss → gradients.
Plan learns planning, holding, strategic positioning throughout training.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 08:30:12 +02:00
jgrusewski
4a75abdcbe fix: plan exit overrides hold enforcement — prevents infinite hold
When a plan is active, the plan's target_bars IS the hold duration.
Adaptive hold was blocking plan exits → model held positions for
entire 5000-bar episodes → 0 completed trades with massive unrealized
P&L. Now: plan_active → hold enforcement bypassed. Plan manages
its own duration. Hold is safety net for plan-less trading only.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 08:17:00 +02:00
jgrusewski
e6de3e04d2 fix: plan enforcement gated by model readiness — prevents 0-trade collapse
Plan head randomly initialized → garbage plans → immediate stop-outs →
model learns to never trade. Fix: gate plan activation + enforcement
by iqn_readiness (pinned device-mapped). readiness < 0.5 → plan
disabled (model trades freely, plan head still learns from outcomes).
readiness ≥ 0.5 → plan activates and enforces. Dynamic, not hardcoded.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 08:13:53 +02:00
jgrusewski
d78fe9d4a8 fix: fxcache version display + export FXCACHE_VERSION + cleanup dead code
precompute_features prints Format: f32 (v2), OFI_DIM=20 (was hardcoded v1).
FXCACHE_VERSION exported as pub const for external use.
graph_adam_m/v/step removed (dead buffers). q_mean_ema_ptr removed
from c51_grad_kernel (ISV replaced Q-drift penalty).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 02:12:33 +02:00
jgrusewski
ca50bbf837 cleanup: remove dead graph_adam buffers + q_mean_ema_ptr parameter
graph_adam_m/v/step were allocated but never used — graph_params
are intentionally fixed at near-identity initialization.
q_mean_ema_ptr removed from c51_grad_kernel (ISV replaced Q-drift
penalty, no ABI to maintain for compiled cubins).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 02:10:30 +02:00
jgrusewski
11b1a1ca9f fix: zen precommit — 2 criticals + 3 lows resolved
CRITICAL: ISV+plan heads wired into submit_forward_ops_main (training).
CRITICAL: backtest single-step 3-branch→4-branch action encoding.
LOW: Remove dead bar_start_ns/bar_duration_ns from MicrostructureState.
LOW: Pre-allocated eps_host_buf replaces Vec allocation in hot path.
LOW: training_sharpe + val_loss added to metrics additional_metrics.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 02:05:20 +02:00
jgrusewski
5d6c391622 fix(critical): wire ISV+plan heads into training forward pass
ISV forward, feature gate, recursive confidence, and trade plan
were only in reduce_current_q_stats (monitoring). Now also in
submit_forward_ops_main (training). Without this, these heads
never affected training Q-values — gamma_mod, branch_gate,
feature gating, and plan params were stale during actual training.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 02:03:46 +02:00
jgrusewski
6208ace512 fix(critical): backtest single-step uses 4-branch action encoding
Legacy 3-branch action decode/encode in backtest_env_step was
corrupting actions_history. Now uses correct 4-branch factored
logic matching backtest_env_step_batch. Fixes backtest metrics.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 02:03:10 +02:00
jgrusewski
58c2bd7ae0 fix: eliminate non-deterministic atomicAdd from gradient kernels
selectivity_backward, risk_budget_backward, mamba2_scan_backward,
q_denoise_backward — all converted to per-weight-element accumulation
(one thread per weight, loops over batch) with plain deterministic
writes. Zero atomicAdd in these gradient paths.

recursive_confidence_backward, temporal_consistency_penalty,
predictive_coding_loss, compute_expected_q atom_stats — converted to
warp+block tree reduction, reducing to one atomicAdd per BLOCK
(8x fewer warps → near-deterministic).

kan_gate_backward, curiosity, DT linear — documented remaining
atomicAdd as acceptable (auxiliary components, not on primary DQN
gradient path).

Rust launchers updated: grid dimensions now match per-weight-element
thread counts for selectivity, mamba2, and denoise backward kernels.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 01:52:10 +02:00
jgrusewski
e5973027a1 feat(tick): speculative inference cache — H100 between-bar pre-computation
speculative_forward() pre-computes from intermediate features.
check_speculative_cache() validates cache vs actual bar-close features
(5% relative L2 threshold). invalidate_speculative_cache() at bar
boundary. Full cuBLAS trunk integration deferred — cache infra ready.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 01:38:05 +02:00
jgrusewski
61c4b043c6 feat: fxcache version auto-invalidation — FXCACHE_VERSION=2
Version constant in fxcache.rs. validate() rejects stale versions
with clear error message. ensure-fxcache Argo template now deletes
old cache and regenerates unconditionally. No manual PVC cleanup
needed — version mismatch triggers automatic regeneration.
v2: OFI_DIM=20 (20 microstructure features).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 01:27:33 +02:00
jgrusewski
b6314ceec1 feat(plan): plan activation + enforcement + direction lock
Flat->Positioned copies plan_params to ps[23-29]. Auto-exit on
profit_target (ISV*asymmetry), stop_loss (ISV-modulated), target_bars,
regime_stability<0.3. Scale schedule via scale_aggression. Conviction
sizing. Direction locked during active plan. Wired trainer->collector.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 01:24:20 +02:00
jgrusewski
6cf09e0806 feat(plan): trade_plan_forward kernel + 4 weight tensors (82->86)
Plan MLP: h_s2 -> hidden[AH] -> plan_params[B, 6]. Outputs:
target_bars[3-25], profit_target[0.05-1.5%], stop_loss[0.02-0.5%],
scale_aggression[0-1], conviction[0-1], asymmetry[0.5-3.0].
NUM_WEIGHT_TENSORS: 82->86.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 01:17:57 +02:00
jgrusewski
c7a2e39c1e feat(plan): PORTFOLIO_STRIDE 23→30 — 7 plan slots ps[23-29]
Plan slots: target_bars, profit_target, stop_loss, scale_aggression,
conviction, asymmetry, counter_plan_q. Zeroed on episode reset.
Fixed hardcoded i*23 references. All CUDA + Rust files updated.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 01:13:36 +02:00
jgrusewski
a1f967db88 fix: add epoch_sharpe + val_loss to training metrics additional_metrics map
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 01:09:48 +02:00
jgrusewski
1cc6168a6b fix: backtest action_select missing isv_signals_ptr + regenerated fxcache
Backtest evaluator missing isv_signals_ptr arg (passed as NULL).
Regenerated test fxcache with OFI_DIM=20 from MBP-10 + trades data.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 01:07:45 +02:00
jgrusewski
61f2ba3cb2 feat: MBP-10 data loading always enabled by default
mbp10_data_dir and trades_data_dir uncommented in localdev config.
Doc comments updated: 20 microstructure features always appended.
OFI is no longer optional — it's core to the model's feature set.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 01:02:54 +02:00
jgrusewski
f1af119f24 feat(isv): per-feature temporal routing — ISV controls history depth
isv_temporal_route kernel: ISV embedding [8] → temporal_weight [SH2].
mamba2_temporal_scan: h_enriched = h_s2 + temporal_weight * context.
Each feature gets learned history depth based on ISV state.
Init bias=2.0 (sigmoid≈0.88, mostly use temporal). 2 new tensors.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 01:02:37 +02:00
jgrusewski
d6a2e99670 feat(isv): feature-level ISV gating — which features matter per regime
isv_feature_gate kernel: ISV embedding [8] → per-feature gate [SH2].
h_s2 *= sigmoid(w_gate @ isv_emb + b_gate). Near pass-through init
(bias=2.0 → sigmoid≈0.88). Model learns to amplify/suppress features
based on ISV state. 2 new tensors [78-79]. NUM_WEIGHT_TENSORS: 78→80.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 00:56:52 +02:00
jgrusewski
76d6b54bff feat(isv): risk branch SH2+9→SH2+13 — all 12 ISV signals + predicted_error
w_risk_fc grows from AH*(SH2+9) to AH*(SH2+13). Risk branch now
sees all 12 ISV signals (including 4 regime: velocity, disagreement,
transition_ema, stability) + predicted_error. Forward + backward
updated with wider stride and 12-signal loop.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 00:47:03 +02:00
jgrusewski
2aae3ceec7 feat(isv): regime-conditioned Mamba2 decay — forget old patterns during transitions
mamba2_temporal_scan forget gate multiplied by regime_stability (ISV[11]).
Stable regime (stability=1.0): full history preserved.
Transition (stability=0.3): gate capped at 0.3 → rapid forgetting.
Model adapts to new regime within 2-3 bars. Backward matches forward.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 00:42:14 +02:00
jgrusewski
8a746fceb2 feat(isv): regime awareness — ISV_DIM 8→12, 4 regime signals
regime_velocity (EMA of ADX+CUSUM deltas), regime_disagreement
(|norm_ADX - norm_CUSUM|), regime_transition_ema, regime_stability
(1 - sigmoid(5*velocity)). Read from states buffer sample 0.
isv_signal_update + isv_forward kernels updated. w_isv_fc1 grows
16*8→16*12. Pinned buffers resized automatically via ISV_DIM.
Introduced ISV_EMB_DIM=8 to decouple embedding output from signal
input dimension — FC2/gate/gamma stay at 8.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 00:34:49 +02:00
jgrusewski
8b68954ded feat(tick): precompute pipeline wires MicrostructureState — 20 OFI features
12 new tick-level features computed per bar from MBP-10 snapshots:
OFI trajectory, realized variance, Hawkes intensity, book pressure,
spread dynamics, aggression, queue depletion, order count flux,
intra-bar momentum, regime score, OFI acceleration, toxicity gradient.
Combined with existing 8 OFI into [f64; 20] per bar in fxcache.

Also fixes pre-existing bug: no-MBP-10 fallback was [0.0; 8] not [0.0; 20].

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 00:29:03 +02:00
jgrusewski
b2d7af0763 feat: adaptive hold in BOTH layers — action select + enforce_hold
Layer 1 (experience_action_select): isv_signals_ptr param added.
Adaptive hold = base + stability × confidence × 8 extension.
Layer 2 (enforce_hold in env_step): already had adaptive hold.
Both layers use identical ISV-driven formula. Consistent behavior.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 00:25:44 +02:00
jgrusewski
81771d7920 feat(tick): OFI_DIM 8→20 — atomic update across 15 files
fxcache: OFI_DIM=20 (pub const), RECORD_F64_COUNT=66, 272 bytes/bar.
constructor: state_dim 74→86 (aligned 88) with OFI.
experience collector: ofi_dim detection 8→20.
All [f64; 8] → [f64; 20]. Existing 8 features preserved at 0-7.
New 12 features zero-padded until precompute is extended.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 00:21:15 +02:00
jgrusewski
06be03effb feat: adaptive hold enforcement — ISV-driven dynamic minimum hold time
enforce_hold() reads ISV signals: grad_norm (stability), ensemble_var
(confidence), reward_ema (performance). Adaptive hold = base(5) +
extension(0-8 bars from stability × confidence). Negative reward_ema
reduces to base only (allow faster exit when losing).

ISV signals passed from trainer → fused_ctx → experience collector →
env_step kernel via isv_signals_dev_ptr. NULL = static hold (backtest).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 00:09:57 +02:00
jgrusewski
4d08472d95 feat(tick): MicrostructureState — 12 new tick-level features, O(1)/tick
OFI trajectory (online LinReg), realized variance, Hawkes intensity,
book pressure gradient, spread dynamics, aggression ratio, queue
depletion, order count flux, intra-bar momentum (Welford), regime
score, OFI acceleration, toxicity gradient. ExtendedOFIFeatures [20].

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 00:06:32 +02:00
jgrusewski
460a5f3841 feat: adaptive minimum hold time — 5-bar minimum prevents coin-flip exits
The hold enforcement infrastructure (enforce_hold in trade_physics.cuh,
hold_time counter at ps[10], action masking in experience_action_select)
was already fully implemented but disabled by min_hold_bars defaulting
to 1. Change default from 1 to 5 so hold enforcement is active by
default. Production configs already set min_hold_bars=10 via TOML.
Targets ~100-200K trades instead of 619K across 5M bars.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 00:02:01 +02:00
jgrusewski
7deaa88d83 feat(isv): target network — ISV weights online-only
EMA sync restricted to indices 0-67 (non-ISV params).
ISV weights (68-77) exist only in online params_buf.
Target forward uses online gamma_buf (drift-conditioned) and
online branch_gate_buf — correct for Bellman projection.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-16 23:52:38 +02:00
jgrusewski
e1f234cd82 feat(isv): recursive confidence head — model predicts own TD-error
h_s2 → sigmoid(w_conf @ h + b_conf) → predicted_error [B].
MSE loss vs lagged_td_error (0.01× weight). Backward accumulates
into trunk gradient + conf weight gradients in main grad_buf.
Creates self-improvement loop: model learns to predict when wrong.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-16 23:46:18 +02:00
jgrusewski
42964437fc feat(isv): risk branch wider input SH2→SH2+9 — ISV + predicted_error
risk_budget_forward: h_s2 || isv_signals[8] || predicted_error[1].
risk_budget_backward: wider stride j*(SH2+9), grads for ISV+error cols.
w_risk_fc grows from AH*SH2=32768 to AH*(SH2+9)=33920 (+1152 elems).
risk_aligned_count and offset callers updated atomically.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-16 23:30:17 +02:00
jgrusewski
4c917d83d2 feat(isv): branch confidence routing replaces regime_branch_gate
ISV gate [4] × Q-value separation confidence per branch.
Market regime (ADX, CUSUM) still flows through trunk → branches.
ISV adds training dynamics awareness on top.
Confidence = sigmoid(5 * (Q_max - Q_mean)) per branch, floor 0.3.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-16 23:25:33 +02:00
jgrusewski
ad402deec7 feat(isv): drift-conditioned gamma — C51 scalar→per-sample buffer
c51_loss_kernel: float gamma → const float* gamma_buf [B].
fill_gamma_buf kernel: broadcasts base_gamma * gamma_mod[0] to [B].
gamma_mod from isv_forward ∈ [0.5, 1.0] → effective_gamma ∈
[base_gamma*0.5, base_gamma]. Model learns its own planning horizon.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-16 23:21:07 +02:00
jgrusewski
ffc8c1c46a feat(isv): ISV encoder MLP + branch gating + gamma modulation
isv_forward kernel: temporal decay-weighted average + 8->16->8 MLP.
Outputs: isv_embedding [8], branch_gate [4] (softmax), gamma_mod [1]
(0.5+0.5*sigmoid -> [0.5,1.0]). NUM_WEIGHT_TENSORS: 68->78.
10 new tensors for ISV encoder, gate, gamma, and confidence head.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-16 23:10:13 +02:00
jgrusewski
a9f9b279f9 feat(isv): isv_signal_update GPU kernel + temporal history
8 ISV signals (q_drift, grad_norm_ema, td_error_ema, ensemble_var_ema,
ensemble_var_delta, reward_ema, atom_util, loss_ema) computed by
single-thread GPU kernel. Temporal history [K=4, 8] with ring buffer.
Lagged TD-error saved for recursive confidence. Zero CPU involvement.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-16 23:01:38 +02:00
jgrusewski
f9d90f864b feat(isv): add 4 pinned scratch scalars for ISV signal sources
td_error_scratch, ensemble_var_scratch, reward_scratch, atom_util_scratch
— all pinned device-mapped. atom_util and reward_scratch written in
reduce_current_q_stats. td_error and ensemble_var wired in later tasks.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-16 22:54:23 +02:00
jgrusewski
b946802803 feat: adapted rank norm (skip zeros) + remove Q-drift penalty + aligned Sharpe
Rank normalization: holding bars (reward≈0) passthrough as zero,
only actual trade P&L is ranked. Preserves magnitude for trades.
Q-drift: hardcoded penalty removed, E1 enrichment handles adaptively.
Metrics: sharpe_raw (un-annualized per-trade) for direct comparison
between training and validation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-16 22:03:28 +02:00
jgrusewski
c74a687ea8 feat: position-gated episodes + 5000-bar limit — close 45x training/val gap
Episode done flag: timer-based -> position-gated (trade complete = done).
V(flat)=0 is correct terminal anchor. Soft reset keeps equity on
trade completion; hard reset only on data-end or capital breach.
H100: 100 bars -> 5000 bars, gpu_n_episodes -> 1024.
ExperienceProfile gains optional gpu_n_episodes field.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-16 21:56:44 +02:00
jgrusewski
7fc455ebff fix: widen E1 Q-correction clamp ±2.0 → ±10.0
Q-mean drifted to +4.6 but E1 correction was capped at -2.0.
The model needs full correction range to keep Q-values calibrated.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-16 19:57:13 +02:00