Knowledge Base: Training a Looped Vision-Transformer Reasoner for ARC with Numeric Reasoning Traces

This document turns our discussion into a concrete, engineering-oriented plan: what data to use, how to represent ARC problems numerically (no natural language needed), which architectures/papers to build on, and a coding + hyperparameter recipe that you can implement and iterate on.


0) Goal and scope

Goal

Train a transformer-like model that solves ARC-style grid transformation tasks and can optionally emit numeric “reasoning trajectories” (intermediate actions/states), so you can train:

  • A predictor: input → output grid
  • A reasoner/policy: input → sequence of discrete actions (numbers) → output grid
  • A hybrid: predicts output, but also learns structured intermediate “action/state” supervision where available.

Why “numeric trajectories” matter

ARC’s supervision is usually only (input, output) pairs. That hides the reasoning path. Trajectory supervision constrains the hypothesis space: instead of learning any mapping that fits, the model learns how humans step through the state space.

ARCTraj is an example of such a dataset: it logs object-level actions (Move/Rotate/Flip/Copy/Paste, etc.) with timestamps and intermediate grid states. (arXiv)


1) Background: ARC task formalization

ARC task (few-shot, many-task)

A task (T) consists of a small demonstration set:
[
\mathcal{D}T={(x_i, y_i)}{i=1}^{K}, \quad K\in{2,3,4}
]
and one (or two) inference inputs (x^) where the model must predict (y^). (ar5iv)

ARC is “few-shot within a task, many tasks overall”: you don’t just generalize across examples, you generalize across tasks (rules).

Output correctness

ARC scoring is “exact match” of the full output grid: a single wrong pixel makes the whole prediction incorrect (VARC explicitly discusses this and why multi-view inference helps). (arXiv)


2) Data sources you can use

2.1 Core ARC datasets

ARC-1: classic ARC setting with 400 training tasks (as described in the VARC paper’s ARC-1 definition). (ar5iv)

ARC-AGI 2: a newer benchmark; URM reports results on it (pass@1 etc.). (arXiv)

2.2 Human reasoning trajectories: ARCTraj (key to numeric traces)

ARCTraj logs:

  • ~10,000+ human trajectories (example: 10,672 in one table),
  • across 400 training tasks,
  • with per-step symbolic action records and intermediate grid states. (ar5iv)

It is released with:

  • HuggingFace dataset,
  • viewer,
  • and pointers to multiple baseline codebases (PPO, Dreamer/world models, diffusion offline RL, Decision Transformer, GFlowNet augmentation). (arXiv)

Important: ARCTraj is for grid-based ARC interactions. It is not a “textual ARC” dataset; it’s explicitly about actions on grids. (arXiv)

2.3 What are the actions? Are they finite?

Yes—ARCTraj defines a finite set of high-level operation categories and representative operation types:

  • Selection: SelectCell, SelectGrid, SelectObject
  • Coloring: Paint
  • Critical: ResizeGrid, Submit
  • O2 (object ops): Flip, Move, Rotate
  • History: Undo, Redo
  • Clipboard: Copy, Paste (ar5iv)

This is exactly the kind of discrete, numeric action alphabet that enables “number-only” reasoning trajectories.


3) Two recent papers to build on

3.1 “ARC Is a Vision Problem!” (VARC)

Core idea: treat ARC as image-to-image translation with strong visual priors. The model is trained on ARC-only data and generalizes via test-time training (TTT). (arXiv)

Key modeling choices (actionable)

  1. Canvas representation
    Instead of feeding the raw grid directly, place it on a fixed-size canvas (default shown as (64\times 64)), with an additional background token color. (ar5iv)
  2. Patchification
    They use patch size 2 on a 64×64 canvas (in their main ViT configs), expanding the local token variety and improving generalization. (arXiv)
  3. 2D positional embedding (incl. 2D RoPE)
    They show 2D positional embeddings help materially, and mention a 2D RoPE variant in ablations. (arXiv)
  4. Shape handling with explicit tokens
    They keep the canvas fixed and use:
  • [BG] background tokens to pad
  • [BD] border tokens on the output to mark right/bottom edges; then crop predicted output by locating the border.
    They also mask attention to downweight [BG] and compute loss only on non-background positions. (arXiv)
  1. Two-stage training
  • Offline training (learn general priors)
  • Test-time training on each new task (adaptation). (arXiv)

