Generative Recursive Reasoning — part 4/5
Cleaned-text code points [46990, 62753). Bibliography omitted here; source.md includes it.
Hyperparameters. Following Wang et al. [8] , Jolicoeur-Martineau [9] , both the input and output are represented as sequences of shape [ B , L ] [B,L] , where B B denotes the batch size and L L the context length. Each input sequence includes 16 fixed puzzle embedding tokens. The latent states h t h_{t} and l t l_{t} , as well as the decoder output, have shape [ B , L , D ] [B,L,D] , with embedding dimension D D . The Transformer [ 39 ] backbone uses embedding dimension D = 512 D=512 , attention heads N head N_{\text{head}} =8 , and FFN hidden dimension D h D_{h} =512. Within a recursion step, meaning a latent transition z t → z t + 1 z_{t}\to z_{t+1} , we use low-level (inner) steps K = 6 K=6 for Sudoku [ 8 ] and K = 4 K=4 for all other tasks, with high-level (outer) steps T = 3 T=3 .
### B.2 Training Details
Task Configuration. All tasks represent inputs and outputs as discrete token sequences (Summarized in Table 6 ). • For Sudoku [ 8 ] , the 9 × \times 9 grid is flattened row-by-row into 81 tokens with vocabulary size 11 (0=pad, 1=blank, 2–10=digits).
• For ARC-AGI [ 13 , 14 ] , variable-size grids are padded to a fixed 30 × \times 30 canvas with EOS markers, yielding 900 tokens and vocabulary size 12 (0=pad, 1=eos, 2–11=colors); task-specific puzzle embeddings are prepended to distinguish different ARC tasks.
• N-Queens flattens an N × N N\times N board row-by-row into N 2 N^{2} tokens with vocabulary size 3 (0=pad, 1=empty, 2=queen).
• Graph Coloring encodes the strict upper triangle of the adjacency matrix as n ( n − 1 ) / 2 \nicefrac{{n(n-1)}}{{2}} tokens, using 0=PAD, 1=no-edge, and 2=edge for inputs and 3 + color_id 3+\text{color\_id} for output colors.
• For image generation on MNIST [ 15 ] , images are quantized and processed via CNN-based patchification [ 50 , 49 ] , with the encoder applying patchify and the decoder unpatchify. Then, patched input forms 14 × 14 14\times 14 flattened sequence tokens with vocabulary size 3 (0=pad, 1=black, 2=white).
Training Details. We train all models using AdamW [ 54 ] with learning rate 10 − 4 10^{-4} , weight decay 1.0, and gradient clipping at 1.0. The global batch size is 768. For stability, we apply exponential moving average (EMA) with decay 0.9999, following Brock et al. [55] and Song and Ermon [56] . To prevent posterior collapse, we use a KL balance [ 37 , 38 ] coefficient of 0.8. The number of deep supervision steps is N sup = 16 N_{\text{sup}}=16 for all tasks. The KL coefficient β \beta is set to 0.1 0.1 (Sudoku), 0.04 / 0.1 0.04/0.1 (ARC-AGI-1/2), 0.07 / 0.045 0.07/0.045 (N-Queens 8 × 8 8\times 8 / 10 × 10 10\times 10 ), 0.5 / 0.45 0.5/0.45 (Graph Coloring with 8/10 nodes), and 0.07 0.07 (MNIST). Task-specific training configurations are summarized in Table 7 .
## Appendix C Additional Details of Experiment Setup
### C.1 Challenging Puzzle Tasks
#### C.1.1 Looped TF on ARC-AGI
We report Looped Transformer [ 7 ] results on Sudoku-Extreme but omit them on ARC-AGI due to prohibitive training cost. Under the same setup used for our other recursive baselines (200K epochs, batch size 768, on 8 × 8\times NVIDIA RTX Pro 6000 GPUs), training Looped TF on Sudoku-Extreme already takes 19 hours, and extrapolating to ARC-AGI — which uses substantially longer sequences and a larger training set — suggests approximately 97 days ( ≈ 776 \approx 776 GPU-days) for a full training run.
This gap stems from two compounding factors. First, Looped TF lacks deep supervision: HRM, TRM, and GRAM perform N sup N_{\mathrm{sup}} gradient updates per trajectory (one per segment), whereas Looped TF performs only one update at the end of the full trajectory, slowing convergence. Second, Looped TF lacks adaptive halting such as ACT [ 8 , 9 , 10 ] , so every input must be processed for the maximum recursion depth, increasing per-example sequential compute. Both inefficiencies compound at ARC-AGI scale, making a full Looped TF training run impractical.
### C.2 Multi-solution Puzzle Tasks
#### C.2.1 N-Queens Problem
Data Generation Details. The N-Queens problem requires placing N N queens on an N × N N\times N chessboard such that no two queens attack each other—meaning no queens share the same row, column, or diagonal. Figure 9 illustrates an example where 5 queens are removed from an 8 × 8 8\times 8 solution, resulting in a puzzle with 3 distinct valid completions.
To construct the dataset, we first generated all valid complete N-Queens solutions for N = 8 N=8 and N = 10 N=10 . We then created puzzle instances by removing a specific number of queens, treating the remaining partial configuration as the input and the original complete board as the target label. To generate instances yielding diverse valid completions, we removed k ∈ { 5 , 6 , 7 } k\in\{5,6,7\} queens for the 8 × 8 8\times 8 setting and k ∈ { 7 , 8 , 9 } k\in\{7,8,9\} queens for the 10 × 10 10\times 10 setting. The distribution of solution counts for our generated dataset is shown in Figure 10 .
For evaluation, we employed an 85:15 train-test split. Crucially, to prevent data leakage and ensure the model learns to reason rather than memorize, the split was performed based on unique input configurations. This guarantees that no input pattern in the test set appears in the training set. Inputs are flattened into discrete 1D sequences x ∈ { 0 , 1 , 2 } L x\in\{0,1,2\}^{L} , where L = N 2 L=N^{2} , along with zero-padded puzzle embedding tokens. Vocabulary mapping follows: padding (0), empty (1), and queen (2).
#### C.2.2 Graph Coloring Problem
Data Generation Details. The Graph Coloring problem requires assigning one of k k colors to each node in a graph such that no two adjacent nodes share the same color. We consider graphs with N ∈ { 8 , 10 } N\in\{8,10\} nodes and use k = 3 k=3 colors. Figure 11 illustrates an example instance with N = 8 N=8 nodes and k = 3 k=3 colors.
Graphs are generated using the Erdős–Rényi random graph model [ 57 ] , following the generation pipeline from GNN-GCP [ 58 ] . Specifically, for each instance, edges are sampled independently with a fixed probability p p , producing a symmetric adjacency matrix. We retain only graphs that are 3-colorable.
For each graph, we enumerate all valid 3-colorings and retain only canonical forms to eliminate redundant solutions under color permutation (e.g., swapping red and blue). This yields a set of structurally distinct solutions per input. The distribution of solution counts is shown in Figure 12 .
The final dataset consists of 7,002 training and 255 test instances for N = 8 N=8 , and 13,465 training and 192 test instances for N = 10 N=10 .
Input and Output Representation. The input graph is represented by extracting the upper triangular portion of the adjacency matrix (excluding the diagonal) and flattening it into a 1D sequence. The output is a sequence of length N N , where each position encodes the assigned color for the corresponding node. Vocabulary mapping is as follows: PAD (0), no edge (1), edge (2), and colors (3, 4, 5) for red, blue, and green respectively.
## Appendix D Additional Experiment Results
### D.1 Additional Results on Challenging Puzzle Benchmarks
Table 8 reports test accuracy on three challenging puzzle benchmarks. Here we provide additional observations complementing the main text.
##### GRAM Advances the Recursive-Reasoning Line.
Across all three benchmarks, GRAM consistently outperforms prior recursive baselines (Looped TF, HRM, TRM) while using fewer parameters than HRM (10M vs. 27M). The complete failure of direct prediction on Sudoku and ARC-AGI-2 (0% in both cases) further confirms that recursive computation is essential for these tasks — single-pass models, regardless of capacity, cannot solve them. Together, these results indicate that GRAM’s gains arise from how recursive computation is organized (probabilistic, multi-trajectory) rather than from increased model capacity.
##### Sudoku-Extreme Resists Parameter Scaling.
All tested large reasoning models (LRMs), including Deepseek-R1 (671B), score 0% on Sudoku-Extreme. This suggests that pretrained capacity alone does not transfer to constraint-propagation reasoning, and that benchmarks like Sudoku-Extreme probe a fundamentally different axis from those captured by general-purpose LRMs. On ARC-AGI, more recent LRMs such as Gemini 3 Pro (75.0% on ARC-1, 31.1% on ARC-2) remain substantially ahead of all recursive models, highlighting that abstract few-shot reasoning still benefits from scale; we view these numbers as benchmark-difficulty reference points rather than controlled baselines.
Method #Params Sudoku ARC-1 ARC-2 Large Reasoning Models Deepseek-R1 671B 0.0 15.8 1.3 Claude 3.7 16k N/A 0.0 28.6 0.7 o3-mini-high N/A 0.0 34.5 3.0 GPT 5.2 (low) N/A – 55.7 9.7 Grok-4-thinking 1.7T – 66.7 16.0 Gemini 3 Pro N/A – 75.0 31.1 Recursive Models Direct Pred 27M 0.0 21.0 0.0 Looped TF 7M 61.3 - - HRM 27M 55.0 40.3 5.0 TRM 7M 87.4 44.6 7.8 GRAM (Ours) 10M 97.0 52.0 11.1 Human Results Avg. Human – – 60.2 – Best Human – – 98.0 100.0
### D.2 Scales with Parallel Sampling on ARC-AGI Challenge
To investigate the effect of GRAM’s sampling on the ARC-AGI-1 benchmark, we measured performance without relying on external data augmentation. Typically, TRM achieves its reported accuracy by generating 1,000 augmentations for a single problem and performing majority voting over the results. Because this augmentation process itself creates a wide variety of samples, we isolated the specific effect of generative sampling by performing inference solely on the original problem instance and conducting majority voting over multiple sampled paths. For a fair comparison, TRM was evaluated using the same hyperparameters as GRAM, including the number of epochs, learning rate, and the number of layers.
As illustrated in Figure 13 , removing augmentations causes a performance decline for both GRAM and TRM compared to the values reported in Table 8 . However, in the case of GRAM, we observe that accuracy consistently improves as the model generates more parallel samples. This trend mirrors observations in Section 4.2 , suggesting that increased inference-time compute through width scaling allows the model to explore more plausible reasoning trajectories and recover from initial errors, eventually leading to more robust solution discovery.
##### Interaction between Augmentation and Sampling.
A natural question arises: why not combine higher levels of augmentation with extensive parallel sampling? To address this, we conducted an ablation study examining the interaction between data augmentation and inference-time sampling. Figure 14 presents the results across varying augmentation levels (Aug=0 to Aug=50). Without augmentation (Aug=0), increasing the number of samples yields consistent accuracy improvements, demonstrating that stochastic sampling effectively explores diverse reasoning trajectories. However, as the level of augmentation increases, the marginal benefit of additional sampling diminishes substantially. At Aug = = 50, performance saturates regardless of sample count—accuracy remains nearly constant whether we draw 1 or 50 samples. This observation reveals that augmentation and sampling serve complementary rather than additive roles: both mechanisms enable the model to capture solution diversity, but through different means. When training data is limited, parallel sampling compensates by exploring varied reasoning paths at inference time. When training data is abundant through augmentation, the model has already internalized sufficient diversity during training, rendering additional inference-time exploration redundant. Consequently, scaling sampling beyond augmentation provides diminishing returns, justifying our experimental design choice to evaluate these two scaling axes separately.
### D.3 Solution Coverage Analysis
We analyze the ability of GRAM to capture the diversity of the solution space compared to deterministic baselines. Figure 15 presents the solution coverage on 8 × 8 8\times 8 and 10 × 10 10\times 10 N-Queens tasks with respect to the total number of valid ground-truth solutions.
As shown in Figure 15 , deterministic recursive models (HRM and TRM) exhibit a sharp decline in coverage as the number of possible solutions increases. Since these models are constrained to a single fixed reasoning trajectory, they structurally fail to explore alternative paths, resulting in severe mode collapse in multi-solution landscapes.
In contrast, GRAM effectively leverages its generative latent transitions to cover a broader range of solutions. As the number of parallel samples N N increases (from 1 to 20), the solution coverage improves monotonically across both 8 × 8 8\times 8 and 10 × 10 10\times 10 settings. This empirical evidence confirms that GRAM’s stochastic guidance mechanism is essential for navigating complex problem spaces where multiple valid reasoning paths exist.
### D.4 Additional Generated Image Samples
In this section, we provide further qualitative results demonstrating GRAM’s capability in unconditional image generation. Figure 16 presents a diverse set of samples generated on the binarized MNIST dataset, visualized across the recursive inference steps t = 0 t=0 to t = 16 t=16 .
As observed in the main text, GRAM exhibits a distinct progressive refinement behavior. Starting from a black initialization, the model iteratively adds details and sharpens the structure of the digit. A particularly compelling property of this process is the model’s ability to recover from initially ambiguous or incorrect formations.
For instance, in the second row (generating the digit ’2’) and the last row (generating the digit ’1’), the early predictions at t = 1 t=1 and t = 2 t=2 manifest as disjointed artifacts or incorrect shapes. However, as the recursion proceeds, GRAM effectively leverages its feedback loop to correct these initial errors, resolving the ambiguity and converging to a coherent, high-quality digit by t = 16 t=16 .
### D.5 Additional Experiment Results on Unconditional Sudoku Generation
In this section, we provide additional details on unconditional Sudoku generation. Unlike the conditional Sudoku-solving setting, where the input board contains given clues, the model receives an entirely blank board and samples a complete 9 × 9 9\times 9 Sudoku board from its learned prior. We evaluate each generated board using the standard Sudoku validity criterion: every row, column, and 3 × 3 3\times 3 box must contain the digits 1 through 9 exactly once. We report the validity rate over 100K generated boards. To check whether high validity comes from repeatedly producing the same board, we also compute the fraction of unique boards among valid samples.
For GRAM, we construct the unconditional training set from Sudoku-Extreme [ 8 ] , the Sudoku benchmark used by HRM and TRM. We sample 50K complete solutions from the original training split, discard the clue patterns, and use an all-blank board as input with the complete solution as the target. No data augmentation is used. We train GRAM on this derived 50K-solution set for 200 epochs with learning rate 10 − 4 10^{-4} , EMA decay 0.999, and KL coefficient 0.05. The resulting model contains 10.9M parameters and uses 16 inference steps.
For D3PM baselines, we use a DiT-style Transformer backbone and evaluate two model sizes. D3PM-Big uses hidden dimension 768, 5 Transformer blocks, and 12 attention heads, yielding 55.1M parameters, while D3PM-Small uses hidden dimension 512, 3 Transformer blocks, and 8 attention heads, yielding 15.9M parameters. Both variants are trained on the same derived training set and generate boards with 1000 denoising steps.