File size: 7,689 Bytes
0adfaab | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | # Block World
**Rearrange blocks in stacks from initial to goal configuration**
---
## Overview
Block World is a classical planning puzzle that tests sequential reasoning and dependency analysis. The puzzle involves uniquely labeled blocks (A, B, C, etc.) arranged in K stacks, where the objective is to rearrange blocks from an initial configuration to a specified goal configuration.
### Difficulty Rating: ⭐⭐ (Moderate)
---
## 📊 Statistics
| Metric | Value |
|--------|-------|
| **Total Puzzles** | 849 |
| **Total Moves** | 5,827 |
| **Training Puzzles (N=1-7)** | 549 |
| **Test Puzzles (N=8-10)** | 300 |
| **Difficulty Parameter** | N (number of blocks) |
| **Number of Stacks** | K = 3 |
| **Solution Length** | L(N) = O(N) (linear) |
| **Transition Locality** | O(1) - only check top of stacks |
---
## 🎯 Puzzle Rules
### Objective
Move blocks from the **initial configuration** to the **goal configuration** following movement constraints.
### Constraints
1. **Top Block Movement**: Only the topmost block from any stack can be moved
2. **Valid Placement**: A block can only be placed:
- On an empty stack position, OR
- On top of another block
### Why Block World is Interesting
Block World is the **most learnable** puzzle in the RecurrReason benchmark for three key reasons:
1. **O(1) Transition Locality**: Verifying whether a move is legal requires checking only the top of two stacks (source and destination), independent of total problem size
2. **Linear Solution Length**: L(N) = O(N), meaning solution length grows linearly with difficulty
3. **Dense Training Signal**: All 549 training puzzles share the same movement grammar, providing consistent learning opportunities
---
## 📋 State Representation
States are represented as **lists of K lists**, where each inner list represents one stack containing blocks ordered from **bottom to top**.
### Format
```python
[['B'], [], ['A', 'C']]
```
This represents:
- **Stack 0**: Block B (bottom)
- **Stack 1**: Empty
- **Stack 2**: Block A (bottom), Block C (top)
### Move Representation
```python
['C', 2, 0]
```
This represents: **Move block C from stack 2 to stack 0**
Format: `[block_name, source_stack_index, destination_stack_index]`
---
## 🖼️ Example Puzzle

