Commit Graph

3732 Commits

Author SHA1 Message Date
jgrusewski
8499b4ee1b feat: wire temporal pipeline + fix hold + add aux_frequency
1. Temporal pipeline in training forward (submit_forward_ops_main):
   - mamba2_step: temporal scan enriches h_s2 with history
   - compute_predictive_coding_loss: temporal smoothness
   - apply_regime_dropout: regime-conditioned dropout
   - launch_isv_temporal_route: per-feature temporal weights
   - risk_budget_forward: risk budget from h_s2
   These were only in the monitoring path (reduce_current_q_stats),
   never in the actual training forward. The model trained without
   any temporal context.

2. ISV signal update after each adam step:
   update_isv_signals() called after mamba2 backward, reads pinned
   loss/grad_norm/Q-mean and updates the 12-element ISV vector.
   Was never called during training — ISV signals stayed at zero.

3. Backtest min_hold fixed:
   eval_min_hold was hardcoded 0 — no hold enforcement in validation.
   Now uses config.min_hold_bars.

4. Backtest ISV signals:
   Passes frozen ISV signals from last training step to validation
   backtest for adaptive hold enforcement.

5. aux_frequency parameter (default 4):
   IQL, IQN, attention, CQL run every 4th step instead of every step.
   ~4x faster epochs. graph_forward still runs every step.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 22:15:57 +02:00
jgrusewski
f9aedb1b05 fix: use split graphs (graph_forward + graph_aux) — graph_mega replay hangs
graph_mega captures spectral+forward+aux in one graph. Replay hangs
on Hopper even with cudarc wrapper. Split graphs work: graph_forward
(from GpuDqnTrainer) + graph_aux (cudarc wrapper). Both graphed,
2 launches per step instead of 1.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 21:15:39 +02:00
jgrusewski
1aadf7c8d3 feat: graph_mega re-enabled via cudarc wrapper — full single-launch pipeline
Rewrote capture_graph_mega to use cudarc's begin_capture/end_capture
instead of raw cuda_sys. Same fix that resolved graph_aux hang.
All graph types (graph_mega, graph_aux, graph_spectral) now use
cudarc wrapper consistently. Falls back to split graphs if mega fails.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 20:56:39 +02:00
jgrusewski
2aa955f0dd feat: log full validation backtest metrics — Sharpe + Sortino + WinRate + MaxDD + Trades + Calmar
compute_validation_loss only returned Sharpe, discarding all other
backtest metrics. Now logs the complete picture on every epoch so we
can verify if the learning system actually works on out-of-sample data.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 20:48:35 +02:00
jgrusewski
30e94446cd fix: compute bars_per_day from fxcache timestamps — correct annualization
bars_per_day was hardcoded 390 (1-minute candles) but we use MBP-10
imbalance bars (~7500/day). All Sharpe/Sortino/return annualization
was off by sqrt(7500/390) ≈ 4.4×.

Now computed from actual fxcache timestamps:
  bars_per_day = total_bars / (trading_days from timestamp span)

Propagates to: val_Sharpe, train_Sharpe, financials, backtest evaluator.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 20:46:04 +02:00
jgrusewski
0c06aeca5a fix: replace raw cuda_sys graph capture with cudarc wrapper
Root cause: capture_graph_aux and capture_graph_spectral used raw
cuda_sys::cuStreamBeginCapture_v2 / cuStreamEndCapture, bypassing
cudarc's internal state tracking. Mixing raw FFI with cudarc's
managed context corrupts the captured graph, causing replay hangs.

capture_training_graphs (GpuDqnTrainer) always used cudarc's
stream.begin_capture() / stream.end_capture() and worked. Now all
graph captures use the same cudarc wrapper.

All graphs re-enabled: graph_forward, graph_forward_ddqn, graph_adam,
graph_spectral, graph_aux. Full graphed pipeline.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 19:37:32 +02:00
jgrusewski
8f2f72430e fix: also skip graph_aux CAPTURE — capture itself corrupts stream state
graph_aux was still being captured (then not replayed). The capture
process uses cuStreamBeginCapture which corrupts cudarc's internal
state, causing the NEXT graph_forward replay to hang on step 2.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 19:25:31 +02:00
jgrusewski
e03da19051 fix: run aux ops ungraphed — graph_aux replay hangs on Hopper
graph_forward replays fine (step 1 completes in 3.8s).
graph_aux replay hangs on step 2. All aux ops work ungraphed
(confirmed by diagnostic run). Keep graph_forward graphed for
speed, run aux ops directly on stream until root cause found.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 19:11:29 +02:00
jgrusewski
92b61c5d96 fix: disable_event_tracking in capture_graph_aux and capture_graph_spectral
Root cause: cudarc's device_ptr() records CudaEvents during graph
capture, silently corrupting the graph. capture_training_graphs
(GpuDqnTrainer) already disabled event tracking, but capture_graph_aux
and capture_graph_spectral (FusedTrainingCtx) did not.

