File size: 4,142 Bytes
538ccea
 
 
1ccd86b
538ccea
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
license: cc-by-4.0
task_categories:
- text-generation
- other
language:
- en
tags:
- in-context-learning
- reasoning
- arc-agi
- synthetic
- rule-induction
pretty_name: In-Context Grid Reasoning (ICGR)
size_categories:
- 1K<n<10K
configs:
- config_name: default
  data_files:
  - split: train
    path: data/train.jsonl
  - split: test
    path: data/test.jsonl
---

# In-Context Grid Reasoning (ICGR)

A small, fully synthetic benchmark for **demonstration-conditioned rule induction**:
each task shows 2–4 `(input grid → output grid)` support pairs that share one
hidden transformation, and the model must apply the same transformation to a
held-out query input.

It targets the same behaviour probed by recent in-context / latent-reasoning work
on ARC-AGI (e.g. *BDH-CQ: In-Context Learning with Recurrent Latent Reasoning*,
[arXiv:2608.09888](https://arxiv.org/abs/2608.09888)), but is deliberately tiny,
transparent, and license-clean so it can be used freely for quick probes and
ablations.

## Why this exists

ARC-AGI itself is excellent but small and easy to overfit to via public solvers.
ICGR is **procedurally generated from a single script** ([`generate.py`](generate.py)),
so you can:

- regenerate it deterministically (`--seed`),
- scale it up (`--n`),
- know exactly which rule family each task belongs to (for per-concept scoring),
- trust its provenance — no scraped text, images, or third-party datasets, so
  there is no upstream copyright. Released under CC-BY-4.0.

## Format

One JSON object per line.

| field | type | notes |
|---|---|---|
| `task_id` | str | e.g. `icgr-00042` |
| `rule` | str | rule id(s), `+`-joined for compositions |
| `rule_kind` | str | `atomic` or `composed` |
| `rule_description` | str | plain-English statement of the transformation |
| `num_colors` | int | cell alphabet size (4–6) |
| `grid_h`, `grid_w` | int | query/support grid dimensions before the rule |
| `num_support` | int | number of demonstration pairs (2–4) |
| `support` | list | `[{"input": grid, "output": grid}, ...]` |
| `query_input` | str | grid to transform |
| `query_output` | str | expected answer |

Grids are serialised as rows of space-separated integers, rows joined by `;`.
Example: `"1 2 0;0 1 2"` is the 2×3 grid `[[1,2,0],[0,1,2]]`.

```python
from datasets import load_dataset

ds = load_dataset("WhySoCodius/in-context-grid-reasoning", split="test")
ex = ds[0]
print(ex["rule_description"])
for pair in ex["support"]:
    print(pair["input"], "->", pair["output"])
print("Q:", ex["query_input"], "=>", ex["query_output"])
```

## Rule families

`flip_h`, `flip_v`, `transpose`, `rotate90`, `add_mod` (add constant mod colour
count), `color_swap`, `shift_rows` (cyclic), `tile_h` (self-concat), `border`
(paint outer ring), `max_pool2` (2×2 max). ~35% of tasks compose two of the
size-preserving rules; `rule` records which and in what order.

## Splits

| split | tasks |
|---|---|
| train | 800 |
| test | 200 |

Split is a random shuffle at a fixed seed; the same rule family appears in both.
It is a convenience split, not an adversarial generalisation split — if you need
held-out rules, filter by `rule`.

## Suggested metric

Exact string match on `query_output` after normalising whitespace. Report overall
accuracy plus a breakdown by `rule` and by `rule_kind`.

## Limitations

- Rules are simple and enumerable; a symbolic solver can reach 100%. The point is
  to measure whether a *learning* system infers the rule from demonstrations
  alone, not to be unsolvable.
- Grids are small (3×5 max, 6×6 for pooling) and dense.
- English rule descriptions are templated.

## Reproduce / extend

```bash
python generate.py --n 5000 --seed 123
python test_generate.py   # self-check
```

## Citation

```bibtex
@misc{icgr2026,
  title  = {In-Context Grid Reasoning (ICGR): a synthetic benchmark for
            demonstration-conditioned rule induction},
  author = {WhySoCodius},
  year   = {2026},
  howpublished = {\url{https://huggingface.co/datasets/WhySoCodius/in-context-grid-reasoning}}
}
```

License: [CC-BY-4.0](LICENSE). Attribution appreciated; no other restrictions.