VARC hyperparameters (from paper appendix)

Offline training: epochs 100, warmup 10, Adam betas (0.9,0.999), batch 32, lr 3e-4, cosine schedule, dropout 0.1, weight decay 0. (arXiv)
TTT: epochs 100, warmup 10, batch 8, lr 3e-4, cosine, dropout 0.1. (arXiv)

ViT configs (examples):

  • 18M model: hidden dim 512, 10 blocks, 8 heads, patch size 2, canvas 64, dropout 0.1. (arXiv)

TTT augmentation in appendix:

  • flips/rotations + 10 color permutations → 51 auxiliary tasks; train 100 epochs per test task. (arXiv)

Performance headline:

  • ensemble reaches 60.4% on ARC-1 (paper reports closing gap with average human). (arXiv)

3.2 “Universal Reasoning Model” (URM)

URM analyzes Universal Transformers and argues gains come mainly from recurrent inductive bias + strong nonlinearity, then proposes:

  • ConvSwiGLU (adds depthwise short convolution into the MLP gating),
  • Truncated Backpropagation Through Loops (TBPTL) (only backprop through later loops). (arXiv)

What exactly is the “convolutional thing” in URM?

URM’s ConvSwiGLU modifies the feed-forward block.

  • Start with an expanded representation:
    [
    u = W_{up} h
    ]
  • Gate via SwiGLU:
    [
    g = \mathrm{SwiGLU}(u)
    ]
  • Apply depthwise 1D convolution over token dimension:
    [
    \tilde{g} = \mathrm{DWConv1D}(g; k)
    ]
  • Project back:
    [
    \mathrm{out} = W_{down}\tilde{g}
    ]
    URM explicitly describes this as injecting local token interactions into the gating mechanism via a short convolution kernel of size (k). (arXiv)

Where is it applied?
It sits inside each recurrent transition (i.e., within the MLP portion of the UT/decoder block), and thus is applied each loop. (arXiv)

TBPTL (Truncated Backprop Through Loops)

URM unrolls loops but only computes gradients for later loops:

  • earlier loops are “forward-only”
  • last loops contribute to gradient and loss. (arXiv)

This can be written as:
[
\mathcal{L}=\sum{t=\tau+1}^{T}\ell_t,\quad \nabla\theta \mathcal{L}\ \text{only through}\ t>\tau
]
(URM gives an explicit example of selecting a truncation index and only training on final loops). (arXiv)

URM headline results

URM reports:

  • 53.8% pass@1 on ARC-AGI 1
  • 16.0% pass@1 on ARC-AGI 2
    (and improved Sudoku accuracy). (arXiv)

URM experimental setup hints

They say they follow HRM/TRM dataset setups and use EMA + AdamAtan2 optimizer, with different learning rates per benchmark. (arXiv)
They also provide a reference model configuration (e.g., 4 layers, hidden size 512, 8 heads, inner loops 8, ACT outer loop max 16) in the paper text around experiment settings.


4) A cohesive proposal: Vision-URM with explicit numeric traces

You want to preserve 2D structure (vision paradigm) and get looped, iterative reasoning with controllable intermediate traces. A clean way to unify:

  1. Adopt VARC’s canvas + patchification + 2D positional structure.
  2. Replace the “one-pass” ViT with a looped/shared-weight transformer transition, URM-style.
  3. Add trajectory heads to predict ARCTraj actions (numbers), and optionally intermediate grids.

4.1 Data representations

Colors / tokens

Let raw grid colors be integers:
[
x\in{0,\dots,9}^{H\times W}
]
Extend with:

  • BG token id = 10
  • BD token id = 11
    So canvas values lie in ({0,\dots,11}). This mirrors VARC’s [BG]/[BD] shape scheme. (arXiv)

Canvas transform (fixed size)

Canvas size (H_c=W_c=64) (VARC default).
Place the grid with:

  • random translation + scaling during training (to build invariances),
  • deterministic or multi-view sampling at inference. (ar5iv)

Patchification

