Source-linked AI summary

SpatialOPSD: Self-Distilling Spatial Intelligence from Verified Coding Agent Traces

Rongxue Li, Meng Yang, Yiru Mao, Yongliang Tao, Lulu Hu, Bin Yang, Zhao Xu, Weihua Luo, Bowen Xu

arXiv:2610.11366v1cs.LG

TL;DR

Spatial MLLMs face difficult-to-verify geometric reasoning, while tool-based spatial agents add inference-time overhead. SpatialOPSD distills verified agent traces as privileged information, and reports stronger benchmark performance than SFT and RL baselines while approaching tool-using agents without inference-time tools.

  • Problem

    Spatial MLLMs must infer latent 3D properties from 2D observations, while intermediate geometric steps are difficult to annotate or validate and tool-based agents add inference-time overhead.

    Source: §1 · pp. 1–2
  • Method

    SpatialOPSD uses verified spatial-agent traces as privileged information for on-policy self-distillation, with Repetition-Aware Distillation to reduce privileged-information leakage.

    Source: §1 · p. 2, §2 · p. 2
  • Results

    51.9 accuracy for SpatialOPSD versus 48.2 for GRPO; across MindCube and ViewSpatial it outperforms SFT and RL baselines, approaches tool-using agents, and largely preserves OOD performance.

    Source: §1 · p. 2, §4.3 · p. 6, §7 · p. 10
  • Takeaways & Limitations

    Using data generated by the same MLLM forms a self-distillation loop and offers a practical route from tool-assisted data generation to stronger standalone spatial reasoning.

    Source: §7 · pp. 9–10

    OPSD risks self-reinforcing repetition and privileged-context copying, which can encourage reproducing details unavailable at inference rather than task-relevant reasoning.

    Source: §2 · p. 2

Abstract

from arXiv · show

Spatial coding agents significantly improve spatial reasoning in Multimodal Large Language Models (MLLMs) by using external tools to generate verified execution traces. However, this paradigm inherently suffers from prohibitive inference-time overhead and external dependencies. In this paper, we explore whether an MLLM can internalize this agentic capability to operate entirely tool-free. We begin with a simple observation: prompting an MLLM with summarized execution traces of a spatial coding agent naturally unlocks the model's internal spatial Chain-of-Thought (CoT). Motivated by this, we introduce SpatialOPSD, an on-policy self-distillation framework that internalizes spatial reasoning into a standalone MLLM by formulating verified agent traces as privileged information. To mitigate privileged-information leakage during distillation, we introduce Repetition-Aware Distillation, which combines repetition masking with unlikelihood regularization. Experiments across multiple benchmarks demonstrate that self-distilling SpatialOPSD achieves higher average accuracy than SFT and GRPO on both spatial and OOD datasets, exhibiting superior performance and generalization.

1 Introduction

Spatial reasoning requires inferring latent 3D properties from 2D observations, but its intermediate steps are hard to verify. SpatialOPSD distills verified spatial-agent traces into tool-free reasoning and reports gains over standard baselines.

1 Introduction

  • Spatial reasoning requires inferring latent 3D properties from 2D observations, but intermediate geometric inferences are difficult to annotate or validate automatically.Source: §1 · p. 1
  • Spatial coding agents address the verifiability bottleneck with code execution and geometry tools, but iterative decoding and execution add latency and infrastructure overhead.Source: §1 · p. 1
  • SpatialOPSD uses verified agent traces as privileged information for on-policy self-distillation, while Repetition-Aware Distillation reduces leakage from privileged content.The approach is motivated by agent traces eliciting higher-quality spatial chain-of-thought reasoning.Source: §1 · p. 2
  • On MindCube-Tiny, Figure 1 reports that agent-derived OPSD boosts spatial reasoning; across MindCube and ViewSpatial, SpatialOPSD surpasses SFT and RL baselines and approaches tool-using agents without inference-time tools.The paper also reports largely preserved out-of-distribution performance and gains across evaluated model sizes.Source: Figure 1 · p. 2, §1 · p. 2

