ClosureBench: A Constructive Benchmark for Compositional Graph Reasoning
Organizations: AIM Research Lab
Abstract
Large language models fail on multi-step compositional reasoning, but measuring that failure is hard, because new models are trained on the benchmarks used to evaluate them. A fixed test set becomes a memorisation check soon after release. Constructive benchmarks avoid this by generating instances on demand. We introduce ClosureBench, a constructive benchmark for graph-relational logical reasoning. Each task is built from explicit primitives (reachability, degree, set operations, connectivity, aggregation), and its reference answer is computed by executing code that implements that logic exactly. Ground truth is therefore verified, and the supply of fresh instances is unlimited. The benchmark spans 26 task categories at three compositional levels, with three independent difficulty axes: graph size, edge density, and query depth. We evaluate models from 1.5B open weights to frontier systems (o3, GPT-4.1, Gemini 2.5, Claude Sonnet 4). Accuracy falls as graph size and query depth increase, and the two axes interact. The difficulty does not lie in the surface form, since it persists when the graph is given as a JSON edge list or an adjacency matrix rather than prose, nor in the reasoning rule, which models state correctly. It lies in carrying that rule out over the graph across many steps. A 4B model fine-tuned to emit verified programs instead of answers stays nearly flat across compositional levels, while every frontier model degrades. o3 falls from 96% on atomic queries to 82% on the most compositional; the 4B model holds at 93% at a fraction of the token cost. The program offloads multi-step execution to a runtime, and the model's remaining errors are almost entirely misread edges. Constructive generation also supports a direct memorisation check, comparing accuracy on seen and fresh instances.
Figures & tables
| Primitive | Definition | Example question | Categories |
|---|---|---|---|
| Degree | how many does point to? | degree_count, degree_max | |
| Reachability | can reach ? | reachability, has_path | |
| Reachable-set size | how many can reach? | reach_then_count, reach_then_filter | |
| Set operations | , | reachable from but not ? | set_intersect, set_difference, negative_reach |
| Triangles | how many triangles? | triangle_count, triangle_in_subgraph | |
| Connectivity (SCC) | are mutually reachable? | scc_same, scc_then_count |
| Level | Name | Steps | Test | Representative Categories |
|---|---|---|---|---|
| L1 | Atomic | 1 | 550 | triangle count, reachability, degree, ancestor, set ops |
| L2 | Chain | 2–3 | 400 | reach-then-count, SCC-then-count, kinship chain |
| L3 | Composition | 3–5 | 350 | conditional, multi-query, aggregate-over-set |
| Model | L1 | L2 | L3 | Overall |
|---|---|---|---|---|
| Open models (direct mode) | ||||
| Qwen2.5-1.5B | 35.1 | 22.2 | 15.4 | 25.8 |
| Qwen3.5-2B | 40.2 | 31.8 | 23.1 | 33.0 |
| Qwen3-4B | 47.8 | 43.0 | 22.3 | 39.5 |
| Qwen3.5-9B | 52.0 | 46.2 | 26.3 | 43.3 |
| Frontier API (direct mode) | ||||
| Model | ||||
|---|---|---|---|---|
| o3 | 95 | 90 | 94 | 94 |
| Gemini 2.5 Flash | 92 | 89 | 85 | 79 |
| GPT-4.1 (CoT) | 92 | 88 | 85 | 75 |
| Claude Sonnet 4 (CoT) | 92 | 81 | 78 | 78 |
| Model | Mode | Tok/ans | Acc. (%) | Tok/correct |
|---|---|---|---|---|
| Qwen3-4B | Direct | 38 | 39.5 | 96 |
| Qwen3.5-9B | Direct | 52 | 43.3 | 120 |
| GPT-4.1 | Direct | 7 | 52.4 | 13 |
| Gemini Flash | Direct | 1,261 | 87.4 | 1,443 |
| GPT-4.1 | CoT | 431 | 86.2 | 500 |
| o3 | Direct | 844 | 92.8 | 910 |
| Method | Exec. rate | Seen | Held-out | Gap |
|---|---|---|---|---|
| Qwen3-4B (base, direct NL) | 100% | 34.5% | 34.2% | — |
| Qwen3-4B (answer SFT, direct) | 100% | 78.5% | 59.2% | 19.3pp |
| Qwen3-4B (Python+NetworkX SFT) | 97.8% | 96.1% | 92.6% | 3.5pp |
| Qwen3-4B (Ein SFT) | 99.6% | 98.0% | 94.3% | 3.7pp |
| Model | NL | JSON edges | Adj. matrix |
|---|---|---|---|
| Qwen2.5-1.5B | 26.5 | 26.5 | 24.5 |
| Qwen3.5-2B | 28.5 | 29.5 | 19.5 |
| Qwen3-4B | 40.0 | 38.0 | 24.5 |
| Qwen3.5-9B | 47.5 | 51.0 | 30.0 |
| GPT-4.1 | 53.0 | 59.5 | 44.0 |
| Gemini 2.5 Flash | 84.5 | 88.5 | 91.0 |
Appendix figures & tables4 assets
Supplementary material from the paper’s appendix.
Appendix
| Level | Category | Held-out (%) |
|---|---|---|
| L1 | triangle_count | 82 |
| L1 | reachability | 98 |
| L1 | negative_reach | 96 |
| L1 | degree_count | 84 |
| L1 | degree_max | 94 |
| L1 | scc_same | 96 |
| result_type | JSON value | Example | Categories |
|---|---|---|---|
| boolean | true / false | {"answer": true} | reachability, scc_same, conditional |
| integer | non-negative integer | {"answer": 3} | triangle_count, degree_count, *_then_count |
| float | finite real | {"answer": 2.43} | aggregate_over_set, mixed_domain |
| set | JSON array of strings | {"answer": ["a","c"]} | set_intersect, set_difference, ancestor, sibling, cousin |
| string | one node label | {"answer": "kiwi"} | degree_max, degree_then_reach |
| compound | JSON object | {"answer": {"reach": true, "deg": 1}} | multi_query |
| Method | Strict | Lenient | Gap |
| Open models (direct) | |||
| Qwen2.5-1.5B | 21.3 | 25.8 | |
| Qwen3.5-2B | 27.8 | 33.0 | |
| Qwen3-4B | 33.2 | 39.5 | |
| Qwen3.5-9B | 37.8 | 43.3 | |
| Frontier API | |||
| Method | Strict | Lenient-only | Wrong | Format err. | No ans. |
| GPT-4.1 (direct) | 46.1 | 6.3 | 43.1 | 4.5 | 0.0 |
| GPT-4.1 (CoT) | 84.6 | 1.6 | 10.7 | 2.5 | 0.6 |
| GPT-4.1-mini (direct) | 43.9 | 5.3 | 44.6 | 6.2 | 0.0 |
| GPT-4.1-mini (CoT) | 84.5 | 1.3 | 10.5 | 3.3 | 0.4 |
| Claude Sonnet 4 (direct) | 79.1 | 2.6 | 14.6 | 3.7 | 0.0 |
| Claude Sonnet 4 (CoT) | 82.0 | 1.6 | 12.2 | 4.2 | 0.0 |
LLM Reasoning with Graphs
Large language model reasoning with graphs uses structured relationships to support multi-step inference, evidence retrieval, and planning.
See all 198 papers