With state_dim=88 this was harmless. With state_dim=96, different
buffer layouts trigger event recording paths in IQL/IQN/attention,
producing a corrupted graph that hangs on replay.

Diagnostic confirmed: all ops complete ungraphed, graph_aux capture
returned CUDA_ERROR_STREAM_CAPTURE_INVALIDATED.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 18:54:33 +02:00
jgrusewski
cb3c282188 diag: sync after every aux op to find exact hanging kernel
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 18:24:32 +02:00
jgrusewski
0fb4c6803f test: run ungraphed to isolate graph vs kernel bug
Skip all CUDA Graph capture — run cuBLAS + kernels directly on stream.
If this works, the hang is graph replay. If not, it's a kernel bug.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 17:14:16 +02:00
jgrusewski
9c6c516d21 Revert "test: revert experience_kernels.cu to working SHA — cubin isolation test (PUSHED)"
This reverts commit 3201123ae3.
2026-04-17 17:05:34 +02:00
jgrusewski
3201123ae3 test: revert experience_kernels.cu to working SHA — cubin isolation test (PUSHED)
If graph_forward works with the working SHA cubin but hangs with
current cubin, nvcc register allocation changes from new/modified
kernels in the same compilation unit affect graph-captured kernels.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 17:03:23 +02:00
jgrusewski
f0ec0a74d1 fix: use CU_STREAM_CAPTURE_MODE_GLOBAL for cuBLAS graph capture on Hopper
NVIDIA docs: cuBLAS with cublasLtMatmul requires GLOBAL capture mode,
not THREAD_LOCAL. THREAD_LOCAL allows cuBLAS internal cudaMallocAsync
to escape the capture scope on sm_90, corrupting the graph.

Also reverts all previous workaround attempts (workspace=0, ldb padding,
bn_concat stride) — the capture mode was the root cause.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 16:48:37 +02:00
jgrusewski
ab8145875c fix: cuBLAS workspace=0 forces graph-safe algorithms on Hopper
Workspace-using cublasLt algorithms on sm_90 employ TMA (Tensor Memory
Accelerator) internally. TMA state is not captured by CUDA Graphs,
causing replay hangs. Setting MAX_WORKSPACE_BYTES=0 in the algorithm
heuristic forces workspace-free algorithms guaranteed graph-compatible.

Applied to all 4 GEMM descriptor creation paths:
- batched_forward.rs: cached + uncached + relu_bias
- batched_backward.rs: cached

Removed ws_size parameter from descriptor creation functions — no
longer needed. ~5-10% GEMM perf cost vs full workspace, negligible
vs total step time.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 16:20:56 +02:00
jgrusewski
3462743c59 fix: disable graph_mega — use split graphs (graph_forward + graph_aux)
graph_mega uses raw cuda_sys FFI for capture which hangs on Hopper
with state_dim=96. Split graphs use cudarc's begin/end_capture which
handles event tracking correctly. 3 launches vs 1 per step — ~2µs
overhead, negligible vs ~160ms step time.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 15:53:53 +02:00
jgrusewski
0c247535b9 fix: pad bn_concat stride to 128 — forces graph-compatible cuBLAS algo on Hopper
state_dim 88→96 changed s1_input_dim (62→70), causing cuBLAS
heuristic to pick a CUDA Graph-incompatible algorithm on sm_90.
Padding bn_concat's leading dimension to 128 (CUTLASS K-tile)
forces tile-aligned algorithms that work in graph replay.

Changes:
- batched_forward.rs: s1_ldb always pad128 when bottleneck active
- gpu_dqn_trainer.rs: bn_concat_buf allocated with padded stride
- dqn_utility_kernels.cu: bn_tanh_concat_kernel takes concat_stride param

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 15:42:56 +02:00
jgrusewski
4483bf0f93 fix: disable event tracking during graph_mega capture — fixes H100 hang
capture_graph_mega was missing disable_event_tracking() that
capture_training_graphs already had. With state_dim=96, cudarc's
device_ptr() calls inside cuBLAS record CudaEvents during graph
capture, which are disallowed and corrupt the graph on Hopper.