2 Preliminary

The section describes spatial coding-agent traces, on-policy self-distillation, and chain-of-thought prediction. It notes that OPSD provides dense supervision but can reinforce repetition and privileged-context copying, while text CoT has mixed effects on spatial reasoning.

Spatial Coding Agent

  • A spatial coding agent uses a persistent Python kernel with perception modules and scientific libraries, iteratively producing reasoning, executable code, execution outputs, and a final answer.Source: §2 · p. 2

On-Policy Self-Distillation

  • OPSD conditions a frozen copy of the initial model on privileged information and trains the student on its own trajectories, providing dense supervision but risking repetition and privileged-context copying.The training loss averages over on-policy student rollouts.Source: §2 · p. 2

Chain-of-Thought

  • Text-based CoT factorizes prediction into a rationale and answer, but its spatial effects are mixed across models and tasks; generating a rationale alone does not ensure effective spatial reasoning.Source: §2 · p. 3

3 Spatial Reasoning via OPSD

Agent-trace-conditioned reasoning matches the spatial reasoning capability of a full coding agent, motivating SpatialOPSD’s use of verified traces as privileged training information for a raw-input student. Repetition-Aware Distillation addresses copying of repeated rollout content and privileged information.

3.1 Motivation

  • SpatialOPSD distills a trace-conditioned teacher into a student that sees only the raw input, aiming to internalize geometric reasoning rather than trace-specific artifacts.Verified agent traces are summarized as privileged information for on-policy self-distillation.Source: §3.1 · p. 3, §3.2 · p. 3
  • Agent-trace-conditioned CoT matches the spatial reasoning capability of the full coding agent, with 3D-perception references rising 1.8× and counterfactual-motion references 1.6×.Figure 2 compares prompting strategies and spatial concept frequency.Source: Figure 2 · p. 3, §3.1 · p. 3

3.2 SpatialOPSD

  • The agent corpus retains traces only when their final predictions pass deterministic verification, yielding verified reasoning traces without human annotation.The agent uses a persistent Python kernel equipped with geometric primitives.Source: §3.2 · pp. 3–4
  • Among the four privileged-information variants, SUMMARY performs best with a moderate teacher–student entropy gap.The variants include full traces, summaries, extracted facts, and inferred intent.Source: §3.2 · p. 4
  • For flagged tokens, the method masks standard distillation supervision and applies an unlikelihood penalty; masked distillation otherwise averages over unmasked tokens.Rollout sampling and teacher stop-gradient remain unchanged, and the two terms respectively preserve other supervision and discourage flagged continuations.Source: §3.2 · pp. 4–5
  • Repetition-aware detection flags rollout n-grams that occur in privileged information but not the input, or that appeared earlier in the rollout, filtering short overlaps.The mask marks contiguous flagged spans of at least Lmin tokens.Source: §3.2 · p. 4

4 Experiments

The experiments compare SpatialOPSD with tuning and tool-based baselines, evaluate held-out spatial and general multimodal benchmarks, and examine training dynamics and design choices. SpatialOPSD improves on the Qwen3.5-9B baseline and shows strong OOD performance, while ablations assess leakage, scale, trace types, verification, and coding-agent choice.

4.1 Training Data Construction and Baseline Setup

  • Training uses 5,008 ground-truth-verified MindCube instances for SpatialOPSD and GRPO, while evaluation covers MindCube and ViewSpatial spatial reasoning benchmarks.SFT uses 4,459 instances with correct tool-free rationales; all three methods share the student-visible input format and evaluation protocol.Source: §4.1 · pp. 5–6, §4.2 · p. 6

4.3 Main Results

  • 51.9 vs. 45.9: SpatialOPSD improves Qwen3.5-9B on spatial benchmarks, exceeds SFT (47.6) and GRPO (48.2), and reaches 91% of SpatialClaw’s 57.3 in one tool-free pass.It also surpasses GPT-5 and narrows the gap to Gemini-3-Pro.Source: §4.3 · p. 6, Table 1 · p. 6

