Thinking with Spatial Code for Physical-World Video Reasoning

Jieneng Chen, Wenxin Ma, Ruisheng Yuan, Yunzhi Zhang, Jiajun Wu +1 more
3/5/2026
cs.CV

Official code: Beckschen/spatialcode (23 stars, last commit 2026-03-18).

Abstract

We introduce Thinking with Spatial Code, a framework that transforms RGB video into explicit, temporally coherent 3D representations for physical-world visual question answering. We highlight the empirical finding that our proposed spatial encoder can parse videos into structured spatial code with explicit 3D oriented bounding boxes and semantic labels, enabling large language models (LLMs) to reason directly over explicit spatial variables. Specifically, we propose the spatial encoder that encodes image and geometric features by unifying 6D object parsing and tracking backbones with geometric prediction, and we further finetuning LLMs with reinforcement learning using a spatial rubric reward that encourages perspective-aware, geometrically grounded inference. As a result, our model outperforms proprietary vision-language models on VSI-Bench, setting a new state-of-the-art. Code is available at https://github.com/Beckschen/spatialcode.

View on arXivView PDF

Code Implementations(1)

Open studio for "Thinking with Spatial Code" (https://arxiv.org/pdf/2603.05591)

230Mar 11, 20267 months ago

Cite this paper

@article{chen2026thinking,
  title  = {Thinking with Spatial Code for Physical-World Video Reasoning},
  author = {Jieneng Chen and Wenxin Ma and Ruisheng Yuan and Yunzhi Zhang and Jiajun Wu and Alan Yuille},
  year   = {2026},
  eprint = {2603.05591},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2603.05591v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2603.05591.svg)](https://codeofpaper.com/paper/2603.05591)

Discussion