bug: RAT bidirectional window shrinks below 64 tokens on CIFAR after ~4k steps #14

Closed
opened 2026-11-19 16:28:06 +00:00 by dsh · 4 comments
Member

The 10k CIFAR RAT-32 run crashed at step 4000:

ValueError: bidirectional RAT supports windows up to 63 tokens; got 64

Cause: tardits Rattention._scan_chunk_size() derives the chunk from the trained min |gamma|. At init it is 64 (the patch count), but after ~4k steps gamma decays enough that the chunk becomes 63 while the CIFAR sequence is still 64. The bidirectional path rejects T > chunk. The 3k smoke completed because it stopped before the crossover.

Options, in order of preference:

  1. Implement a chunked bidirectional scan that carries state across chunks (the causal scan already has initial_state; the backward pass needs the same).
  2. Add a gamma_min floor (e.g. 0.5) to the trainer's gamma projection so the chunk cannot shrink below the sequence length; document it as an architecture choice and retrain.
  3. Use a 49-token CIFAR crop (28x28) for RAT; keeps the MNIST recipe but changes the benchmark resolution.
  4. Keep hyper for 64-token CIFAR (current fallback; 10k hyper run in flight).

Done means a 64-token RAT CIFAR run survives 10k steps without NaN and has a stated gamma/window policy. Add a test that forces gamma to the trained regime and asserts the 64-token forward works (or fails with a clear, early config error).

The 10k CIFAR RAT-32 run crashed at step 4000: ``` ValueError: bidirectional RAT supports windows up to 63 tokens; got 64 ``` Cause: tardits `Rattention._scan_chunk_size()` derives the chunk from the trained `min |gamma|`. At init it is 64 (the patch count), but after ~4k steps gamma decays enough that the chunk becomes 63 while the CIFAR sequence is still 64. The bidirectional path rejects T > chunk. The 3k smoke completed because it stopped before the crossover. Options, in order of preference: 1. Implement a chunked bidirectional scan that carries state across chunks (the causal scan already has `initial_state`; the backward pass needs the same). 2. Add a `gamma_min` floor (e.g. 0.5) to the trainer's gamma projection so the chunk cannot shrink below the sequence length; document it as an architecture choice and retrain. 3. Use a 49-token CIFAR crop (28x28) for RAT; keeps the MNIST recipe but changes the benchmark resolution. 4. Keep hyper for 64-token CIFAR (current fallback; 10k hyper run in flight). Done means a 64-token RAT CIFAR run survives 10k steps without NaN and has a stated gamma/window policy. Add a test that forces gamma to the trained regime and asserts the 64-token forward works (or fails with a clear, early config error).
dsh self-assigned this 2026-11-19 16:28:06 +00:00
Author
Member

Reproduced on the 10k CIFAR RAT-32 run: crash at step 4000, bidirectional RAT supports windows up to 63 tokens; got 64. The run is marked FAILED in MLflow 43d4f09497344a5ba4e69d1967e15585. The 3k smoke completed before the gamma crossover. Hyper fallback 10k produced FID 160.36 (baseline).

Possible fix set remains as in the issue; priority is a chunked bidirectional scan or a documented gamma_min floor, then rerun RAT-32 CIFAR 10k + head sweep.

Reproduced on the 10k CIFAR RAT-32 run: crash at step 4000, `bidirectional RAT supports windows up to 63 tokens; got 64`. The run is marked FAILED in MLflow `43d4f09497344a5ba4e69d1967e15585`. The 3k smoke completed before the gamma crossover. Hyper fallback 10k produced FID 160.36 (baseline). Possible fix set remains as in the issue; priority is a chunked bidirectional scan or a documented gamma_min floor, then rerun RAT-32 CIFAR 10k + head sweep.
Author
Member

Implemented option 1: ChunkedBidirectionalRattention in src/wink/models/rat.py.

  • Bidirectional scan is split into <= _scan_chunk_size() chunks; the fast-weight state is carried between chunks (S_last) for both the forward and reversed scans, then S = S_fwd + S_bwd - A_self.
  • For T <= chunk it delegates to stock tardits; no behavior change for MNIST.
  • Tests: chunked scan matches the full scan (max diff ~2.3e-6); a 64-token, gamma×0.35 window now forwards finite; RATDiT CIFAR forward after forced gamma decay works. Suite: 32 passed.
  • CIFAR RAT-32 10k rerun is in flight (chunked config/run name). It should pass the ~4k crossover that killed the previous run. Will report loss/FID and close if clean.
