World As a Program: Programmable Spatial Reasoning for Multimodal LLMs
Although Multimodal Large Language Models (MLLMs) have advanced rapidly, spatial reasoning remains limited by implicit, geometrically unconstrained representations. Meanwhile, existing explicit-geometry approaches may produce inaccurate or incomplete object geometry, limiting the reliability of subsequent spatial reasoning. Recent advances in 3D reconstruction enable explicit scene representations from ordinary videos. This raises a natural question: Can explicit 3D world states be made directly programmable for MLLMs? To this end, we propose WoRld As a Program (WRAP), a framework that converts standard video observations into an addressable and executable 3D scene state for MLLMs, where visual objects are exposed as Grounded Variables for 3D Program Reasoning. WRAP constructs candidate object point clouds from video observations and exposes them as Grounded Variables through persistent visual identifiers. The MLLM selects query-relevant variables from tagged frames and generates executable programs over their associated geometry. Extensive experiments demonstrate the effectiveness of WRAP, which achieves SOTA performance on ReVSI with up to 5.2% accuracy and outperforms prior methods on EditRoom-DB by up to 35.3% IoU. These results highlight the benefits of programmable 3D representations for spatial reasoning and scene editing.