4.4 Training Dynamics

  • SpatialOPSD shows a smaller teacher–student entropy gap, greater top-100 token overlap, faster and more stable loss convergence, and more spatial-reasoning terms than vanilla OPSD.The compared methods use Qwen3.5-9B as the backbone.Source: §4.4 · pp. 6–7, Figure 5 · p. 6

4.5 Out-of-domain Evaluation

  • 64.7% average accuracy across four held-out benchmarks exceeds SFT and GRPO and slightly surpasses the CoT baseline (64.4%), with competitive MMStar and Video-MME performance.The benchmarks are BLINK and OmniSpatial for spatial reasoning, plus MMStar and Video-MME for general multimodal capabilities.Source: §4.5 · p. 7, Table 2 · p. 7

4.6 Ablations

  • Mask alone yields the highest average accuracy, UL alone reduces leakage more, and combining them substantially reduces leakage versus vanilla OPSD while trading accuracy against Mask alone.The ablation reports both accuracy and privileged-information leakage.Source: §4.6 · p. 7, Table 3 · p. 7
  • A moderate repetition penalty suppresses leakage while improving accuracy; SpatialOPSD also raises average accuracy at 2B, 4B, and 27B student scales.The selected settings are λrep = 0.10 and Lmin = 32; average accuracy rises from 40.6% to 42.8% at 2B, 46.4% to 50.2% at 4B, and 50.6% to 54.2% at 27B.Source: §4.6 · p. 7, Table 4 · p. 7, Table 5 · p. 8
  • SUMMARY performs best among the privileged-information variants and maintains a moderate entropy gap; INTENT has a smaller gap but high entropy, while FULL-TRACE and FACT show optimization-disrupting gaps.FULL-TRACE induces a large gap, and FACT’s gap grows in later training.Source: §4.6 · pp. 7–8, Table 6 · p. 8, Figure 6 · p. 8
  • Verified traces improve performance over using all 10,000 traces despite retaining 5,008, and both SpatialClaw and pySpatial traces improve the base model, with pySpatial comparable or slightly better.The verified subset improves MindCube-Tiny by 4.9 points and ViewSpatial by 0.5 points.Source: §4.6 · p. 8, Table 7 · p. 8

5 Analysis

The analysis examines how training changes generated reasoning and contrasts SpatialOPSD’s behavior with other approaches. It reports more structured trace markers, while qualitative examples show viewpoint-aware reasoning grounded in visible cues rather than unavailable tool traces.

Scalability across coding agents

  • Table 8 compares SpatialOPSD performance when trained on traces from different coding agents.Source: Table 8 · p. 8

Quantitative Analysis

  • On 1,040 MindCube-tiny samples, training increases all eight target categories; Step Numbering gains the most coverage (+53.0 points), followed by Verification (+43.9) and Scene Context (+33.8).These metrics capture articulation style, not intrinsic reasoning ability.Source: §5 · p. 8

Qualitative Analysis

  • SpatialOPSD disentangles multi-axis trajectories and grounds inference in visible depth and relative positions, unlike GRPO’s 1D-motion conflation and vanilla OPSD’s hallucinated tool traces.The figures contrast the model’s grounded spatial reasoning with shortcut learning from unavailable tool traces.Source: §5 · p. 9, Figure 7 · p. 9, Figure 8 · p. 9

6 Related Work

Prior spatial MLLM approaches use QA fine-tuning, RL-optimized CoT, or tool augmentation, each with stated limitations. SpatialOPSD draws on agent traces through self-distillation while addressing privileged-information leakage by penalizing copied trace-exclusive content.

Spatial Intelligence in Multimodal LLMs

  • QA-pair SFT can generalize poorly and leave reasoning implicit; RL-CoT faces costly cold-start trajectory curation, while tool augmentation brings inference overhead and cascading errors.Source: §6 · p. 9

On-Policy Self-Distillation

  • OPSD uses a teacher conditioned on privileged information; SpatialOPSD leaves that privilege intact and penalizes student tokens that reproduce trace-exclusive content.Prior leakage mitigations instead alter teacher supervision to make privilege input-recoverable, temporally localized, or analytically isolated.Source: §6 · p. 9

