File size: 7,850 Bytes
1241690
 
8b76604
 
 
d6ffc7c
8b76604
 
 
d6ffc7c
8b76604
 
 
d6ffc7c
8b76604
 
 
d6ffc7c
8b76604
 
 
d6ffc7c
8b76604
 
 
d6ffc7c
8b76604
 
 
d6ffc7c
8b76604
 
 
d6ffc7c
8b76604
 
 
d6ffc7c
8b76604
 
 
d6ffc7c
8b76604
 
 
d6ffc7c
8b76604
 
 
d6ffc7c
8b76604
 
 
d6ffc7c
8b76604
 
 
d6ffc7c
8b76604
 
 
d6ffc7c
8b76604
 
 
d6ffc7c
ad84511
 
 
 
 
90f94cc
 
 
ad84511
90f94cc
 
 
c42a6f3
8b76604
 
 
c42a6f3
f87605d
8b76604
 
f87605d
8b76604
f87605d
 
8b76604
1241690
5a40216
aea3eb8
 
b3aad44
c3591ec
b3aad44
 
 
c3591ec
b3aad44
5a40216
b3aad44
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
cb8542d
 
 
 
 
 
 
 
 
 
b3aad44
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69b02e1
b3aad44
 
 
 
 
 
 
 
 
 
 
 
a1a1a3c
b3aad44
 
 
 
 
 
 
 
 
5a40216
 
 
 
 
b3aad44
 
 
5a40216
 
 
 
 
 
 
 
 
 
 
 
 
 
b3aad44
5a40216
 
 
 
 
 
 
 
 
 
 
 
411a2e0
 
b3aad44
 
 
 
 
 
 
 
5aa140e
b3aad44
 
 
 
 
 
 
 
 
 
5aa140e
b3aad44
 
 
5aa140e
b3aad44
5aa140e
b3aad44
 
411a2e0
b3aad44
87225fd
b3aad44
87225fd
8b76604
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
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
---
configs:
  - config_name: 1_random_cell_easy
    data_files:
      - split: test
        path: datasets/1_random_cell_easy.jsonl
  - config_name: 1_random_cell_hard
    data_files:
      - split: test
        path: datasets/1_random_cell_hard.jsonl
  - config_name: 5_random_cell_easy
    data_files:
      - split: test
        path: datasets/5_random_cell_easy.jsonl
  - config_name: 5_random_cell_hard
    data_files:
      - split: test
        path: datasets/5_random_cell_hard.jsonl
  - config_name: 10_random_cell_easy
    data_files:
      - split: test
        path: datasets/10_random_cell_easy.jsonl
  - config_name: 10_random_cell_hard
    data_files:
      - split: test
        path: datasets/10_random_cell_hard.jsonl
  - config_name: 1_random_row_easy
    data_files:
      - split: test
        path: datasets/1_random_row_easy.jsonl
  - config_name: 1_random_row_hard
    data_files:
      - split: test
        path: datasets/1_random_row_hard.jsonl
  - config_name: 3_random_row_easy
    data_files:
      - split: test
        path: datasets/3_random_row_easy.jsonl
  - config_name: 3_random_row_hard
    data_files:
      - split: test
        path: datasets/3_random_row_hard.jsonl
  - config_name: 1_random_column_easy
    data_files:
      - split: test
        path: datasets/1_random_column_easy.jsonl
  - config_name: 1_random_column_hard
    data_files:
      - split: test
        path: datasets/1_random_column_hard.jsonl
  - config_name: 3_random_column_easy
    data_files:
      - split: test
        path: datasets/3_random_column_easy.jsonl
  - config_name: 3_random_column_hard
    data_files:
      - split: test
        path: datasets/3_random_column_hard.jsonl
  - config_name: full_easy
    data_files:
      - split: test
        path: datasets/full_easy.jsonl
  - config_name: full_hard
    data_files:
      - split: test
        path: datasets/full_hard.jsonl
dataset_info:
  features:
    - name: index
      dtype: int32
    - name: input_grid
      sequence:
        sequence:
          dtype: string
    - name: ground_truth
      sequence:
        sequence:
          dtype: string
tags:
  - reasoning
  - physical reasoning
  - spatial reasoning
license: mit
task_categories:
  - text-generation
  - fill-mask
language:
  - en
pretty_name: SPhyR
size_categories:
  - 10K<n<100K
---

![SPhyR](sources/thumbnail.png)

# 🧠 SPhyR-Quick-Start