Patch size (p=2). Number of patch tokens:
[
N = (H_c/p)\cdot (W_c/p)=32\cdot 32=1024
]
Each patch is a (p\times p) block of discrete tokens. A simple embedding:

  • one-hot each cell → concat → linear → (d_{model})
    or
  • embed each cell color to (d’), then flatten and project.

(You can match VARC’s patch size/canvas size directly.) (arXiv)


5) Architecture specification with dimensions

5.1 Core tensor shapes

Let:

  • batch size (B)
  • canvas (64\times 64)
  • patch size (p=2)
  • patches per side (S=32)
  • tokens per sample (N=S^2=1024)
  • embedding dimension (d) (e.g., 512)

Input canvas:
[
X \in {0,\dots,11}^{B\times 64\times 64}
]

Patchified tokens:
[
Z_0 \in \mathbb{R}^{B\times N\times d}
]

5.2 Looped/shared transformer transition (Universal-style)

Define a shared transition block (F\theta) (could be a stack of M transformer blocks, all weight-tied across loops):
[
Z
{t+1} = F_\theta(Z_t, \text{pos}, t)
]
where (\text{pos}) includes 2D positional embeddings (absolute or rotary). VARC shows 2D positional structure matters. (arXiv)

Loop count:

  • fixed loops (T) (e.g., 8–16), or
  • ACT halting per token (URM/UT-style). (arXiv)

5.3 “Convolutional thing” for locality, but 2D-aware

URM’s ConvSwiGLU uses depthwise 1D conv over tokens. For image-like tokens you can replace that with a depthwise 2D convolution over the (S\times S) patch grid:

  1. reshape (B\times N\times d \to B\times d\times S\times S)
  2. apply depthwise conv (k\times k) (k small, e.g., 3)
  3. reshape back

This preserves URM’s intent (“short convolution as local mixing”) but aligns with VARC’s 2D structure.

URM’s motivation and module definition is still directly relevant (inject local token interactions inside MLP gating). (arXiv)

5.4 Output “unembedding” head (grid prediction)

You asked: “Do I need an un-embedding at the end to map to the dimension at once?”
Yes: you need a final projection to logits over discrete tokens.

If predicting per-cell colors on canvas:

  • simplest: operate at pixel level (patch size 1)
  • but VARC uses patchification (p=2), so do patch unembedding:

For each patch token, output logits for its (p^2) cells:
[
\text{logits} \in \mathbb{R}^{B\times N\times (p^2\cdot C)}
]
where (C=12) (10 colors + BG + BD).
Reshape to:
[
B\times S\times S\times p\times p\times C \to B\times 64\times 64\times C
]
Then argmax gives the predicted canvas.

5.5 Shape recovery (variable output sizes)

Use VARC’s BD rule:

  • Put [BD] along right/bottom edge of the true output on canvas
  • During inference, find rightmost/bottommost [BD] and crop
  • Compute loss only on non-[BG] (and optionally non-[BD] except border). (arXiv)

6) Loss functions (final + intermediate supervision)

6.1 Core output loss (VARC-style)

Per-pixel cross-entropy over non-background positions:
[
\mathcal{L}{out}=\sum{(i,j)\in \Omega} \mathrm{CE}\big(y{ij}, \hat{p}{ij}\big)
]
where (\Omega = {(i,j) : X_{ij}\neq [BG]}).
(VARC states they compute loss only on non-[BG] locations and also mask attention against [BG].) (arXiv)

6.2 Action-trajectory loss (ARCTraj-style, numeric-only)

From ARCTraj, each step contains:

  • category
  • operation type
  • position/coordinates
  • optional object description
  • intermediate grid snapshot (ar5iv)

Represent each action as a tuple of integers:
[
a_t = (c_t, o_t, \text{args}_t)
]
For example:

  • (c_t\in{0,\dots,5}) for the 6 categories
  • (ot\in{0,\dots,|\mathcal{O}{c_t}|-1})
  • args might include ((x,y)), color id, rotation amount, displacement vector, clipboard id, etc.

