Three coordinated changes to remove anti-aligned components from
the reward pipeline. Predicted Pearson trajectory based on Phase 3A
audit was wrong (PopArt + hindsight only delivered +0.04 not +0.4),
but the deep Phase 3B-Z audit revealed the "low Pearson" was largely
a measurement artifact: raw_reward tracks ALL PnL events (including
fees + partial closes via pos.realized_pnl_delta) while diag's
realized_pnl_usd_cum tracks only full closures. The actual training
reward IS aligned with total realized PnL evolution.
## Changes
* Slot 753 RL_SURFER_SCAFFOLD_WEIGHT_INDEX bootstrap 1.0 → 0.0
(Phase 5 hold-bonus/entry-cost/short-hold-penalty/long-ride-bonus
shaping disabled — was the dominant anti-aligned contaminant per
Phase 3A audit and cluster 2A-E evidence of +$201M shaped vs
-$330M actual).
* New ISV slot 793 RL_POPART_NORMALIZE_ENABLED_INDEX bootstrap 0.0
(PopArt batch normalization disabled — was found to sign-flip
rewards under adverse batch composition).
* Hindsight injection (rl_hindsight_inject.cu wants_inject) extended
with scaffold_w > 0.5 condition (when slot 753 = 0, hindsight off).
Semantically pairs the two training scaffolds.
## Verification
* 13/13 multi_head_policy_invariants PASS (no regression).
* FOXHUNT_USE_MULTI_HEAD_POLICY=0/1 ./scripts/determinism-check.sh
--quick: both exit 0.
* Local single-seed mid-smoke (b=128, seed 42):
- eval pnl: -$4.6M (vs Phase 0 baseline -$4.46M, within noise)
- 14,691 trades training / 3,268 eval (healthy, not paralyzed)
- action_entropy 1.82 at step 1999 (below uniform 2.40, learning)
- 0 NaN, exit 0
## Pearson interpretation (Phase 3B-Z audit)
The Pearson 0.38 between raw_reward and pnl_step_close_usd_delta is
a structural mismatch between two valid PnL views (all events vs
close events only), NOT an anti-alignment. raw_reward at slot
753 = 0 is the delta of pos.realized_pnl which already aggregates
the events we care about for total-USD optimization.
Cluster verification (Phase 3C, next) will reveal whether the
removal of Phase 5 + popart + hindsight produces a base policy
that can learn at scale. The 2A-E cluster catastrophe (-$330M)
was driven by Phase 5 shaping that's now disabled.
Plan: docs/superpowers/plans/2026-06-03-reward-alignment-gae-
combined.md
Linked pearls:
* pearl_reward_signal_anti_aligned_with_pnl
* pearl_phase5_term_4_is_almost_potential
* pearl_popart_blind_to_session_signals
* pearl_pure_pnl_mode_starves_b16_controllers
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
# Phase 3 — Reward-PnL Alignment via GAE-Propagated Pure-PnL Reward
> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
**Date:** 2026-06-03
**Goal:** Eliminate the load-bearing reward-pnl misalignment by combining two committed-but-dormant building blocks: GAE λ-returns over the rollout buffer (Phase 1B foundation) + pure-pnl reward mode (slot 753 = 0).
**Architecture:** Pure-pnl alone is aligned-but-sparse (June-01 b55 cluster: Pearson=0.92 ✓ but bootstrap failed). GAE alone propagates whatever signal you give it. Combined, they produce dense, aligned gradient signal — a combination that has never been tested. Phase 2A multi-head infrastructure stays committed but disabled until the base policy is verified to learn on clean reward.
**Tech Stack:** Rust + CUDA, foxhunt-discipline (no atomicAdd, no raw memcpy on regular slices, ISV-driven controllers, scoped_init_seed for determinism, flag-gated rollback via FOXHUNT_USE_ROLLOUT + ISV slot 753).
---
## 0. Decisive empirical evidence (motivating this plan)
Phase 2A-E cluster run `alpha-rl-xq2jq` (SHA `c5036af03`, b=1024 fold-1 L40S, terminated 2026-06-03 at step 10,106 / 20,000):
The two reward streams are perfectly anti-correlated. Every step the agent takes that grows `shaped_reward` destroys `realized_pnl`. This is the same misalignment in `pearl_reward_signal_anti_aligned_with_pnl.md` ("the load-bearing bug behind 64 negative-eval commits"), now captured at unprecedented signal strength thanks to the Phase 0 diag fix (`cfaa420bd`) that separated shaped vs USD fields.
**Multi-head architecture is NOT the bug.** Phase 2A-E confirmed multi-head functions correctly at cluster scale (heads diverge, kernels deterministic, gate-LR controller works). The architecture cannot paper over a wrong target.
## 1. Diagnostic chain — why pure-pnl alone failed before
The June-01 cluster smoke `alpha-rl-8fb55` (SHA `fa347e481`) tested pure-pnl mode in isolation:
```
Pearson(reward, Δpnl): 0.92 ✓ ALIGNED
action_entropy: 1.9-2.1 (random log(11)=2.40)
wr: 0.30 (random baseline)
pnl: -$3.9M (bled)
```
Pure-pnl was aligned but couldn't bootstrap. Per `pearl_advantage_kernel_is_done_gated_td_not_gae` the advantage kernel is done-gated 1-step TD with T_eff=1: gradient only flows at close events (~5-7% of steps). A random-init policy doesn't see enough signal to find profitable patterns.
Phase 5 shaping was inadvertently acting as a bootstrap scaffold (DENSE signal that taught the random-init policy what to optimize) — but at the cost of anti-alignment with real pnl.
**The fix that hasn't been tried:** make the GAE backward sweep propagate the (sparse but aligned) close-event pnl signal to held states. T_eff jumps from 1 to 13.56 (λ=0.95, γ=0.975). Dense AND aligned simultaneously.
## 2. Building blocks (all already committed)
| Block | Commit | Status | Purpose |
|---|---|---|---|
| Phase 1B-A: RolloutBuffer + GAE kernel structures | `5cd2f8703` | committed, dormant | Foundation for backward sweep |
| Phase 1B-B: Rollout collection loop + `FOXHUNT_USE_ROLLOUT` flag | `779c03b9d` | committed, dormant | Per-step buffer fill |
**Goal:** Real ground-truth at cluster scale. Verify the GAE+pure-pnl combination produces an aligned, bootstrap-capable policy with a real eval verdict.
**Config:**
- HEAD: at end of Phase 3D commits
-`FOXHUNT_USE_ROLLOUT=1` (GAE active)
- slot 753 = 0 (pure-pnl reward)
-`FOXHUNT_USE_MULTI_HEAD_POLICY=0` (multi-head OFF — verifying base case first)
- **G6 (stretch)**: Eval pnl > Phase 3E eval pnl by ≥ +$500k (multi-head ADDS value)
- **G7**: gate_entropy_mean ≤ 0.9 at end of training (specialization happens at cluster scale when reward is clean — the hypothesis Phase 2A-E couldn't test because reward was broken)
If G5 fails: multi-head adds noise, not value. Revert to single-head as production default.
If G7 passes: multi-head IS doing regime-conditional specialization (validates the Phase 2A architectural hypothesis).
**Estimated time:** 3 days
- [ ]**Step 1: Submit alpha-rl workflow with `--use-multi-head-policy=1`**
- [ ]**Step 2: Watch trajectory: same diag as 3E + gate_entropy_mean, gate_argmax_mass, per_head_entropy**
- [ ]**Step 3: Verdict G5-G7**
---
## 4. Self-review (run before invoking writing-plans hand-off)
- [x]**Placeholder scan**: no TBD/TODO/fill-in. All steps have specific files + commands.
- [x]**Internal consistency**: Phase 3B implements GAE, Phase 3C activates the pure-pnl reward that GAE will propagate, Phase 3D protects against anti-alignment regression, Phase 3E verifies the base case, Phase 3F tests the architecture on top.
- [x]**Scope check**: Single coherent intervention chain. Multi-head is committed but disabled until Phase 3F (only after base case verified).
- [x]**Ambiguity check**: Falsification gates are numerical and predetermined. Each phase has STOP conditions.
## 5. Linked
-`pearl_reward_signal_anti_aligned_with_pnl` — the load-bearing pearl; this plan is its fix
-`pearl_advantage_kernel_is_done_gated_td_not_gae` — the GAE motivation; T_eff=1 → 13.56
-`pearl_foxhunt_pi_trained_by_q_distillation_not_ppo` — why GAE helps via V→Q→distill→π
If Phase 3E G1+G3 pass, the project has solved its longest-standing bug. The Phase 2A multi-head infrastructure becomes the next-layer expressivity test (3F). The 12 adaptive controllers operate on a now-aligned signal. The determinism foundation makes verdict-quality measurement possible.
If 3E G1 passes but G3 doesn't: alignment is real but other latent bugs surface (e.g., the Welford-trade-count gap, Kelly trap, edge-decay loops). These become next-iteration targets but at least with a known-aligned reward to work on top of.
If 3E G1 fails: GAE doesn't propagate as hypothesized. The investigation surfaces real architectural insight (gradient cancellation in V regression? λ-return numerical issues? boundary conditions in the backward sweep?).
Either way, **the diagnostic loop is broken open** — we move forward with real signal instead of fighting an anti-aligned target.
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.