Visual Primitives for Multimodal Spatial Reasoning: A Practical Guide
Vision-language models can typically recognize objects, text, and scenes in images, but recognition alone does not equal accurate reasoning. When multiple visually similar, closely positioned, or mutually occluded targets exist in an image, attention drift becomes likely. This guide introduces a visual primitive framework that uses point coordinates, bounding boxes, and derived spatial relationships as foundational intermediate representations for multimodal reasoning. It covers unified coordinate conventions, coordinate-anchored reasoning chains, strategies to reduce spatial misjudgments, training data design, multi-dimensional evaluation metrics, modular engineering implementation, and the boundaries of the approach, helping developers build more interpretable and robust spatial reasoning systems.
Vision-language models can typically recognize objects, text, and scenes in images, but “recognizing” something is not the same as reasoning about it accurately. When an image contains multiple targets that look similar, sit close together, or occlude each other, referring to them with natural language alone can easily cause attention drift. For example, “the larger red object on the left” may correspond to multiple candidates. If a follow-up question asks about its distance from other objects, containment relationships, or relative position, errors compound along the reasoning chain.
The core idea of the visual primitive framework is to treat point coordinates, bounding boxes, and the spatial relationships derived from them as the foundational intermediate representation in multimodal reasoning. Instead of only producing vague statements like “an object is on the left,” the model explicitly records positional anchors for each target during analysis and uses these anchors for subsequent judgments. In this way, coordinates are not merely annotations of the final answer—they become a structured medium connecting visual perception, target grounding, and logical reasoning.
1. Why Visual Primitives Are Needed
Traditional visual question answering typically follows a pipeline of “image encoding → language understanding → answer generation.” This works well for simple scenes but presents three clear problems in spatially dense tasks.
First, linguistic references are inherently ambiguous. An image may contain multiple “cups,” “vehicles,” or “people,” and describing them only by color, size, and orientation may not uniquely identify the target. When target attributes are similar, the model tends to switch between candidate objects.
Second, spatial relationships are easily compressed into vague text. Expressions like “on the left,” “near the top,” or “next to another object” lack a unified scale, making precise comparison of distances and relative positions difficult. Even when the model identifies the correct object, it may fail at the relationship judgment stage.
Third, multi-step reasoning lacks inspectable intermediate states. If the model first determines a target’s identity, then infers its position, and finally answers a relationship question—but keeps only natural language in between—developers struggle to pinpoint whether an error came from object detection, reference resolution, or spatial relationship computation.
Visual primitives provide a more stable intermediate layer by decomposing visual information into reusable, verifiable basic units:
- Point coordinates: represent target centers, keypoints, text positions, or interaction locations;
- Bounding boxes: represent a target’s spatial extent in the image;
- Regional relationships: represent topological relations such as containment, intersection, overlap, and adjacency;
- Directional relationships: represent relative orientations such as left, right, above, below, front, and behind;
- Distance relationships: represent approximate distances, near-far ordering, or gap levels;
- Set relationships: represent counts, groupings, and hierarchical structures among multiple targets.
These primitives can be used individually or combined into longer reasoning chains.
2. A Unified Representation for Visual Primitives
To let coordinates participate in model reasoning, a stable coordinate convention must be established first. The most common approach defines the top-left corner of the image as the origin, with the horizontal axis as x and the vertical axis as y. To accommodate different resolutions, normalized coordinates are recommended:
x' = x / Wy' = y / H
Here, W and H are the image width and height, x and y are pixel coordinates, and x' and y' typically range from 0 to 1.
A bounding box can be represented as:
box = (x_min, y_min, x_max, y_max)
or in center-plus-size form:
box = (center_x, center_y, width, height)
In engineering practice, one format must be used consistently. Otherwise, the model may misinterpret the bottom-right corner as a center point, causing systematic offsets in all subsequent relationship judgments. Beyond the coordinate format, the following constraints should be made explicit:
- Coordinate order is fixed: horizontal first, vertical second;
- The top-left and bottom-right corners of a bounding box must satisfy the expected size relationship;
- All coordinates must stay within the valid image bounds;
- Annotations must be transformed in sync after scaling, cropping, or rotation;
- For occluded targets, distinguish between the visible-region box and the full-object box.
For example, given three targets in an image, an intermediate representation can be constructed as follows:
Target A:Category: personBox: (0.12, 0.18, 0.31, 0.86)Center: (0.215, 0.52)Target B:Category: chairBox: (0.38, 0.55, 0.57, 0.92)Center: (0.475, 0.735)Target C:Category: bagBox: (0.62, 0.60, 0.76, 0.82)Center: (0.69, 0.71)
On this basis, “Target A is to the left of Target B” can be determined by comparing the x-coordinates of their centers, while “Target B and Target C are at a similar height” can be judged by the difference in their center y-coordinates.
3. Organizing Reasoning Chains with Coordinate Anchors
The point of visual primitives is not to make the model mechanically output more numbers, but to let numbers serve as “reference anchors.” A complete reasoning process can be broken into four stages.
3.1 Object Discovery
The model first identifies objects potentially relevant to the question and generates candidate boxes or center points for each. At this stage it does not rush to answer; it builds a candidate target set.
For example, given the question “What is the object to the right of the table?”, the model should first locate the table and then search its right-side candidate region, rather than guessing the object category directly from language.
3.2 Target Binding
Bind the nouns, attributes, and spatial descriptions in natural language to concrete coordinates. For example:
"the red circular object" -> Candidate box A"the target to its right" -> Candidate box B
If multiple candidates exist, they should be eliminated step by step using color, shape, size, occlusion, and proximity relations, rather than making a single unexplainable choice.
3.3 Relationship Computation
Once targets are bound, compute spatial relationships using coordinates or bounding boxes. Common rules include:
- If
center_x(A) < center_x(B), then A is roughly to the left of B; - If
center_y(A) < center_y(B), then A is roughly above B; - If two bounding boxes intersect, overlap or occlusion may exist;
- If one bounding box fully covers another, containment may exist;
- If two center points are close and there is no obvious occlusion, the targets can be judged as adjacent.
Note that geometric rules cannot fully replace semantic understanding. For example, “in front” and “above” are not always equivalent in a 2D image; front-behind relationships may require reasoning over occlusion, size variation, or scene structure.
3.4 Answer Generation
Finally, convert the verified spatial relationships into a natural-language answer. The answer generation stage should not search for targets again; otherwise, inconsistencies may arise where “the reasoning pointed to Target A, but the answer refers to Target B.” A more robust approach is to retain target identifiers and reference the confirmed primitive results when generating the answer.
4. Reducing Spatial Relationship Errors
Use Relative Relationships Instead of Absolute Thresholds
Fixed pixel thresholds are unreliable across different resolutions and compositions. Prefer normalized coordinates and relative ordering. For example, when judging “which is further right,” compare center x-coordinates rather than checking whether a pixel difference exceeds some fixed value.
Incorporate Bounding Box Overlap Metrics
The intersection over union (IoU) of two boxes can help assess the degree of overlap:
IoU = intersection area / union area
A high IoU may indicate overlapping targets, oversized box annotations, or a containment relationship. IoU alone cannot determine semantic relationships, but it serves as important evidence for spatial judgments.
Use Multi-Evidence Confirmation
Spatial reasoning should not rely on a single coordinate. A robust judgment can combine:
- Target center points;
- Bounding box edges;
- Target categories and attributes;
- Occlusion order;
- Relative positions to other objects;
- Scene structure in the image.
For example, to determine “whether a hand is touching a cup,” checking box intersection alone is insufficient. You should also examine whether hand keypoints are near the cup’s edge and whether the two form a plausible pose relationship.
Explicitly Annotate Uncertainty
When multiple candidates are spatially very close, the system should not force a definitive answer. It can retain the candidate set and output information requiring further confirmation. For high-reliability applications, consider recording in the internal reasoning results:
Target binding confidenceSpatial relationship confidenceCoordinate validityNumber of candidate targets
This information supports manual review, graceful degradation, and error analysis.
5. Reflecting Visual Primitives in Training Data
If training data contains only “image–question–answer” triples, the model may learn superficial correlations without acquiring verifiable spatial reasoning ability. A more complete data organization should include intermediate supervision:
ImageQuestionTarget listTarget coordinatesTarget attributesInter-target relationshipsReasoning stepsFinal answer
For example, a spatial question can be decomposed into:
Step 1: Locate the reference target;Step 2: Read the reference target's bounding box;Step 3: Filter candidate targets in the specified direction;Step 4: Compare candidate target attributes;Step 5: Output the final conclusion.
This data structure offers three benefits. First, the model learns the mapping from linguistic reference to spatial location. Second, errors can be localized to specific stages. Third, the system can automatically validate intermediate results instead of relying solely on whether the final answer is correct.
When generating training samples, also cover difficult cases such as:
- Multiple instances of the same category appearing together;
- Partially occluded targets;
- Targets with significant size differences;
- Targets near image edges;
- Nested or overlapping targets;
- Questions involving multi-step spatial relationships;
- Judgments requiring combined reasoning over text, icons, and object positions.
6. Evaluation Metrics Beyond Answer Accuracy
Evaluation of spatial reasoning systems should be layered.
Localization Accuracy
Check how close predicted points or bounding boxes are to annotated positions, focusing on center-point error, bounding box overlap, and keypoint deviation.
Reference Resolution Accuracy
Evaluate whether the model correctly binds expressions like “that object” or “the second target from the left” to the intended object. This metric directly reflects whether coordinate anchors are working.
Relationship Judgment Accuracy
Separately measure performance on left-right, above-below, near-far, overlap, containment, and adjacency relationships, avoiding a single aggregate score that masks systematic weaknesses in specific relation types.
Reasoning Chain Consistency
Check whether the model consistently refers to the same target across steps. If the coordinates used in intermediate steps correspond to a different object than the final answer, the result should be treated as a potential risk even if the answer happens to be correct.
Robustness
Test stability by varying image size, crop range, target arrangements, and the number of distractor objects. Truly reliable spatial reasoning should not depend on fixed layouts or a single visual pattern.
7. Modular Design for Production Systems
In practice, capabilities can be split into four modules:
- Visual parsing module: outputs target categories, attributes, points, and bounding boxes;
- Spatial indexing module: builds directional, distance, and topological relationships among targets;
- Reasoning orchestration module: invokes primitives according to the question to form multi-step reasoning;
- Answer validation module: checks coordinate formats, target consistency, and relational logic.
This design is easier to maintain than having a single generation module directly produce final conclusions. The spatial indexing module can also cache target information for the same image, allowing multiple questions to share parsing results and reducing redundant computation.
For online applications, pay close attention to handling abnormal inputs. For example, when the image is empty, coordinates are out of bounds, target boxes are too small, there are too many candidates, or the question involves unsupported 3D relationships, the system should return an interpretable degraded result rather than a confident-looking but unverifiable answer.
8. Boundaries to Be Aware Of
Visual primitives primarily address explicit localization and relationship reasoning in 2D space; they do not automatically solve all visual understanding problems. The following situations still require additional modeling:
- True 3D depth relationships;
- Temporal changes and action sequences;
- Complex causal relationships;
- Interaction intent that requires common sense;
- Very low image quality or severely missing targets;
- Front-behind ambiguity caused by viewpoint changes.
Therefore, coordinates should be treated as a foundation for reasoning, not as the complete answer. A strong multimodal system combines visual primitives, linguistic semantics, scene common sense, and uncertainty management.
Conclusion
Visual primitives represented by point coordinates and bounding boxes provide a clear, verifiable intermediate representation for multimodal spatial reasoning. They convert vague natural-language references into stable spatial anchors, enabling the model to build a continuous chain across target recognition, object binding, relationship computation, and answer generation.
From an engineering perspective, the key to implementing this approach is not simply adding coordinate outputs, but unifying coordinate conventions, designing structured training data, preserving inspectable reasoning steps, and evaluating through multi-dimensional metrics covering localization, reference resolution, relationships, and consistency. For complex image understanding tasks, this “locate first, then relate, then answer” paradigm effectively improves interpretability, robustness, and debugging efficiency, while laying the groundwork for more advanced visual planning and spatial interaction.