7 Conclusion

SpatialOPSD distills verified spatial coding-agent traces as privileged information for on-policy self-distillation, with Repetition-Aware Distillation discouraging copying and self-repetition. On MindCube and ViewSpatial, it outperforms SFT and RL baselines and approaches tool-using agents without inference-time tools.

7 Conclusion

  • SpatialOPSD distills verified spatial coding-agent traces as privileged information for on-policy self-distillation.Repetition-Aware Distillation penalizes copying privileged content and self-repetition to separate spatial reasoning from tool-specific artifacts.Source: §7 · p. 9
  • On MindCube and ViewSpatial, SpatialOPSD outperforms SFT and RL baselines and approaches tool-using agents without inference-time tools.The method uses training data generated by the same MLLM, forming a self-distillation loop toward standalone spatial reasoning.Source: §7 · p. 10
  • The self-distillation loop offers a practical route from tool-assisted data generation to stronger standalone spatial reasoning.The training data is generated by the same MLLM that is trained.Source: §7 · p. 10

A.1 Construction Details of Privileged Information

Privileged information is constructed from successful SpatialClaw rollouts on MindCube, then transformed into four variants and packed into OPSD records with shared student prompts and variant-specific teacher prompts.

A.1 Construction Details of Privileged Information

  • The pipeline retains the 5,008 SpatialClaw-correct sessions from 10,000 MindCube training questions, matching every privileged variant sample-for-sample.The agent answered 5,008 questions correctly (50.08%), versus 4,384 (43.84%) for the tool-free CoT baseline.Source: §A.1 · p. 14
  • Each retained session is parsed into a raw context containing the question, frames, execution plan, tool steps and outputs, viewed visualizations, and final answer with ground truth.The byte-identical agent system prompt is removed because it carries no instance-specific signal.Source: §A.1 · p. 14
  • Summary, Fact, and Intent are produced by prompting Qwen3.5-9B once per sample and applying deterministic post-processing, while Full-trace is assembled without an LLM.Residual answer declarations are scrubbed from Summary, Fact, and Intent; Fact appends the answer section back after annotation.Source: §A.1 · p. 14
  • Summary and Fact tokenize cited file paths into indexed image handles and privileged-image lists, while Intent removes cited-frame paths and agent-visualization references.A re-cited original frame may appear both at full resolution and as a 400 px thumbnail.Source: §A.1 · p. 14
  • All variants use the same student prompt, while each teacher prompt adds a variant-specific privileged block and any retained privileged images.Records are packed with a shared student prompt and variant-specific teacher prompt.Source: §A.1 · pp. 14–15
  • Records resize original frames to a 2048 px maximum long edge and are checked for matching image-token counts, a question-core prefix, and a non-empty ground-truth label.The resolution matches the training and evaluation protocol.Source: §A.1 · p. 15

A.1.1 Version of Full-trace

Full-trace preserves nearly all content from a correct SpatialClaw session as privileged information, providing the upper bound on retained trace content. Its example uses reconstructed camera poses, displacement components, and a bird’s-eye trajectory to reason about camera movement.

A.1.1 Version of Full-trace

  • Full-trace deletes only the agent system-prompt span and keeps the remaining context verbatim, including failed steps, visualizations, code, tool mechanics, and the ground-truth label.It is the upper bound on privileged content and does not query Qwen3.5-9B.Source: §A.1.1 · p. 16
  • In the example, the agent reconstructs 3D geometry to obtain camera poses, computes their displacement, and cross-checks its direction with a BEV trajectory.The trace describes movement using X for left/right and Z for forward/backward.Source: §A.1.1 · pp. 17–18
  • The example’s displacement vector, [-0.3765759, 0.09207925, -0.42755793], indicates forward-left movement, which the agent submits as its answer.The trace interprets negative X as left and negative Z as forward.Source: §A.1.1 · pp. 18–19

A.1.2 Version of Summary

