TL;DR
SpatialClaw is a training-free spatial reasoning framework that replaces rigid tool-calling interfaces with a stateful, multi-turn Python kernel. By allowing vision-language models (VLMs) to write, execute, and iteratively revise code based on intermediate visual and textual feedback, SpatialClaw achieves an +11.2 point accuracy boost across 20 spatial reasoning benchmarks.
What Problem Does This Paper Address?
While modern Vision-Language Models (VLMs) excel at many tasks, 3D and 4D spatial reasoning—such as determining object depth, tracking 3D trajectories, or calculating metric distances—remains a major weak spot. To fix this, researchers often equip VLMs with specialist perception tools (like depth estimators or object segmenters).
However, the authors argue that the action interface—how the agent invokes these tools—is a critical, overlooked bottleneck. Current spatial agents typically use one of two restrictive interfaces:
- Single-pass code execution: The agent writes an entire Python script upfront and runs it once. It cannot see intermediate outputs (like a segmentation mask) before committing to its final calculation strategy.
- Structured tool-calling: The agent interacts via fixed JSON/XML commands. This prevents it from freely composing operations or using powerful external scientific libraries (like NumPy or SciPy) to solve unique geometric problems on the fly.
Methods
SpatialClaw introduces code as the action interface within a persistent, stateful IPython workspace. Instead of forcing a single-pass program or rigid API calls, SpatialClaw allows the VLM to write one executable Python cell per step, observe the results, and adapt its strategy.
The framework operates in a five-stage loop:
- Planning: An isolated LLM outlines an analysis plan based on the question and tool documentation (without seeing the images, to maximize efficiency).
- Code Generation: The main VLM agent generates a single Python code cell implementing the next step of the plan.
- Code Execution: A static checker validates the code for safety before running it in a persistent kernel pre-loaded with input frames, perception primitives (Depth Anything 3 for 3D reconstruction, SAM3 for segmentation), and scientific libraries.
- Feedback Assembly: The kernel returns standard output, variable summaries, and visual feedback via a custom
show()function, allowing the agent to inspect intermediate masks or plots. - Answer Submission: The loop repeats (up to 30 steps) until the agent gathers enough evidence to submit a final answer.
Datasets
The authors evaluated SpatialClaw across 20 spatial reasoning benchmarks spanning five distinct categories:
- Single-image spatial reasoning: ERQA, Omni3D, OmniSpatial, SPBench
- Multi-view spatial reasoning: MindCube, MMSI, SPAR-Bench
- Video spatial & 4D reasoning: MMSI-Video, OSI-Bench, PAI-Bench, VSI-Bench-U, VSTI-Bench, DSI-Bench
- General spatial reasoning: BLINK, SpatialTree, ViewSpatial
- General video understanding: CV-Bench, PerceptComp, Video-MME, Video-MME-v2
Key Insights and Ideas
- Interface over Capacity: The design of the action interface matters immensely. Without changing tool capabilities or fine-tuning the underlying models, simply switching to an iterative, stateful code interface drives massive performance gains.
- Spontaneous, Task-Adaptive Composition: VLM agents naturally tailor their mathematical approaches based on the question semantics without explicit prompting. For instance, distance-based questions spontaneously trigger
scipy.spatial.KDTreeand vector norm operations, whereas direction-based questions naturally leverage dot products (np.dot). - The Power of Revision: Because the kernel is stateful, agents can catch errors early. If a visual feedback step reveals an incorrect segmentation mask or an implausible depth map, the agent can actively rewrite its code to try an alternative approach before committing to an answer.
Key Results
- State-of-the-Art Performance: SpatialClaw achieved an average accuracy of 59.9% across all 20 benchmarks, outperforming the recent state-of-the-art spatial agent (SpaceTools) by +11.2 percentage points.
- Broad Generalization: The gains were highly consistent across six different open-source VLM backbones from two distinct model families (Qwen3.5/3.6 and Gemma4), ranging from 26B to 397B parameters, without any model-specific tuning.
- Massive Lifts in 4D/Multi-View Tasks: The framework provided the largest advantages in complex scenarios requiring chained geometric computations across multiple frames or viewpoints, such as a +18.3% boost on the dynamic spatial intelligence benchmark, DSI-Bench.
Limitations and Future Work
The primary remaining bottleneck for SpatialClaw is perception quality. An LLM-as-judge failure analysis revealed that a significant portion of remaining errors stem from VLM hallucinations, tool limitations, or low-level perception primitive errors (e.g., bad initial object detection or segmentation) that propagate downstream.
For future work, the authors suggest applying reinforcement learning to optimize tool selection, improve the coding of complex geometric operations, and enhance error-recovery behaviors within the agentic loop.
Summary updated