🦾 [Code](https://github.com/philippds/SPhyR)<br>
📄 [Paper](https://arxiv.org/pdf/2505.16048)<br>
🧰 [Prompt Template](https://github.com/philippds/SPhyR/blob/main/prompt_templates.py)<br>

## Prompt Template:

<pre style="white-space: pre-wrap;">
You are given a structural material distribution represented as a grid. Each cell can have one of the following states:
- 'L' indicates applied load.
- 'V' indicates void.
- 'S' indicates support.

The goal is to predict the correct material distribution by filling in all <span style="font-weight: 1000;">{FILL_INSTRUCTION}</span>, based on the surrounding structure and implicit physical reasoning (such as load paths, supports, and forces).

Important: The completed structure should use as little material as possible while remaining stable and plausible for carrying the applied forces. Minimize material usage unless necessary for structural support.

Below is the input grid with masked regions:

<span style="font-weight: 1000;">{GRID}</span>

Please output the completed grid by replacing all <span style="font-weight: 1000;">{FILL_INSTRUCTION}</span>.
Maintain the same format as the input: one row per line, cells separated by spaces, and the total number of rows and columns unchanged.
Return only the completed grid without any additional explanation.
</pre>

For easy difficulty use <span style="font-weight: 1000;">{FILL_INSTRUCTION}</span>: `'V' cells with either '1' (solid) or '0' (empty)`<br>
or for hard difficulty use <span style="font-weight: 1000;">{FILL_INSTRUCTION}</span>: `'V' cells with a floating point number between 0 and 1, with one decimal place (e.g., 0.0, 0.1, 0.2, ..., 1.0)`<br>

Replace <span style="font-weight: 1000;">{GRID}</span> with data from the subject respective column in the dataset for example `1_random_cell_easy`:

```python
L L L 0 0 0 0 0 0 0
0 1 0 0 0 0 0 0 0 V
V 1 1 0 0 0 0 0 0 V
1 1 1 0 0 0 0 V 0 0
1 1 1 0 0 0 0 0 V 0
1 1 1 0 V 0 0 0 0 V
1 1 1 0 0 0 0 0 0 0
1 1 1 0 0 0 0 V 0 0
0 1 0 0 0 0 V 0 0 0
V S S 0 0 0 0 0 0 0
```

## Evaluation

Metric 1: EM (Exact match)<br>
Metric 2: Score<br>
Metric 3: Score (normalized)<br>

For Score and Score (normalized) we count the overlap between groundtruth and the completion by the model as shown in the code-snippet below:

```python
...
def count_differences(list1, list2) -> int:
    count = 0
    for row1, row2 in zip(list1, list2):
        for cell1, cell2 in zip(row1, row2):
            if cell1 != cell2:
                count += 1
    return count

raw_input_ground_truth_difference_count = count_differences(
    raw_input_list, ground_truth_list
)

output_ground_truth_difference_count = count_differences(
    output_text_list, ground_truth_list
)

if output_ground_truth_difference_count == 0:
    exact_match = True
    score = 1
    normalized_score = 1
else:
    exact_match = False
    score = 1 - (
        output_ground_truth_difference_count /
        raw_input_ground_truth_difference_count
    )
    normalized_score = max(score, 0)
...
```

Please find the full code [here](https://github.com/philippds/SPhyR/blob/main/run_eval.py#L190).

---

# SPhyR Dataset Card

TopoReason is a benchmark dataset for evaluating the physical and spatial reasoning capabilities of Large Language Models (LLMs) through topology optimization tasks. Given 2D design conditions—boundaries, loads, and supports—models must predict optimal material distributions without physics engines. Tasks include masked region completion and full-structure prediction, testing models’ ability to infer structural stability and material flow.

## Dataset Details

### Dataset Description

- **Curated by:** Philipp D. Siedler
- **Language(s) (NLP):** English

### Dataset Sources

- **Repository:** https://github.com/philippds/SPhyR
- **Paper [optional]:** https://arxiv.org/pdf/2505.16048

## Dataset Structure

### Legend

- `L` - Load
- `S` - Support
- `V` - Void

### Subjects

#### Easy

Note: Here we use 0 and 1 for material distribution

```python
1_random_cell_easy
5_random_cell_easy
10_random_cell_easy
1_random_row_easy
3_random_row_easy
1_random_column_easy
3_random_column_easy
full_easy
```

#### Hard

Note: Here we use floating point numbers 0-1 for material distribution

```python
1_random_cell_hard
5_random_cell_hard
10_random_cell_hard
1_random_row_hard
3_random_row_hard
1_random_column_hard
3_random_column_hard
full_hard
```

## Dataset Creation

Please refer to the dataset repository on GitHub if you want to re-generate the dataset or interested in how this has been done: https://github.com/philippds/SPhyR. We used [Rhinoceros with Grasshopper](https://www.rhino3d.com/) and [Milipede plugin](https://www.creativemutation.com/millipede) to design the structural scenarios and simulated topology optimization.

## Citation

**BibTeX:**

```pyhton
@misc{siedler2025sphyr,
  title        = {SPhyR: Spatial-Physical Reasoning Benchmark on Material Distribution},
  author       = {Philipp D. Siedler},
  year         = {2025},
  eprint       = {2505.16048},
  archivePrefix= {arXiv},
  primaryClass = {cs.AI},
  doi          = {10.48550/arXiv.2505.16048},
  url          = {https://arxiv.org/abs/2505.16048}
}
```

**APA:**

```python
Siedler, P. D. (2025). SPhyR: Spatial-Physical Reasoning Benchmark on Material Distribution. arXiv. https://doi.org/10.48550/arXiv.2505.16048
```

## Dataset Card Authors

Philipp D. Siedler

## Dataset Card Contact

p.d.siedler@gmail.com