Also reverts c51_grad/c51_loss/dqn_utility kernel files to working
SHA — removes all symptom-chasing changes that were red herrings.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 15:25:06 +02:00
jgrusewski
996be07a54 Revert "test: revert experience_kernels.cu to working SHA — cubin isolation test"
This reverts commit 18c0107ce5.
2026-04-17 15:22:49 +02:00
jgrusewski
18c0107ce5 test: revert experience_kernels.cu to working SHA — cubin isolation test
Temporarily reverts ALL experience_kernels.cu changes to match 11b1a1ca9
exactly. If graph_mega works, the cubin-level changes (new plan_noise_inject
kernel + modified experience_state_gather/env_step bodies) are affecting
register allocation for graph_mega kernels on Hopper.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 15:13:15 +02:00
jgrusewski
924aaa775e fix: restore c51_grad 19th param + HER (32,1,1) — match working SHA graph_mega
graph_mega on Hopper requires EXACT node structure match with working
SHA 11b1a1ca9. Two remaining differences caused the hang:
- c51_grad: 18→19 params (restored unused q_mean_ema_ptr)
- HER relabel: (1,1,1)→(32,1,1) (restored warp-parallel launch)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 14:58:58 +02:00
jgrusewski
709fffe923 fix: revert c51_loss_reduce to (1,1,1) — same Hopper graph hang class
The warp-parallel (32,1,1) change to c51_loss_reduce caused the same
hang as isv_feature_gate: changing block_dim inside graph_mega alters
CUDA Graph node structure on Hopper's TMA scheduler. Must stay (1,1,1).

Also: batch_size 8192→16384, gpu_n_episodes 1024→4096, num_atoms 51→52
to align h100.toml with dqn-production.toml.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 14:46:15 +02:00
jgrusewski
8b51588d97 fix: revert isv_feature_gate to in-place — fixes graph_mega hang on H100
Root cause: the read→write split (save_h_s2 → gated_h_s2_buf) removed the
WAW dependency that cuBLAS's internal TMA async ops on Hopper (sm_90)
require for correct CUDA Graph replay ordering. In-place modification
restores the dependency chain: cuBLAS forward → isv_feature_gate → backward.

Also upgrades c51_loss_reduce from sequential to warp-parallel reduction
(32 threads, __shfl_down_sync) — ~32× faster for B=8192.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 14:29:52 +02:00
jgrusewski
0d86c5e283 fix: revert ALL block_dim (32,1,1) back to (1,1,1) — eliminates ALL race conditions
The block_dim (1,1,1) → (32,1,1) change introduced race conditions
in every single-thread kernel that writes to shared scalars.
Fixed stochastic_depth_rng and c51_loss_reduce individually, but
there may be more. Safest fix: revert ALL to (1,1,1) matching the
working 11b1a1ca9. These kernels are tiny (single-thread work) —
the 32-thread "optimization" wasted 31 threads and added races.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 13:34:02 +02:00
jgrusewski
ca7dfa9f08 fix(critical): c51_loss_reduce missing threadIdx guard — 32-way write race
SECOND race condition from block_dim (1,1,1)→(32,1,1) change:
c51_loss_reduce had 32 threads all computing sum and writing to
total_loss[0] simultaneously. On sm_90 (H100) → corrupted loss →
NaN in C51 gradient → graph_mega replay hangs.

This kernel runs INSIDE graph_mega (submit_forward_ops_main),
called twice (MSE reduce + C51 reduce). Both corrupted.

Also fixed stochastic_depth_rng in previous commit (same issue,
runs in pre-replay).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 13:19:39 +02:00
jgrusewski
c7fa67159c fix(critical): stochastic_depth_rng missing threadIdx guard — 32-way race
Root cause of graph_mega hang: stochastic_depth_rng kernel had NO
threadIdx.x guard. When block_dim changed from (1,1,1) to (32,1,1),
all 32 threads wrote to scale_buf[0..2] and rng_state[0] simultaneously.
Race condition → corrupted stochastic depth scales → NaN in cuBLAS
forward → C51 Bellman projection diverges → infinite loop → hang.

Fix: if (threadIdx.x != 0) return; — single writer for 3 scale + 1 rng.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 12:57:18 +02:00
jgrusewski
2c8967ad96 feat: compute-sanitizer support in Argo training workflow
Usage: ./scripts/argo-train.sh dqn --baseline --epochs 2 --sanitizer memcheck
       ./scripts/argo-train.sh dqn --baseline --epochs 1 --sanitizer synccheck