Implemented option 1: `ChunkedBidirectionalRattention` in `src/wink/models/rat.py`. - Bidirectional scan is split into `<= _scan_chunk_size()` chunks; the fast-weight state is carried between chunks (`S_last`) for both the forward and reversed scans, then `S = S_fwd + S_bwd - A_self`. - For `T <= chunk` it delegates to stock tardits; no behavior change for MNIST. - Tests: chunked scan matches the full scan (max diff ~2.3e-6); a 64-token, gamma×0.35 window now forwards finite; RATDiT CIFAR forward after forced gamma decay works. Suite: 32 passed. - CIFAR RAT-32 10k rerun is in flight (chunked config/run name). It should pass the ~4k crossover that killed the previous run. Will report loss/FID and close if clean.
Author
Member

Fix validated end-to-end: the chunked bidirectional scan carried the RAT-32 CIFAR run through the ~4k gamma crossover and completed 10,000 steps.

  • val x0-MSE 0.0351 (hyper 10k reference 0.0347; within one-seed noise)
  • 59.7 min CPU; MLflow 74955807cc524e2e8bf8ada1a8ec1513
  • grid docs/assets/cifar10/cifar_rat_10k_64.png
  • report docs/experiments/2026-11-20-cifar10-rat-chunked.md
  • 32 tests pass; chunked-vs-full max diff ~2.3e-6

A 10k-sample FID is being computed with the same protocol as hyper (160.36). Will close after the number lands if it is clean.

Fix validated end-to-end: the chunked bidirectional scan carried the RAT-32 CIFAR run through the ~4k gamma crossover and completed 10,000 steps. - val x0-MSE 0.0351 (hyper 10k reference 0.0347; within one-seed noise) - 59.7 min CPU; MLflow `74955807cc524e2e8bf8ada1a8ec1513` - grid `docs/assets/cifar10/cifar_rat_10k_64.png` - report `docs/experiments/2026-11-20-cifar10-rat-chunked.md` - 32 tests pass; chunked-vs-full max diff ~2.3e-6 A 10k-sample FID is being computed with the same protocol as hyper (160.36). Will close after the number lands if it is clean.
Author
Member

Closed by the chunked-scan fix + 10k CIFAR validation.

  • ChunkedBidirectionalRattention carries state across safe chunks; chunked-vs-full max diff ~2.3e-6.
  • RAT-32 CIFAR 10k now completes: val x0-MSE 0.0351, 59.7 min, FID 156.12 (hyper 160.36 on the same 10k/10k protocol).
  • Grid docs/assets/cifar10/cifar_rat_10k_64.png; report docs/experiments/2026-11-20-cifar10-rat-chunked.md; FID JSON docs/experiments/2026-11-20-cifar10-rat-10k-fid.json. 32 tests pass.

The RAT-vs-hyper CIFAR gap is only ~2.6% on one seed; the head sweep and a second seed are the next rigor step, not a blocker.

Closed by the chunked-scan fix + 10k CIFAR validation. - `ChunkedBidirectionalRattention` carries state across safe chunks; chunked-vs-full max diff ~2.3e-6. - RAT-32 CIFAR 10k now completes: val x0-MSE 0.0351, 59.7 min, FID **156.12** (hyper 160.36 on the same 10k/10k protocol). - Grid `docs/assets/cifar10/cifar_rat_10k_64.png`; report `docs/experiments/2026-11-20-cifar10-rat-chunked.md`; FID JSON `docs/experiments/2026-11-20-cifar10-rat-10k-fid.json`. 32 tests pass. The RAT-vs-hyper CIFAR gap is only ~2.6% on one seed; the head sweep and a second seed are the next rigor step, not a blocker.
dsh closed this issue 2026-11-20 01:47:17 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
ml-lab/wink#14
No description provided.