---
configs:
- config_name: 1_random_cell_easy
data_files:
- split: test
path: datasets/1_random_cell_easy.json
- config_name: 1_random_cell_hard
data_files:
- split: test
path: datasets/1_random_cell_hard.json
- config_name: 5_random_cell_easy
data_files:
- split: test
path: datasets/5_random_cell_easy.json
- config_name: 5_random_cell_hard
data_files:
- split: test
path: datasets/5_random_cell_hard.json
- config_name: 10_random_cell_easy
data_files:
- split: test
path: datasets/10_random_cell_easy.json
- config_name: 10_random_cell_hard
data_files:
- split: test
path: datasets/10_random_cell_hard.json
- config_name: 1_random_row_easy
data_files:
- split: test
path: datasets/1_random_row_easy.json
- config_name: 1_random_row_hard
data_files:
- split: test
path: datasets/1_random_row_hard.json
- config_name: 3_random_row_easy
data_files:
- split: test
path: datasets/3_random_row_easy.json
- config_name: 3_random_row_hard
data_files:
- split: test
path: datasets/3_random_row_hard.json
- config_name: 1_random_column_easy
data_files:
- split: test
path: datasets/1_random_column_easy.json
- config_name: 1_random_column_hard
data_files:
- split: test
path: datasets/1_random_column_hard.json
- config_name: 3_random_column_easy
data_files:
- split: test
path: datasets/3_random_column_easy.json
- config_name: 3_random_column_hard
data_files:
- split: test
path: datasets/3_random_column_hard.json
- config_name: full_easy
data_files:
- split: test
path: datasets/full_easy.json
- config_name: full_hard
data_files:
- split: test
path: datasets/full_hard.json
tags:
- reasoning
- physical reasoning
license: mit
---

# š§ SPhyR-Quick-Start
𦾠[Code](https://github.com/philippds/SPhyR)
š [Paper](https://arxiv.org/pdf/2505.16048)
š§° [Prompt Template](https://github.com/philippds/SPhyR/blob/main/prompt_templates.py)
## Prompt Template:
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 {FILL_INSTRUCTION}, 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:
{GRID}
Please output the completed grid by replacing all {FILL_INSTRUCTION}.
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.
For easy difficulty use {FILL_INSTRUCTION}: `'V' cells with either '1' (solid) or '0' (empty)`
or for hard difficulty use {FILL_INSTRUCTION}: `'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)`
Replace {GRID} 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)
Metric 2: Score
Metric 3: Score (normalized)
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):** Any (prompt provided in 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