# REP-004: recover H under two frozen-decoder fitting rules Copy and hash this protocol, source, configuration, design, launcher and parent inputs before execution. This is a post-outcome recovery diagnostic on the existing REP-002 world and checkpoints, following REP-003's successful H-only intervention. It is not a fresh generalization test. ## Question and requirements Can either of two fixed-budget fitting rules recover the observed operational errors when only the context-flip operation H is trainable? R26 requires all five seeds and all four arms, including every failure. R27 requires inspectable training, frozen-tensor controls, resource receipts and independent inference replay. An empirical improvement is not a condition of completion. Use only the five Fourier checkpoints from REP-002 receipt SHA-256 `23470a50894fd6ec6bb3f1daefd2becf662a8722d2fa867c8bf43dd8dc13cfc1`. Keep the parent and historical archives unchanged. Retain the parent's exact input bytes. All earlier runtime files must remain identical; the sole allowed metadata difference is the already published `pyproject.toml` license-line change from Apache-2.0 to PolyForm-Noncommercial-1.0.0. Verify that exact byte replacement and record both hashes, rather than waiving source verification. ## Fixed design and training boundary Reuse the 98 states, 84 training states, 14 held states, eight operations, 580 training-to-training edges, and every REP-002 evaluation word. Only the 84 H edges enter fitting and training diagnostics. Encode their source and target observations using the frozen Fourier buffers. No held state, composition target, reference decoder or nearest-state lookup enters training. | Arm | H treatment | Optimizer updates | |---|---|---:| | native | Exact saved native H | 0 | | prediction_latent | Start from native H; prediction plus latent loss | 1,000 | | latent_only | Start from native H; latent loss alone | 1,000 | | refit | Exact recorded train-only least-squares H, cast to FP32 | 0 | Every other head, every decoder parameter and every encoder buffer remains bit-for-bit identical to its parent. Optimize a separate 10 by 11 H parameter so optimizer state cannot change unselected slices. The two fitted arms have identical initial tensors and fresh, empty Adam states. Use learning rate .003, betas (.9,.999), epsilon 1e-8, zero weight decay, foreach/fused disabled, and exactly 1,000 full-batch updates. Rotate the four-arm execution order by seed modulo four. No early stopping, checkpoint selection, loss reweighting or outcome-selected rerun. Let Lp be mean squared decoder prediction error over the 84 H edges and 16 observation coordinates; let Lz be mean squared latent error over those edges and ten coordinates. The objectives are: - prediction_latent: `(84/580) * (Lp + 0.1 * Lz)`. - latent_only: `(84/580) * 0.1 * Lz`. The shared factor preserves H's contribution to the original all-edge mean; keeping it matters to the effective scale relative to Adam's epsilon. The prediction term differentiates through the frozen decoder to H. All source and target encodings are detached. Other operators' losses are constants with respect to H and are omitted. A regression check compares the prediction-plus- latent gradient with the original head objective's H slice. Log training-only measurements at step 0, step 1, every 100 updates and the final step: Lp, Lz, their scaled contributions and the selected total objective (both objectives can be recovered from the contributions), prediction and weighted latent gradient norms, their dot product/cosine, total gradient norm and H update norm. Label undefined zero-norm cosines explicitly. Save checkpoint snapshots at these same points, plus an atomically replaced latest file, with actual completed updates and numeric Adam step/moment state. Reference arms never construct an optimizer. Coefficient distance to the least-squares solution is not an adequacy metric: the constant Fourier coordinate and affine bias allow nonunique coefficients. ## Controls, evaluation and rejection rules Before fitting, compare CPU/CUDA initial H outputs, objective losses and gradients for both objectives and all five seeds at rtol=1e-4, atol=1e-6. Evaluate only after the fixed update budget. Save all six numeric NPZ case families, encoded reference states, targets and exact tensor/hash inventories. Retain reconstruction, all individual actions, composition lengths 2/4/8/16, full-path support strata, H-count groups, distance/margin diagnostics and the existing identities and noncommuting controls. Primary: exact full-state length-16 accuracy, with all seeds, median/range and paired gain/regression counts versus native. Report shorter lengths and relation branch-to-truth accuracy too; branch agreement alone can conceal a shared wrong answer. Native outputs must reproduce the pinned parent arrays. The refit arm must use the recorded H alone, preserving all seven native alternatives. Every arm must preserve H-free outputs bit-for-bit within each backend. Verify trained-arm checkpoint isolation, trace coverage, completed updates and optimizer state. The independent NumPy implementation replays saved final models, with exact categorical agreement and fixed continuous rtol=1e-4/atol=1e-6. Retain discrepancy witnesses and failed controls; do not widen tolerances after results. This is independent inference code on the same host, not an independent optimizer trajectory or independent-host replication. Use deterministic FP32 CUDA on the local RTX 5070, TF32 disabled, with no CPU fallback for the official run. Retain the existing supervisor limits: 900-second worker, 1,200-second aggregate, 12 GiB process-tree RAM, 8 GiB CUDA allocation, 1 GiB device reserve, 10 GiB attempt disk and 5 GiB drive reserve. Attempts live under `G:/RenigmaLLM_Artifacts/head-fitting-runs` in new directories. Synthetic CPU tests may use two updates and remain labeled tests; no outcome-guided probe is authorized by this protocol. Runtime/protocol edits invalidate an active attempt. Preserve partial outputs and distinguish incomplete execution from failed validation and empirical underperformance. Receipt update totals distinguish returned-trial progress from progress recovered from the latest saved checkpoints. A hard-killed active trial can have saved updates that never reached the worker's returned-trial total. Record those checkpoint counts and hashes separately; unsaved in-flight updates remain unknown. ## Interpretation and next decision Compare recovery under the two rules, including regressions and residual latent/decoded errors. This controls the starting tensors, fresh optimizer states and budget between fitted arms. It cannot isolate extra optimization, optimizer reset or the original joint-training trajectory as the cause of the old error. Native/refit are reference arms, never substitutes for failed fitted results. Any claim about transfer requires a separately frozen new world/split before learned language integration. No new context dimension is assumed needed for this known-adequate representation.