🤖 AI Hot

NVIDIA SpatialClaw Uses Code for Spatial Reasoning

A
Alex Chen

Vision-language models have gotten good at answering questions about images. Show them a photo and ask what’s in it, they’ll tell you. But ask them to reason about 3D space — “is the blue cup closer to the camera than the red notebook?” — and things fall apart fast. VLMs weren’t trained to think in three dimensions, and slapping object detection on top doesn’t fix the problem. NVIDIA Research just published SpatialClaw, and their approach is refreshingly simple: instead of building yet another specialized model, they gave VLMs a Python interpreter and told them to figure it out with code.

The paper dropped on arXiv in June 2026 (2606.13673) with a headline number that made me sit up: 59.9% average accuracy across 20 spatial reasoning benchmarks, beating the previous best spatial agent by 11.2 points. That’s a big jump in a field where improvements usually come in 1-2 point increments. What’s more interesting is how they did it — no fine-tuning, no benchmark-specific prompts, no model architecture changes. They just changed the action interface.

Why Predefined Tool Calls Break Spatial Reasoning

Most spatial AI systems work like this: you give the model a menu of spatial operations it can call — “detect objects,” “estimate depth,” “measure distance between X and Y.” The model picks from the menu, receives the result, and picks again. It’s essentially a choose-your-own-adventure where every page only shows you one thing at a time.

This breaks down fast with real 3D scenes. Say you need to figure out whether a chair would fit through a doorway. You’d need to detect the chair’s bounding box, measure its width, detect the doorway, measure its width, compare the two, and then reason about clearance angles. With predefined tools, each step is a separate API call with its own latency, and the model can’t compose them. It can’t write “chair_width = max(box.dimensions) - 5cm for padding” because there’s no tool for that — there’s only “detect_object” and “measure_distance.”

SpatialClaw’s insight: don’t give the model a fixed tool menu. Give it a Jupyter kernel preloaded with perception primitives (SAM3 for segmentation, Depth-Anything-3 for depth reconstruction, geometry utilities) and scientific Python libraries (NumPy, SciPy, Matplotlib). The model writes one Python cell per reasoning step into a persistent kernel. Variables persist between cells. The model can define helper functions, filter results with list comprehensions, and plot intermediate outputs to verify its own work.

I’ve been building agentic systems for a few years now, and this pattern — code as the action space instead of a fixed JSON schema — keeps showing up in the best systems. Claude Code does this for software engineering. SpatialClaw does it for 3D reasoning. The common thread: when you let models write code, they can compose operations in ways no API designer would predict.

The 20-Benchmark Gauntlet

SpatialClaw was evaluated across a deliberately broad set of tasks — static 3D scenes, dynamic 4D (3D over time) scenarios, tabletop object arrangements, room-scale navigation, and multi-step reasoning chains. The benchmarks include BLINK, SpatialBench, ScanQA, and several custom evaluations designed to stress-test specific failure modes of VLMs. Across all 20, SpatialClaw hit 59.9% average with GPT-4o as the backbone. The previous state-of-the-art spatial agent managed 48.7%.

What convinced me wasn’t just the average. It was the consistency across model families. They tested six VLM backbones — GPT-4o, GPT-4.1, Claude 3.5 Sonnet, Claude Opus 4, Gemini 2.5 Pro, and Qwen2.5-VL — and SpatialClaw improved every single one. No model-specific tuning. No per-benchmark prompt engineering. Just the same code-as-action interface, applied uniformly.

The biggest gains showed up on tasks requiring multi-step spatial chains: “identify the red mug, determine whether it’s above the table surface, and if not, describe its trajectory.” With tool-call systems, the model tends to get lost around step two. With SpatialClaw, the model writes code that chains operations — detect, filter by color, compute centroid, compare z-coordinate — and the kernel handles the rest.

The gap also widened with scene complexity. On simple tabletop scenes with 3-5 objects, both approaches do fine. On cluttered room environments with 20+ objects, partial occlusions, and moving cameras, SpatialClaw held its ground while tool-call systems degraded sharply. The researchers attribute this to the persistent kernel: intermediate computations stay available, so the model doesn’t need to re-detect objects it already found.

Who Should Pay Attention

If you’re building visual AI agents for robotics, autonomous vehicles, augmented reality, or warehouse automation, SpatialClaw is worth a serious look. The code is open source on GitHub under NVlabs/SpatialClaw. The setup is straightforward: pip install the dependencies, configure your VLM API key, and you can run the evaluation suite locally.

The training-free aspect matters more than you’d think. Most spatial reasoning solutions require fine-tuning on domain-specific datasets — manufacturing floor layouts, surgical scenes, construction sites. That’s expensive and fragile. You need labeled 3D data for each new environment, and the model tends to overfit to the training distribution. SpatialClaw drops in with any VLM backbone and works immediately across all 20 benchmarks without ever seeing a single training example from any of them.

