SPhyR / README.md
philippds's picture
change file type to jsonl
d6ffc7c
---
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