This section describes the Summary variant’s protocol for distilling tool-agent traces into compact privileged hints for a tool-free student while withholding the answer. It specifies independent image-based verification, step-by-step reasoning, and preservation of decisive evidence and exact metric readouts without naming an option letter.

A.1.2 Version of Summary

  • The annotator keeps only the final effective path, omitting failed, abandoned, superseded, and exploratory steps unless a failure itself is decisive.Present the resulting evidence as a clean reasoning chain rather than narrating detours.Source: §A.1.2 · pp. 19–20
  • Every visual claim must cite the exact image path that supports it, including agent-generated derived visualizations and relevant original frames.Derived visualizations are privileged evidence the student cannot reproduce.Source: §A.1.2 · pp. 19–21
  • Hints must describe distinguishing evidence without stating the answer, naming a winning candidate, or pairing a candidate with “match,” “correct,” or “answer.”The student must still make the final comparison or decision.Source: §A.1.2 · pp. 19, 22
  • Tool-returned values must be quoted verbatim with units and referents, because the tool-free student cannot recompute them.Keep concrete measurements and comparisons rather than paraphrasing them vaguely.Source: §A.1.2 · p. 21
  • When an agent’s final answer is wrong, the annotator reconstructs a ground-truth-consistent path from valid tool observations and drops erroneous conclusions or contradictory evidence.The agent’s choice and reasoning specific to it are treated as noise.Source: §A.1.2 · pp. 21–22
  • The prompt tells the model to understand the trace’s measured facts, verify them against the original images, and derive an answer independently without copying or citing the trace.It encourages step-by-step reasoning, exploring interpretations, backtracking, and re-examining images.Source: §A.1.2 · p. 23
  • The teacher prompt asks for step-by-step reasoning and a final option letter in boxed form; its privileged body preserves metric readouts verbatim but names no option letter.Source: §A.1.2 · p. 23

A.1.3 Version of Fact

The Fact variant turns verified agent traces into privileged descriptions of tool-measured perceptual evidence, separating image-recoverable facts from answer-side inferences. Its rules retain trace-grounded measurements while excluding conclusions that would disclose the answer.

A.1.3 Version of Fact

  • The Fact variant keeps perceptual evidence whose source is fully contained in the input frames and excludes answer-side content that would train shortcut imitation.A perfect observer should be able to re-derive each retained cue from the images and question alone.Source: §A.1.3 · pp. 23–24
  • The annotator must provide the smallest complete set of visual facts, anchored to exact image paths and preserving numbers, units, and axis conventions verbatim.The output is one declarative measurement or observation per bullet, not an inference resolving the question.Source: §A.1.3 · pp. 24–26
  • It retains raw pose values and axis conventions, within-frame observations, and descriptions of visualizations, while dropping their verbalization into camera-direction conclusions.Cited visualizations and original frames must be identified by their exact paths.Source: §A.1.3 · pp. 24–25
  • The rules drop cross-frame matching verdicts, temporal-order conclusions, the agent’s reasoning chain, and failed or superseded tool attempts.Per-frame facts can remain, but not a verdict pairing a candidate with correctness or an ordering that answers the question.Source: §A.1.3 · p. 25
  • For a wrong-answer trace, the ground-truth answer defines the reliable target, and measurements inconsistent with it are excluded.The recoverable-privilege, no-leakage, neutrality, verbatim-value, and path-fidelity rules still apply.Source: §A.1.3 · p. 25

A.1.4 Version of Intent

The Intent variant converts the reason for each effective tool call into a transferable, tool-free visual-reasoning instruction. It tells the reader what to inspect and how to use observations without supplying measurements or the answer.