For engineers working on robot manipulation specifically, there’s a practical advantage: you can iterate fast. Changing behavior doesn’t require retraining — you modify the Python code the model generates, or adjust the system prompt to guide what kind of code it writes. Compare this to the typical robot learning pipeline: collect demonstrations, train a policy, deploy, discover it fails on edge cases, repeat. With SpatialClaw, debugging means reading the generated Python and spotting the logic error, not retraining a neural network.

For researchers, the paper makes a broader argument that’s worth engaging with: the action interface is the bottleneck, not the model. We’ve been pouring effort into bigger models and better training data for spatial reasoning, but the architecture of how models interact with 3D perception hasn’t changed much. SpatialClaw suggests we should be redesigning the interface, not just the model behind it. If that argument holds, it applies beyond spatial reasoning — to code generation, scientific discovery, and anywhere else models need to interact with complex tool ecosystems.

Limitations They’re Not Hiding

The paper is honest about where SpatialClaw falls short. At 59.9%, it’s still failing on 40% of tasks. The failures cluster around two areas: dynamic scenes with rapid motion (tracking a thrown object through multiple frames) and tasks requiring precise metric measurements (estimating distances to within 2cm in cluttered scenes).

The code-as-action approach also introduces latency that tool-call systems avoid. Each Python cell executes sequentially, and complex spatial operations like running SAM3 on a high-resolution point cloud can take seconds. For real-time robotics control loops running at 30Hz, that’s unworkable. The researchers suggest hybrid architectures — SpatialClaw for high-level reasoning, traditional controllers for low-level execution — but that’s not implemented yet.

There’s also a practical limitation for anyone running this on local hardware: SAM3 and Depth-Anything-3 need GPU memory. A single A100 handles most scenes, but dense 3D reconstructions of room-scale environments push 20-30GB of VRAM. You can run it on consumer GPUs with smaller scenes, but don’t expect to point it at a warehouse and get real-time results on a 4090.

Cost is another factor. Each SpatialClaw run calls the VLM multiple times — once per reasoning step, plus potentially more if the model needs to debug its own code. On complex scenes, you might be looking at 20-30 API calls. At GPT-4o pricing, that’s a few dollars per scene. Fine for research and offline processing, painful for production at scale.

How This Fits Into the Agent Landscape

SpatialClaw sits at an interesting intersection. It’s an agent — it makes observations, writes code, executes it, observes the output, and decides what to do next. But it doesn’t use the function-calling APIs that most agent frameworks (LangChain, CrewAI, AutoGen) are built around. It uses code execution instead.

This mirrors a trend I’ve been tracking across AI: the best agents don’t call tools through JSON schemas, they write and run code. Claude Code writes shell commands and Python scripts. OpenHands and SWE-Agent edit files directly. SpatialClaw extends this pattern to spatial reasoning, and I’d bet we’ll see similar code-as-action designs for scientific computing, data analysis, and CAD modeling within the next year.

There’s a concrete reason this keeps winning. JSON function-calling forces the model to express its intent through a fixed vocabulary — the list of available tools and their parameters. When your problem fits that vocabulary, it’s fine. When you need a composition that the API designer didn’t think of, you’re stuck. Code doesn’t have this limitation. You can import any library, define any function, and compose them however you need. The interface grows with the problem instead of bottlenecking it.

This is especially true for spatial reasoning because 3D scenes are compositional by nature. A scene has objects, those objects have relationships (above, behind, containing), and those relationships chain. “Find the mug on the table near the window” requires composing object detection, spatial relationship queries, and geometric constraints. With tool calls, each of those is a separate round trip. With code, the model writes a pipeline: detect → filter → compute distances → rank. One cell, one logical unit of work.

The multi-agent angle is also worth watching. SpatialClaw’s kernel architecture means one agent’s output can feed directly into another’s input — no serialization, no schema negotiation. A spatial reasoning agent could pass a structured scene representation to a planning agent, which passes motion primitives to a control agent. IBM’s CUGA framework already supports this pattern where agents expose themselves as tools to other agents, and SpatialClaw’s code-based interface makes it especially clean to wire into multi-agent systems. Each agent just reads the previous agent’s Python variables from the shared kernel state — no JSON parsing, no schema versioning, no fragile string-based protocols between components.

I’m less excited about the benchmarks and more excited about what this pattern enables. When you treat code as the interface between models and the physical world, you get compositionality for free. Need to combine object detection with geometric reasoning and physics simulation? Import three libraries and write a function. With predefined tools, you’d need the API designer to have anticipated your exact use case. With code, you just… write code.

The code and paper are at github.com/NVlabs/SpatialClaw. If you’re working on anything involving VLMs and 3D scenes, spend an afternoon with it. Even if you don’t adopt the framework, the action-interface argument alone is worth the read.

Disclosure: CarCare Guide is reader-supported. When you buy through links on our site, we may earn an affiliate commission at no extra cost to you. Learn more.
A
Alex Chen