A factorized model:
[
p(a_t|s_t,\mathcal{D}) = p(c_t|\cdot),p(o_t|c_t,\cdot),p(\text{args}_t|c_t,o_t,\cdot)
]
and loss:
[
\mathcal{L}{act}=\sum_t \Big(
\mathrm{CE}(c_t,\hat{c}_t)+
\mathrm{CE}(o_t,\hat{o}_t)+
\sum_k \mathrm{CE}(\text{args}
{t,k}, \widehat{\text{args}}_{t,k})
\Big)
]

6.3 Intermediate-state loss (optional)

If you train a world model or next-state predictor:
[
\mathcal{L}{state}=\sum_t \mathrm{CE}(s{t+1}, \hat{s}_{t+1})
]
where (s_t) is the grid/canvas token state at step (t).

ARCTraj provides intermediate grid snapshots per action record, so this supervision exists. (arXiv)

6.4 Total objective

A practical combined objective:
[
\mathcal{L} = \lambda{out}\mathcal{L}{out} +
\lambda{act}\mathcal{L}{act} +
\lambda{state}\mathcal{L}{state} +
\lambda{aux}\mathcal{L}{aux}
]
where (\mathcal{L}_{aux}) could include halting loss (ACT), consistency losses across loops, etc.


7) Training methodology: offline training + looped refinement + TTT

7.1 Offline training (VARC baseline you can replicate)

Use VARC’s reported settings as a stable starting point:

  • epochs 100, warmup 10
  • Adam (0.9,0.999)
  • lr 3e-4, cosine schedule
  • batch size 32
  • dropout 0.1
  • weight decay 0 (arXiv)

7.2 Loops: why looping helps even without explicit trace supervision

Even if you do not supervise intermediate traces, looping changes the computation class:

  • repeated refinement with shared parameters
  • can approximate iterative algorithms with fewer parameters.

URM argues UT gains come from recurrent inductive bias + nonlinearity, and reports large performance jumps with recurrence. (arXiv)

7.3 TBPTL for stable training

When you unroll many loops, backprop through all loops is expensive/unstable.
URM’s TBPTL approach:

  • run early loops “forward-only”
  • backprop only through last loops. (arXiv)

This is extremely relevant if you build a looped ViT and want (T=16,32,\dots) loops.

7.4 Test-time training (TTT)

VARC gets much of its generalization by adapting to each new task at inference:

  • TTT epochs 100, warmup 10
  • batch 8, lr 3e-4, cosine, dropout 0.1 (arXiv)
  • augmentation creates 51 auxiliary tasks via rotations/flips + color permutations (arXiv)

How to combine with your “numeric trace” ambition
Two options:

Option A: TTT on a task embedding only (safer)

  • Keep model weights frozen
  • Optimize a per-task embedding vector (e_T) using demo pairs
    This mirrors VARC’s “task token / embedding” conditioning idea. (ar5iv)

Option B: TTT on a small adapter / LoRA

  • Keep most weights frozen, adapt a small set
  • Lower risk of catastrophic forgetting

8) How to get intermediate “reasoning traces” when you only have I/O pairs

You asked: “I only have a few I/O examples per task—how do I come up with intermediate steps?”

There are three practical strategies:

Strategy 1: Use ARCTraj directly (best if you want “human-like” traces)

  • Train a trajectory model (p(a_{1:T}|x,\mathcal{D})) or world model.
  • Advantages: grounded, interpretable, discrete action alphabet.
  • Limitation: coverage is finite; actions reflect O2ARC’s interface vocabulary.

ARCTraj is explicitly designed for this. (arXiv)

  • Define a small DSL of grid operations (many ARC solvers already do).
  • Search for a program (P) that maps demo inputs to demo outputs.
  • Execute (P) step-by-step to generate intermediate grids/actions.

This yields “number-only traces” without humans, but depends on your DSL expressivity.

Strategy 3: Latent traces with deep supervision across loops

If you don’t have ground-truth actions:

  • attach an output head to each loop (t): (\hat{y}^{(t)})
  • supervise with (\mathcal{L}_{out}^{(t)}) at each loop
  • optionally enforce monotonic improvement:
    [
    \mathcal{L}{mono}=\sum_t \max(0, \mathcal{L}{out}^{(t+1)}-\mathcal{L}_{out}^{(t)}+\epsilon)
    ]
    This doesn’t give symbolic “actions,” but it makes intermediate loops meaningful and can later be discretized or distilled.