A.1.4 Version of Intent

  • The Intent variant rewrites each effective tool call’s purpose as a visual instruction, transferring a skill rather than a worked solution.Its privilege channel is procedural: the teacher receives the same frames as the student, without tool names, values, paths, or an answer.Source: §A.1.4 · pp. 27, 30
  • Instructions say what to look at, compare, or infer and why, while omitting tools, mechanics, returned values, and tool artifacts.Generic visual-reasoning principles may be included when they underpin a step.Source: §A.1.4 · p. 28
  • The strategy distills only the effective path, dropping abandoned attempts and correcting wrong-answer traces using the ground truth to retain evidence-gathering intents consistent with it.When an oversight or misreading caused an error, the strategy may add a caution step without revealing the correct conclusion.Source: §A.1.4 · p. 28
  • The strategy makes the answer derivable but never states the answer, the requested relation, or which candidate is correct.Input frames are referred to as “image 1” through “image N,” not by file path.Source: §A.1.4 · pp. 28–29
  • The output gives one intent per step in execution order, followed by a decision criterion that describes distinguishing evidence without naming the winning candidate.The prompt calls for the smallest complete transfer of the approach, typically 3–8 steps.Source: §A.1.4 · p. 29
  • For camera movement, the example separates depth cues from lateral parallax and combines them to distinguish diagonal movement from purely lateral movement.It uses apparent size and depth changes for the forward/backward component, and scene shift and visible object faces for the left/right component.Source: §A.1.4 · p. 30

A.2 Training data construction and baseline setup

This appendix describes the training data and baselines, defines a keyword-based surface-form leakage measure, and reports lexical changes in reasoning rollouts after spatial-reasoning training. The lexical measures describe output articulation and are not causal evidence of improved reasoning.

A.2 Training data construction and baseline setup

  • The agent answers 5,008 of 10,000 MindCube training questions correctly, forming the shared verified set for SpatialOPSD and GRPO; SFT instead uses 4,459 retained instances and is not sample-matched.Methods receive byte-identical student inputs and are evaluated under identical decoding settings.Source: §A.2 · p. 31
  • The baselines differ in training setup: SFT uses supervised cross-entropy, GRPO samples groups of eight responses with correctness rewards, and SpatialOPSD uses one response per question with a frozen privileged-context teacher and repetition control.SpatialOPSD needs no reward, advantage, or value model; its objective uses reverse KL and a repetition-control term.Source: §A.2 · pp. 31–32

A.3 Privileged Information Leakage Measurement

  • Privileged-information leakage is measured by a deliberately loose lexical rule that flags a response containing a standalone occurrence of “agent,” “trace,” or “tool,” without inferring semantic intent.Ordinary uses of those words can count as matches.Source: §A.3 · p. 32, §A.3.1 · p. 32

A.3.1 Keyword Matching Rule

  • The case-insensitive keyword matcher allows plural and possessive forms, excludes matches embedded in longer alphanumeric words, and counts hyphen-adjacent target forms.Its optional suffixes recognize singular, plural, and possessive forms such as “agents” and “tool’s.”Source: §A.3.1 · p. 32

A.3.2 Sample-Level Leakage Indicator

  • Each response contributes a binary leakage outcome: one if any target keyword matches, otherwise zero, regardless of the number of matches.Per-keyword occurrence counts can be retained separately for diagnostics.Source: §A.3.2 · pp. 32–33

A.3.3 Dataset-Level Leakage Rate

  • The dataset leakage rate is the number of evaluated responses with at least one qualifying match divided by the total number of evaluated samples.Multiple matches within one response contribute only one leaked sample.Source: §A.3.3 · p. 33

A.3.4 Reference Implementation

  • The reference implementation compiles the three keyword patterns, counts matches by keyword, flags whether each response has any match, and averages those flags.The resulting sample-level average is the dataset leakage rate.Source: §A.3.4 · p. 33

A.4 What does SpatialOPSD learn?

  • All eight reasoning-marker categories increase after training; Step Numbering has the largest coverage gain (+53.0 percentage points), followed by Verification and Conclusion (+43.9 points) and Scene Context Analysis (+33.8 points).Camera Movement Tracking frequency rises from 3.518 to 5.611 occurrences per 1,000 words, while Step Numbering rises from 0.138 to 1.376; these are descriptive lexical indicators, not causal evidence of improved reasoning.Source: §A.4 · p. 34, Figure 9 · p. 34, Figure 10 · p. 35
Loading 2610.11366v1…