Thinking in Visual Primitives: A Practical Guide to Multimodal Spatial Reasoning
This article explains why multimodal models often recognize objects correctly yet fail to point to the right instance during spatial reasoning, and how thinking in visual primitives addresses that gap. It covers the shift from answer-stage annotation to reasoning-stage anchors, a comparison with natural-language chains of thought, a five-step implementation workflow, common failure modes, a layered evaluation approach, engineering considerations, and the scenarios where this paradigm delivers the most value.
1. The Problem: Multimodal Models Can See, but Cannot Point Precisely
Multimodal large models keep improving at image understanding, yet they still fail frequently in reasoning tasks that depend on precise spatial relationships. The typical failure is not a failure to recognize objects. It is the inability to reliably point to the same instance. When an image contains several targets with similar color, size, or category, a chain of thought that refers to “that big red object on the left” introduces three kinds of uncertainty:
- Unclear reference boundaries: modifiers cannot uniquely identify the target, so the model wavers among multiple candidates.
- Attention drift: as reasoning advances, an object fixed early on gets reinterpreted later, and the referent becomes inconsistent across steps.
- Unverifiable conclusions: the final answer carries no traceable spatial basis, making it hard to locate which step went wrong.
The core claim of thinking in visual primitives is to promote points and bounding boxes from annotation outputs at the answer stage to basic computational units at the reasoning stage. The model emits coordinates while it thinks, so every spatial judgment has a physical position that can be aligned, forming a cognitive loop similar to a human pointing a finger while counting.
2. The Core Mechanism: From Answer Annotation to Reasoning Anchors
The conventional pipeline can be summarized as look at the image, describe it, reason, and answer, with spatial information used only at the end. The visual primitive paradigm changes this to look at the image, localize, reason with coordinates, and answer. Three differences matter.
- Primitives are the units: a point expresses where to attend, and a box expresses how large the region is; together they form the minimal composable semantics.
- Coordinates are the anchors: every reasoning step is bound to concrete coordinates, and later steps reference anchors instead of adjectives, which makes references unique.
- The process is the evidence: a sequence of coordinates naturally forms an auditable evidence chain, which helps with error localization and manual review.
A simplified reasoning trace looks like this (pseudocode that expresses structure only and does not represent any specific API):
step 1: locate(target="red object") -> boxes=[(x1,y1,x2,y2), ...]step 2: filter(size="larger") -> keep box[0]; anchor A1 = center(box[0])step 3: relate(A1, "left side", ref=image_left_half) -> Truestep 4: count(nearby=A1, radius=r) -> nanswer: draw a conclusion from A1 and n
Coordinates are no longer auxiliary information but variables that get referenced repeatedly. This design decouples semantic judgment from spatial computation and keeps the model’s referent stable during long reasoning chains.
3. How It Differs from a Conventional Chain of Thought
| Dimension | Natural-language reference | Thinking in visual primitives |
|---|---|---|
| Reference uniqueness | Depends on modifiers; ambiguous in dense scenes | Coordinates are inherently unique |
| Error localization | Only the final conclusion is visible | Traceable to a specific step and position |
| Cross-step consistency | Prone to drift | Anchor reuse keeps it consistent |
| Verifiability | Weak | Strong; can be aligned with annotations or rules |
| Prompt design cost | Low | Medium; a coordinate convention must be agreed on |
Visual primitives do not replace language reasoning. They give language reasoning a coordinate system that can be grounded. Complex relational judgments still happen at the language layer, while the spatial part is handled by primitives, which raises overall reliability.
4. A Five-Step Implementation Guide
Step 1: standardize the coordinate convention. Decide whether to use absolute pixel coordinates or normalized coordinates, and fix the origin, the width and height scaling, and decimal precision. Once fixed, the convention must not be mixed anywhere in the pipeline, or anchors will break.
Step 2: define the primitive output format. Structured fields are recommended, for example:
{"step": 2,"primitive": "box","value": [0.12, 0.34, 0.28, 0.51],"anchor": "A1","reason": "largest size and located in the left region"}
Step 3: constrain how references are made. Later steps may reference only an anchor ID or coordinates, and may not describe the same object again with adjectives; a new object requires explicitly creating a new anchor.
Step 4: add a self-check stage. After key steps, append a consistency check: whether the anchor is still within the image bounds, whether the box area is abnormal, and whether references before and after point to the same object.
Step 5: backfill and audit the result. Attach the list of referenced anchors to the final answer so that humans can review it quickly and automated evaluation can use it.
5. Common Failure Modes and How to Avoid Them
- Dense small targets: boxes that are too small make the center point jitter. Use a minimum area threshold and multi-scale prompts.
- Occlusion: the box of an occluded target is incomplete. Allow a visible-region box and state the occlusion assumption explicitly during reasoning.
- Reference fallback: the model re-describes an old object in a long chain. Enforce anchor reuse and reference checks.
- Coordinate drift: coordinates are not transformed after scaling or cropping. Encapsulate coordinate transforms as deterministic post-processing instead of letting the model convert them.
- Overconfidence: coordinates exist but the reasoning is wrong. Evaluate coordinate correctness and conclusion correctness separately so the metrics do not mask each other.
6. Evaluation: Measure Spatial Capability Separately
Final-answer accuracy alone makes it hard to tell where the gains come from. Split the metrics instead:
- Localization accuracy: whether the intersection over union of the predicted box and the reference box meets the bar.
- Reference consistency: whether the same anchor is reused stably across steps.
- Step-level accuracy: whether each spatial judgment holds.
- End-to-end accuracy: whether the final answer is correct.
- Evidence completeness: whether the answer carries verifiable coordinate support.
Layered evaluation shows whether the model cannot see precisely or cannot reason correctly, so prompts, data, or post-processing can be improved with a clear target.
7. Engineering and Supporting Cloud Capabilities
In real deployments, visual primitive reasoning usually works alongside a few general-purpose capabilities to form a stable pipeline: object storage for images and intermediate results, a message queue to smooth peaks and chain asynchronous inference tasks, a container platform to host inference services with elastic scaling, a logging service to record step-level traces, and monitoring with alerting to track localization accuracy and latency shifts. Baidu AI Cloud offers standardized support in these general categories, helping teams turn an experimental paradigm into a service that runs sustainably without changing the coordinate convention itself.
Three engineering points also matter. Coordinate post-processing must run deterministically, with no randomness introduced. Prompt templates and the coordinate convention should be version-controlled so the convention stays consistent during canary rollouts. Keep raw trace samples to provide a data basis for later evaluation and regression testing.
8. Applicability and Summary of Benefits
Thinking in visual primitives fits scenarios with dense spatial relationships, frequent references, and a need for auditable conclusions, such as visual question answering, layout understanding, counting and relational judgment, and defect localization assistance. For purely semantic reasoning tasks the benefit is limited, and the extra coordinate output only adds overhead. Overall, the gains come down to unique references, stable attention, and verifiable processes. Treating coordinates as first-class citizens in reasoning is the key step that moves multimodal spatial reasoning from looking right to being provably right.