9) Concrete hyperparameter starting points

9.1 Reproduce VARC-like vision baseline

Use the paper’s ViT-18M-ish settings:

  • canvas: 64×64
  • patch size: 2
  • ViT hidden dim: 512
  • blocks: 10
  • heads: 8
  • dropout: 0.1
  • training: epochs 100, batch 32, lr 3e-4 cosine, warmup 10 (arXiv)

9.2 Add loops (Vision-URM)

Start small and scale:

  • base transition = 1–2 ViT blocks weight-tied (to keep compute low)
  • loops (T\in{8,16})
  • TBPTL: backprop only last 4 loops (URM example style) (arXiv)
  • add ConvSwiGLU-style depthwise conv in MLP (but 2D over patch grid)

9.3 If you want “action prediction” (ARCTraj)

Add:

  • action head(s): category logits, op logits, argument logits
  • (\lambda_{act}) ramp-up schedule:
    • start small (0.1) then increase to 1.0 once output prediction is stable

10) Coding blueprint (PyTorch-level)

10.1 Modules

  1. CanvasEncoder
  • takes raw grid (variable (H\times W))
  • applies scale/translate augmentation
  • outputs 64×64 canvas with BG/BD tokens
  1. PatchEmbed
  • patchify 2×2 → token vector
  • embed to (d)
  1. LoopedTransformerTransition
  • shared block(s): MHSA + ConvSwiGLU-MLP
  • optional ACT halting head
  • TBPTL support (detach earlier loops)
  1. PatchUnembedHead
  • map (d) → logits over (p^2\cdot C)
  • reshape to 64×64×C
  1. TrajectoryHead (optional)
  • conditioned on current hidden state (and maybe pooled task token)
  • outputs categorical distributions for action components

10.2 Minimal forward pass sketch (shape-annotated)

# X_raw: list of variable grids
X_canvas = canvasify(X_raw)               # (B, 64, 64) int tokens in [0..11]
Z0 = patch_embed(X_canvas)                # (B, 1024, d)
 
Z = Z0
for t in range(T):
    if t < T - tbptl_train_loops:
        Z = transition(Z, t).detach()     # forward-only loops
    else:
        Z = transition(Z, t)
 
logits = patch_unembed(Z)                 # (B, 64, 64, C)
loss_out = masked_ce(logits, Y_canvas, mask=(X_canvas!=BG))

11) Evaluation protocol

ARC-1 style

  • accuracy: exact match output grid
  • multi-view inference: apply several canvas transforms and vote (VARC shows big gain). (arXiv)

ARC-AGI style (URM style)

  • pass@k: sample k outputs; correct if any matches. (arXiv)

Trajectory metrics (if using ARCTraj)

  • action accuracy / per-field accuracy (category/op/args)
  • sequence edit distance vs human trajectory
  • intermediate-state distance (grid exact match at some steps)

12) Practical roadmap (what to implement first)

  1. Reproduce VARC-like baseline
  • canvas + BG/BD + masking
  • ViT-18M settings and training config from the paper appendix (arXiv)
  1. Add looped weight sharing
  • convert blocks into a shared transition
  • add loops (T=8)
  • add TBPTL (detach early loops), URM-style (arXiv)
  1. Add ConvSwiGLU-style local mixing
  • implement 2D depthwise conv inside the MLP gating (URM motivation + design) (arXiv)
  1. Integrate ARCTraj
  • train a trajectory policy head (action prediction)
  • optional: train a world model head (next-state prediction)
  1. Advanced
  • test-time training (task embedding / adapters)
  • verifier + search or offline RL (ARCTraj points to multiple RL paradigms and codebases) (arXiv)

13) References you can cite in your project spec

  • URM: “Universal Reasoning Model” (conv + TBPTL; strong ARC-AGI results). (arXiv)
  • VARC: “ARC Is a Vision Problem!” (canvas, 2D priors, ViT, test-time training). (arXiv)
  • ARCTraj: human numeric action trajectories + schema + baselines. (arXiv)

If you want, I can also provide a concrete “action tokenization spec” (exact integer ranges, padding rules, and how to serialize an ARCTraj step into a fixed-length token sequence) so your transformer can be trained entirely without text—just integers for grids + integers for actions.