SpatialMem: Building Quantitative Spatial Reasoning Agents with Hierarchical Memory
Organizations: Hong Kong University of Science and Technology (Guangzhou) · HY Foundation Model Team, Tencent
Abstract
Vision Language Models (VLMs) have shown remarkable capabilities in qualitative spatial reasoning, but remain limited in quantitative spatial reasoning. Current work leverages the VLM agent to invoke external vision tools to perform computation. However, these methods usually bind each functional requirement to a single predefined vision specialist, implicitly resulting in fixed and rigid tool pipelines. In practice, addressing diverse spatial scenarios and tasks demands a broader diversity in pipeline orchestration and vision specialist selection to achieve robust spatial reasoning. However, such diversity leads to a combinatorial execution space, making it challenging for the agent to orchestrate the optimal pipelines and specialists for different scenarios. In this work, we propose SpatialMem, a memory framework that enables a VLM agent to accumulate tool-use experience and leverage that memory to orchestrate vision specialists to solve the spatial reasoning problem. SpatialMem builds a two-level memory structure, with task memory capturing tool orchestration and scene memory capturing tool selection. It further introduces a dual-state trajectory optimization process to preserve successful tool experiences and refine suboptimal ones. Moreover, existing spatial reasoning benchmarks suffer from quality issues and limited coverage of scene types and tasks. To address these gap, we propose MetricBench, a benchmark covering both indoor and outdoor scenes and three quantitative spatial reasoning tasks. Our method achieves state-of-the-art results on MetricBench, Q-Spatial, and SpatilRGPT-Bench, outperforming best VLM baselines by 32% on MetricBench. Additionally, the memory design yields a 9.1% absolute gain over a memory-free agent on MetricBench.
Figures & tables
| Algorithms | Setting | MetricBench-Indoor | MetricBench-Outdoor | ||||||
|---|---|---|---|---|---|---|---|---|---|
| OO Dist. | OC Dist. | Obj. Size | Average | OO Dist. | OC Dist. | Obj. Size | Average | ||
| Proprietary Models | |||||||||
| GLM-4.6V | - | 40.8 | 34.7 | 24.5 | 33.3 | 20.9 | 28.6 | 55.2 | 34.9 |
| GPT-5.4 | - | 17.1 | 30.6 | 27.4 | 25.0 | 20.9 | 31.4 | 67.6 | 39.9 |
| Gemini-3.1-Pro-Preview | - | 37.3 | 28.6 | 24.4 | 30.1 | 16.0 | 38.2 | 66.7 | 40.3 |
| General Open-Source Models | |||||||||
| Algorithms | Setting | SpatialRGPT-Quantitative | QSpatial-ScanNet | QSpatial++ | MMSI-Bench | |||||
|---|---|---|---|---|---|---|---|---|---|---|
| Width | Height | Dist. | Hor. Dist. | Ver. Dist. | OO Dist. | Obj. Size | OO Dis. | Meas. | ||
| Proprietary Models | ||||||||||
| GLM-4.6V | - | 43.6 | 58.6 | 23.0 | 23.0 | 18.9 | 32.8 | 60.0 | 34.7 | 37.5 |
| GPT-5.4 | - | 57.9 | 66.9 | 10.1 | 14.8 | 7.5 | 36.8 | 60.0 | 27.7 | 51.6 |
| Gemini-3.1-Pro-Preview | - | 55.0 | 61.7 | 18.2 | 18.9 | 5.9 | 41.2 | 66.7 | 38.8 | 40.6 |
| General Open-Source Models | ||||||||||
| Algorithms | MetricBench-Indoor | MetricBench-Outdoor | ||||||
|---|---|---|---|---|---|---|---|---|
| OO Dist. | OC Dist. | Object Size | Average | OO Dist. | OC Dist. | Object Size | Average | |
| w/o Memory | 36.8 | 79.3 | 31.1 | 49.0 | 52.7 | 74.2 | 80.0 | 68.9 |
| w/o Domain-specific Structure | 39.4 | 80.1 | 35.8 | 51.7 | 42.7 | 74.2 | 76.1 | 64.3 |
| w/o Scene-Level Memory | 55.2 | 81.8 | 37.7 | 58.2 | 57.2 | 77.8 | 81.9 | 72.3 |
| w/o Task-Level Memory | 38.1 | 80.1 | 36.7 | 51.6 | 42.7 | 75.7 | 78.1 | 65.5 |
| w/o Trajectory Optimization | 33.3 | 81.8 | 32.0 | 49.0 | 50.0 | 75.7 | 78.1 | 67.9 |
| Algorithms | CV-Bench-Depth | CV-Bench-Distance | ||
|---|---|---|---|---|
| Indoor | Outdoor | Indoor | Outdoor | |
| General Open-Source Models | ||||
| Qwen3VL-8B | 97.2 | 92.0 | 97.2 | 76.8 |
| Qwen3VL-30B-A3B | 98.0 | 90.0 | 95.7 | 72.2 |
| InternVL3.5-8B | 93.2 | 84.0 | 90.2 | 71.5 |
| Spatial VLMs | ||||
Appendix figures & tables9 assets
Supplementary material from the paper’s appendix.
Appendix
| Dataset | Quantitative spatial questions | Indoor | Outdoor | Object-Object Distance | Object-Camera Distance | Object Size |
|---|---|---|---|---|---|---|
| Spatial VQA Chen et al. (2024a) | 215 | ✓ | ✓ | ✓ | ✓ | |
| SpatialRGPT-Bench Cheng et al. (2024) | 749 | ✓ | ✓ | ✓ | ✓ | |
| MSMU-Bench Chen et al. (2026) | 299 | ✓ | ✓ | ✓ | ||
| Q-Spatial Liao et al. (2024) | 271 | ✓ | ✓ | ✓ | ✓ | |
| MetricBench | 658 | ✓ | ✓ | ✓ | ✓ | ✓ |
| Setting | Latency (s) | Avg. Tool Calls | Failure Rate | Memory Size | Evolved Traj. | Cost (h) |
|---|---|---|---|---|---|---|
| Indoor OC | 26.9 | 4.70 | 5.98% | 18 | 10 | 0.8 |
| Indoor OO | 32.9 | 8.20 | 1.28% | 16 | 13 | 0.7 |
| Indoor OS | 25.6 | 5.26 | 0.18% | 31 | 18 | 0.7 |
| Outdoor OC | 27.8 | 5.62 | 1.14% | 23 | 13 | 1.1 |
| Outdoor OO | 37.1 | 8.62 | 2.63% | 21 | 14 | 0.9 |
| Outdoor OS | 4.8 | 1.00 | 0.94% | 7 | 5 | 0.2 |
| Algorithms | Bench-Indoor | Bench-Outdoor | ||||||
|---|---|---|---|---|---|---|---|---|
| OO Dist. | OC Dist. | Object Size | Average | OO Dist. | OC Dist. | Object Size | Average | |
| w/o Memory | 36.8 | 79.3 | 31.1 | 49.0 | 52.7 | 74.2 | 80.0 | 68.9 |
| w/o Scene-Level Memory | 46.0 | 80.1 | 20.0 | 48.7 | 52.7 | 72.8 | 69.5 | 65.0 |
| w/o Task-Level Memory | 46.0 | 79.3 | 33.0 | 52.7 | 56.3 | 78.5 | 67.6 | 67.4 |
| w/o Trajectory Optimization | 43.4 | 77.6 | 37.7 | 52.9 | 58.1 | 76.4 | 79.0 | 66.4 |
| SpatialMem (online) | 53.9 | 85.9 | 37.7 | 59.1 | 53.3 | 77.1 | 81.9 | 70.7 |
| Model | Indoor | Outdoor | ||||||
|---|---|---|---|---|---|---|---|---|
| OO | OC | OS | Avg. | OO | OC | OS | Avg. | |
| Random Trajectory | 34.2 | 77.6 | 29.2 | 47.0 | 49.0 | 70.7 | 78.1 | 65.9 |
| Majority Tool Pipeline | 47.3 | 82.6 | 33.0 | 54.3 | 51.8 | 75.0 | 77.1 | 67.9 |
| Per-task Oracle Pipeline | 60.5 | 91.7 | 49.0 | 67.0 | 63.6 | 82.1 | 89.5 | 78.4 |
| SpatialMem (Offline) | 57.8 | 89.2 | 38.6 | 61.8 | 62.7 | 79.2 | 84.7 | 75.5 |
| Algorithms | MetricBench-Indoor | MetricBench-Outdoor | ||||||
|---|---|---|---|---|---|---|---|---|
| OO Dist. | OC Dist. | Object Size | Average | OO Dist. | OC Dist. | Object Size | Average | |
| w/o Memory | 36.8 | 79.3 | 31.1 | 49.0 | 52.7 | 74.2 | 80.0 | 68.9 |
| w/o Domain-specific Structure | 39.4 | 80.1 | 35.8 | 51.7 | 42.7 | 75.7 | 78.1 | 65.5 |
| w Domain-specific Structure + ReMe | 44.7 | 80.9 | 34.9 | 53.5 | 55.4 | 74.2 | 79.1 | 69.5 |
| w Domain-specific Structure + ReasoningBank | 46.0 | 77.6 | 35.8 | 53.1 | 56.3 | 75.7 | 77.1 | 69.7 |
| SpatialMem | 57.8 | 89.2 | 38.6 | 61.8 | 62.7 | 79.2 | 84.7 | 75.5 |
Spatial Reasoning
Spatial reasoning studies how systems represent geometry, relations, viewpoints, and motion to understand scenes, plan actions, and solve spatial tasks.
See all 174 papers