### Example Trajectory
**Initial State**: `[['B'], [], ['A', 'C']]`
**Goal State**: `[['B'], ['A'], ['C']]`
**Optimal Solution Length**: 3 moves
**Step-by-step solution:**
| Step | Current State | Next State | Move | Description |
|------|--------------|-----------|------|-------------|
| 0 | `[['B'], [], ['A', 'C']]` | `[['B', 'C'], [], ['A']]` | `['C', 2, 0]` | Move C from stack 2 to stack 0 |
| 1 | `[['B', 'C'], [], ['A']]` | `[['B', 'C'], ['A'], []]` | `['A', 2, 1]` | Move A from stack 2 to stack 1 |
| 2 | `[['B', 'C'], ['A'], []]` | `[['B'], ['A'], ['C']]` | `['C', 0, 2]` | Move C from stack 0 to stack 2 |
| 3 | `[['B'], ['A'], ['C']]` | `[['B'], ['A'], ['C']]` | `['_', '_', '_']` | Goal reached! |
**Note**: The final row with `['_', '_', '_']` indicates puzzle completion (sentinel move).
---
## 📁 CSV Column Descriptions
### Columns
| Column | Type | Description |
|--------|------|-------------|
| `N` | int | Number of blocks in the puzzle (difficulty parameter) |
| `K` | int | Number of stacks (always 3 in this dataset) |
| `start_state` | string | Initial configuration of all stacks |
| `goal_state` | string | Target configuration to achieve |
| `current_state` | string | State before this move |
| `next_state` | string | State after applying this move |
| `move` | string | Action taken: `[block, source_stack, dest_stack]` |
| `num_moves` | int | Total number of moves in the optimal solution |
### Data Format
Each row represents one **move** in a solution trajectory. A complete puzzle solution consists of multiple rows (one per move) plus a final row indicating completion.
**Example CSV rows:**
```csv
N,K,start_state,goal_state,current_state,next_state,move,num_moves
3,3,"[['B'],[],['A','C']]","[['B'],['A'],['C']]","[['B'],[],['A','C']]","[['B','C'],[],['A']]","['C',2,0]",3
3,3,"[['B'],[],['A','C']]","[['B'],['A'],['C']]","[['B','C'],[],['A']]","[['B','C'],['A'],[]]","['A',2,1]",3
3,3,"[['B'],[],['A','C']]","[['B'],['A'],['C']]","[['B','C'],['A'],[]]","[['B'],['A'],['C']]","['C',0,2]",3
3,3,"[['B'],[],['A','C']]","[['B'],['A'],['C']]","[['B'],['A'],['C']]","[['B'],['A'],['C']]","['_','_','_']",3
```
---
## 💡 Usage Tips
### For Model Training
1. **Start with Block World**: It's the most learnable puzzle—ideal for validating your training pipeline
2. **Use full trajectories**: Train on complete state→action→next_state sequences
3. **Implement early stopping**: Monitor validation accuracy, stop when plateaus
4. **Try curriculum learning**: Train progressively from N=1 → N=7
### For Evaluation
```python
from datasets import load_dataset
# Load Block World
dataset = load_dataset("gmannem/RecurrReason", "block_world")
# Evaluation metrics to track:
# 1. Success Rate: % of puzzles solved correctly
# 2. Move Validity: % of generated moves that are legal
# 3. Optimality Gap: (|solution| - |optimal|) / |optimal|
# 4. Termination: Reaches goal within 2×optimal steps?
def evaluate_trajectory(model, example):
"""
Autoregressive rollout evaluation.
Start from initial state, generate next states until:
- Goal reached (success!)
- Invalid move generated (constraint violation)
- Loop detected (repeated state)
- Horizon exceeded (2× optimal length)
"""
current = example['start_state']
goal = example['goal_state']
visited = set()
steps = 0
max_steps = 2 * example['num_moves']
while steps < max_steps:
# Generate next state
next_state = model.predict(current, goal)
# Check termination conditions
if next_state == goal:
return "SUCCESS", steps
if next_state in visited:
return "LOOP", steps
if not is_valid_state(next_state):
return "INVALID", steps
visited.add(next_state)
current = next_state
steps += 1
return "TIMEOUT", steps
```
---
## 🔬 Research Directions
Based on our findings, promising research directions include:
1. **Architecture Search**: Why does bidirectional attention help so much? Can we design minimal architectural changes for goal-conditioning?
2. **Length Generalization**: Block World shows gradual OOD degradation—can we improve N=8-10 performance further?
3. **Transfer Learning**: Does Block World skill transfer to other local-structure planning tasks?
4. **Hybrid Approaches**: Combining neural models with explicit state-space search
---
## 📚 References
**Main Paper:**
```bibtex
@inproceedings{mannem2026recurrent,
title={Recurrent Reasoning on Symbolic Puzzles with Sequence Models},
author={Gowrav Mannem and Chowdhury Marzia Mahjabin and Jason Chen and Shivank Garg and Kevin Zhu},
booktitle={ICLR 2026 Workshop on Logical Reasoning of Large Language Models},
year={2026}
}
```
**Original Puzzle Introduction:**
```bibtex
@article{shojaee2025illusion,
title={The illusion of thinking: Understanding the strengths and limitations of reasoning models via the lens of problem complexity},
author={Shojaee, Parshin and Mirzadeh, Iman and Alizadeh, Keivan and Horton, Maxwell and Bengio, Samy and Farajtabar, Mehrdad},
journal={arXiv preprint arXiv:2506.06941},
year={2025}
}
```
---
[← Back to Main README](README.md) |