SPaRC: A Spatial Pathfinding Reasoning Challenge
A comprehensive toolkit for spatial reasoning puzzle solving and model evaluation
Overview
SPaRC provides a comprehensive framework for evaluating language models on spatial reasoning tasks inspired by "The Witness" puzzle game. This package includes tools for dataset processing, solution validation, and model evaluation with beautiful terminal output.
Installation
Install the package from PyPI:
pip install sparc-puzzle
Or install from source:
git clone https://github.com/lkaesberg/SPaRC.git
cd SPaRC
pip install -e .
Quick Start
1. Testing a Model on the Dataset
Run the complete benchmark on your model:
sparc --api-key "your-openai-api-key" --model "gpt-4" --batch-size 5
Key Features:
- 🔄 Resume Support: Automatically saves progress and resumes from where you left off
- ⚡ Batching: Process multiple puzzles concurrently for faster evaluation
- 🎨 Rich Output: Beautiful terminal interface with progress tracking
- 🛑 Graceful Shutdown: Press Ctrl+C to stop after current batch
Example with different endpoints:
# OpenAI API
sparc --api-key "sk-..." --model "gpt-4"
# Custom endpoint (e.g., local model)
sparc --api-key "your-key" --base-url "http://localhost:8080/v1" --model "llama-3.3-70b"
# Resume interrupted session
sparc --api-key "your-key" --model "gpt-4" # Automatically resumes
# Fresh start (ignore previous results)
sparc --api-key "your-key" --model "gpt-4" --overwrite
2. Using the Validation API
Use SPaRC's validation functions in your own code:
from sparc.validation import extract_solution_path, validate_solution, analyze_path
from sparc.prompt import generate_prompt
from datasets import load_dataset
# Load the dataset
dataset = load_dataset("lkaesberg/SPaRC", "all", split="test")
puzzle = dataset[0]
# Generate prompt for your model
puzzle_prompt = [
{
"role": "system",
"content": "You are an expert at solving puzzles games.",
},
{
"role": "user",
"content": generate_prompt(puzzle)
}
]
# Your model generates a response
model_response = "... model response with path coordinates ..."
# Extract the path from model response
extracted_path = extract_solution_path(model_response, puzzle)
# Returns: [{"x": 0, "y": 2}, {"x": 0, "y": 1}, ...]
# Validate against ground truth
is_correct = validate_solution(extracted_path, puzzle)
# Returns: True/False
# Get detailed analysis
analysis = analyze_path(extracted_path, puzzle)
# Returns: {
# "starts_at_start_ends_at_exit": True,
# "connected_line": True,
# "non_intersecting_line": True,
# "no_rule_crossing": True,
# "fully_valid_path": True
# }
3. Running SPaRC with Inspect AI
SPaRC is also an Inspect AI task. Inspect is an optional extra, so install it
with the package. From a checkout, run pip install -e ".[inspect]", then:
inspect eval sparc --model openai/gpt-4.1-mini # all 500 test puzzles
inspect eval sparc_hard --model openai/gpt-4.1-mini # the 89 hard (level 5) puzzles
With a normal (non-editable) install, for example pip install "sparc-puzzle[inspect]", the task names carry
the package prefix: inspect eval sparc/sparc and inspect eval sparc/sparc_hard.
Since task version 2-A, the prompt states the star, polyshape and negative polyshape rules the way the puzzles were
built. Add -T prompt=paper for the paper's original wording. See sparc/README.md for options,
the changelog, scoring and reproduced numbers.
Since version 0.7.0, the CLI's step-by-step and visual prompts use the same corrected rule wording. Each keeps its
original wording under a _paper name, for example --prompt gym_step_paper or --prompt single_shot_visual_paper.
CLI Reference
Basic Usage
sparc --api-key "your-key" [OPTIONS]
Options
| Option | Default | Description |
|---|---|---|
--api-key |
Required | OpenAI API key or your model's API key |
--base-url |
https://api.openai.com/v1 |
API endpoint URL |
--model |
gpt-4 |
Model name to evaluate |
--temperature |
1.0 |
Generation temperature |
--batch-size |
5 |
Number of concurrent requests |
--results-file |
<model>.jsonl |
File to save results |
--overwrite |
False |
Ignore existing results and start over |
--verbose |
False |
Show detailed output for each puzzle |
--max-new |
None |
Process at most this many new puzzles |
--gym |
False |
Use step-by-step gym mode instead of single-shot |
--gym-traceback |
False |
Enable traceback visualization in gym mode |
--run-name |
None |
Suffix for output filename (e.g., experiment1) |
Examples
# Basic evaluation
sparc --api-key "sk-..." --model "gpt-4"
# High throughput with larger batches
sparc --api-key "sk-..." --model "gpt-3.5-turbo" --batch-size 20
# Conservative approach with lower temperature
sparc --api-key "sk-..." --model "gpt-4" --temperature 0.1
# Verbose output to see each puzzle result
sparc --api-key "sk-..." --model "gpt-4" --verbose
# Custom results file
sparc --api-key "sk-..." --model "claude-3" --results-file "claude_results.json"
# Process only 10 new puzzles
sparc --api-key "sk-..." --model "gpt-4" --max-new 10
# Step-by-step gym mode (agent receives feedback after each move)
sparc --api-key "sk-..." --model "gpt-4" --gym
# Gym mode with traceback (shows path history in observations)
sparc --api-key "sk-..." --model "gpt-4" --gym --gym-traceback
# Named experiment run
sparc --api-key "sk-..." --model "gpt-4" --run-name "experiment1"
Core Functions
extract_solution_path(solution_text: str, puzzle_data: Dict) -> List[Dict[str, int]]
Extracts coordinate path from model response text.
validate_solution(extracted_path: List[Dict[str, int]], puzzle_data: Dict) -> bool
Validates if the extracted path matches any ground truth solution.
analyze_path(solution_path: List[Dict[str, int]], puzzle: Dict) -> Dict
Provides detailed analysis of path validity and rule compliance.
generate_prompt(puzzle_data: Dict) -> str
Generates the formatted prompt for a puzzle.
Contributing
Contributions are welcome! Please feel free to submit pull requests or open issues.
Citation
If you use SPaRC in your research, please cite:
@inproceedings{kaesberg-etal-2025-sparc,
title = "{SP}a{RC}: A Spatial Pathfinding Reasoning Challenge",
author = "Kaesberg, Lars Benedikt and Wahle, Jan Philip and Ruas, Terry and Gipp, Bela",
booktitle = "Proceedings of the 2025 Conference on Empirical Methods in Natural Language Processing",
month = nov,
year = "2025",
address = "Suzhou, China",
publisher = "Association for Computational Linguistics",
url = "https://aclanthology.org/2025.emnlp-main.526/",
doi = "10.18653/v1/2025.emnlp-main.526",
pages = "10359--10390"
}
If you use the step-by-step environment, please also cite Spatial-Gym:
@misc{kaesberg2026spatialgym,
title = {Mind the Gap Between Spatial Reasoning and Acting! Step-by-Step Evaluation of Agents With Spatial-Gym},
author = {Kaesberg, Lars Benedikt and Yang, Tianyu and Bauer, Niklas and Ruas, Terry and Wahle, Jan Philip and Gipp, Bela},
year = {2026},
eprint = {2604.09338},
archivePrefix = {arXiv}
}
If you use the visual scaffolds, please also cite:
@misc{kaesberg2026visualprompting,
title = {Is Visual Prompting All You Need? Studying VLM Spatial Reasoning under Progressive Visual Scaffolds},
author = {Kaesberg, Lars Benedikt and Yang, Tianyu and Wunderlich, Florian Valentin and Ruas, Terry and Kurzawe, Daniel and Wahle, Jan Philip and Gipp, Bela},
year = {2026},
eprint = {2608.21170},
archivePrefix = {arXiv},
note = {Accepted at Findings of EMNLP 2026}
}
Related work from our group
| Paper | Venue | Links |
|---|---|---|
| SPaRC: A Spatial Pathfinding Reasoning Challenge | EMNLP 2025 (Main) | ACL Anthology · arXiv:2505.16686 · Code · Dataset |
| Mind the Gap Between Spatial Reasoning and Acting! Step-by-Step Evaluation of Agents With Spatial-Gym | arXiv preprint, 2026 | arXiv:2604.09338 · Code |
| Is Visual Prompting All You Need? Studying VLM Spatial Reasoning under Progressive Visual Scaffolds | Findings of EMNLP 2026 | arXiv:2608.21170 |
| Voting or Consensus? Decision-Making in Multi-Agent Debate | Findings of ACL 2025 | ACL Anthology · arXiv:2502.19130 |
License
This project is licensed under the MIT License - see the LICENSE file for details.
Links
- 🌐 Website: sparc.gipplab.org
- 📚 Dataset: Hugging Face
- 🐛 Issues: GitHub Issues
- 📖 Documentation: GitHub Repository
Metadata
Release files for sparc-puzzle 0.7.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| sparc_puzzle-0.7.0.tar.gz | 42.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sparc_puzzle-0.7.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 111.4 kB
Release files / sparc_puzzle-0.7.0.tar.gz
| Download URL | sparc_puzzle-0.7.0.tar.gz |
|---|---|
| Size | 42.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8ae3dd2611f7763211bb888a403d537bba6c0d19dfa6bb48d0273f5c07421fbb
|
|
BLAKE2b-256 checksum How to use checksums |
2672355f4c210e82409e3305d1f51c6b1694beb6f1c99dfc055c3179f68a424e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / sparc_puzzle-0.7.0-py3-none-any.whl
| Download URL | sparc_puzzle-0.7.0-py3-none-any.whl |
|---|---|
| Size | 69.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
97c872d56ad1db1b0a5731175f6a9c0544230b0830b86f19e77d2e4bd741e4f2
|
|
BLAKE2b-256 checksum How to use checksums |
98d6f78ce11d1f4f7912b673a30cc5174a5d7b6ca737a55c242ba48986d4896d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Security for sparc-puzzle 0.7.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.