Tools: memcheck (OOB, uninitialized), racecheck (data races),
synccheck (__syncthreads divergence/deadlocks).
10-100x slower — use with 1-2 epochs for debugging.
Detects exact kernel + line causing GPU hang.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 12:24:23 +02:00
jgrusewski
88307b8e3b test: remove plan_noise_inject from graph_mega — isolating hang cause
plan_noise_inject is the ONLY new kernel inside graph_mega vs the
working 11b1a1ca9. Everything else is identical (submit_forward_ops_main,
submit_aux_ops, capture_graph_mega). If this fixes the hang,
plan_noise_inject is incompatible with graph_mega on sm_90.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 11:58:08 +02:00
jgrusewski
f264ba00cb fix: ISV+plan kernels BACK inside graph_mega (matching working 11b1a1ca9)
Reverted to the structure that WORKED on H100: ISV kernels inside
submit_forward_ops_main (captured in graph_mega). Removed duplicate
pre-replay calls. The working version had ISV in graph_mega — removing
them was wrong. Added plan_noise_inject to the same block.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 11:53:29 +02:00
jgrusewski
2f4a669392 fix: revert recursive_confidence_backward to original warp+block reduction
The per-weight-element rewrite (2 blocks, B=8192 loop) caused
graph_mega replay to hang on H100 sm_90. The original warp+block
reduction (ceil(B/256) blocks, atomicAdd per block) worked on H100.
Reverted to working version. Remove duplicate fill_gamma_buf from
pre-replay (already inside graph_mega).

Root cause investigation pending — the per-weight-element pattern
works on sm_80 (RTX 3050) but hangs on sm_90 (H100).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 11:35:28 +02:00
jgrusewski
5ce0454ceb fix(critical): recursive_confidence_backward — per-weight-element, zero syncthreads
ROOT CAUSE of graph_mega hang: the warp+block reduction in
recursive_confidence_backward had 256 iterations of __syncthreads
inside a loop (2 syncs × SH2=256 = 512 barriers per thread).
This overwhelmed the CUDA graph node scheduler on H100.

Fix: converted to per-weight-element pattern (same as other
deterministic backward kernels). One thread per weight (SH2+1=257),
loops over B samples. Zero __syncthreads, zero atomicAdd,
zero shared memory. Graph-mega safe.

Grid: ceil(257/256)=2 blocks (was ceil(8192/256)=32 blocks).
Massive resource reduction + deterministic + graph compatible.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 10:54:50 +02:00
jgrusewski
341346af09 fix: ISV+plan kernels run pre-mega-replay, not inside graph_mega
NVRTC-compiled ISV kernels conflict with cuBLAS GEMM internal stream
scheduling when captured in the same CUDA Graph as cuBLAS ops.
Moving ISV+plan to pre-replay phase: they run BEFORE graph_mega
replay on every training step. Their outputs (gamma_mod_buf,
branch_gate_buf, gated_h_s2_buf, predicted_error_buf, plan_params_buf)
are stable device buffers consumed by the captured graph.
Same result, no deadlock. ISV updates every step (not every 50).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 10:36:23 +02:00
jgrusewski
99f1687972 fix(critical): gated_h_s2_buf — stop in-place modification of save_h_s2
ROOT CAUSE of graph_mega hang: isv_feature_gate modified save_h_s2
in-place. cuBLAS backward (later in graph_mega) reads save_h_s2
expecting ORIGINAL (pre-gate) values for correct gradient computation.
The gated values corrupted gradients → GPU hang.

Fix: separate buffers. save_h_s2 preserved for backward (unmodified).
gated_h_s2_buf receives ISV-gated output for branch heads.
recursive_confidence_forward, trade_plan_forward, risk_budget_forward
now read from gated_h_s2_buf.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 10:17:41 +02:00
jgrusewski
8832268a54 fix: single-thread kernels → full warp (32 threads) for graph_mega
CUDA Graph mega capture hangs with block_dim=(1,1,1) kernels.
Changed all ISV/plan single-thread launches to block_dim=(32,1,1).
Kernels already guard with if(threadIdx.x != 0) return — only
thread 0 does work, rest idle. Full warp is graph scheduler
friendly. Local smoke test passes.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 09:56:04 +02:00
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
de13c165da fix: production batch_size 16384→8192 — OOM with state_dim=96
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 09:25:15 +02:00
jgrusewski
f1be4619e0 fix: H100 VRAM fraction 0.70→0.55 — OOM with state_dim=96 + 86 tensors
batch_size auto-scaled to 16384 consuming 78GB, leaving only 3GB
for experience collector → OOM. Reducing replay buffer fraction
gives more headroom. state_dim grew 88→96 (plan features), weight
tensors grew 68→86 (ISV + plan head).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 09:23:51 +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
70fca46227 revert: H100 pool back to min_size=0 — too expensive to keep warm
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 09:13:46 +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
33e9d80600 infra: H100 pool min_size=1 — keep node warm, skip 15-min driver install
Scaleway Kapsule GPU nodes need NVIDIA driver DKMS compile on cold
start (~15 min). Setting min_size=1 keeps the node warm between runs.
Scale to 0 manually when done training for the day.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 09:12:36 +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
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
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