Closing the Reference Gap in Multimodal Reasoning with Spatial Markers
Multimodal language models read images well but still confuse objects, miscount, or drift on spatial relations during multi-step reasoning. This article traces those failures to a reference gap between language and image regions, and describes a practical fix: embedding bounding-box and point markers directly into the chain of thought so each reasoning step stays bound to a verifiable image location. It covers the core idea, data construction, a common three-stage model architecture, a Python example for parsing box markers, and how to evaluate results along with the method's limits.
1. Background: Why Reasoning Goes Wrong After Visual Understanding
Multimodal large models have made clear progress on image captioning, chart question answering, and document understanding. In tasks that require multi-step reasoning, however, they often confuse objects, skip them, count the same object twice, or misjudge spatial relationships. The root cause is not purely visual recognition. It lies in the missing stable correspondence between the reasoning process and the image.
For example, when asked to count how many people appear in a scene, a model may count someone it already counted at an earlier step. When asked to find where a curve ends, the model must keep tracking the same line, and a small deviation partway through leads to a wrong conclusion.
2. The Reference Gap: A Broken Alignment Between Language and Image
This article groups these problems under the term reference gap. When a model mentions “that thing” at some step of its reasoning, it often cannot state reliably which region of the image it refers to.
The reference gap shows up in three typical ways:
- Object confusion: when many objects of the same kind are present, the model assigns attributes to the wrong one.
- Repeated or missed counting: the model cannot keep track of which objects it has already handled.
- Spatial relation drift: over a long reasoning chain, position descriptions gradually diverge from the original image.
People handling such problems often point with a finger, a pen tip, or their gaze, one object at a time. This action binds abstract language to a concrete location and lowers the load on working memory. Carrying this idea over to models raises the central question: how can reasoning text carry verifiable spatial pointers?
3. The Core Idea: Write Spatial Markers Into the Chain of Thought
The idea breaks down into two elements.
- Bounding box: a rectangle that locates the extent of an object, suited to describing regions, object instances, and anything whose area matters.
- Point: a single coordinate that locates an object’s center or a key position, suited to counting and to tracking endpoints and path nodes.
Both appear as structured markers inside the reasoning text and bind to objects through semantic placeholders. The format below is illustrative; the actual syntax should follow your own implementation:
Observed <ref>pedestrian</ref><box>[[0.12,0.30,0.20,0.65]]</box>,next check whether <ref>pedestrian</ref><point>[[0.48,0.52]]</point> has been counted.
This style lets every reasoning step trace back to an image location. During training, the model learns not only the final answer but also “where to look and what it is looking at.”
3.1 The Role of Placeholders
Placeholders (such as “pedestrian” above) ensure that the same object is referenced consistently across multiple reasoning steps. They act like variable names in the reasoning process and reduce the ambiguity caused by later use of pronouns such as “it” or “that one.”
3.2 Choosing Between Boxes and Points
Boxes locate objects more stably but cost more to annotate and are sensitive to boundaries on small targets. Points are cheaper to annotate and suit counting and path tracking, but they cannot express an object’s extent. Practical systems usually mix the two: points for counting, boxes for localization and attribute judgment.
4. Data Construction: The Decisive Factor
The difficulty of this approach lies mainly in the data, not in the structure itself. A usable training dataset typically has to solve three problems.
4.1 Data Sources
- Existing object detection, instance segmentation, and keypoint datasets can be converted directly into box or point annotations.
- In-house business images can be supplemented with annotations through manual or semi-automatic tools.
- Synthetic data, such as programmatically generated mazes, regularly arranged shapes, and line charts, carries precise and unambiguous annotations.
4.2 Generating Reasoning Traces
Coordinates alone are not enough to train reasoning ability. The annotations usually need to be turned into step-by-step reasoning text: describe the whole first, then handle objects one by one, inserting the corresponding spatial marker at each step. Generation can be template-based construction or model-assisted rewriting, followed by manual spot checks.
4.3 Consistency Checks
Three things must be verified:
- whether marker coordinates fall within the image bounds;
- whether placeholders in the same reasoning chain point to the same object;
- whether the reasoning conclusion matches the annotation ground truth.
Samples that fail these checks should be removed, not corrected and kept. Otherwise the model learns incorrect spatial relationships as if they were correct patterns.
5. A General View of the Model Architecture
A common multimodal model structure can be summarized in three stages.
- Visual encoder: splits the image into patches and encodes them into visual tokens. When dynamic resolution is supported, the positional encoding must handle inputs of varying sizes.
- Connector module: maps visual features into the language model’s embedding space.
- Language model: takes text and visual tokens and generates reasoning text that contains spatial markers.
High-resolution images produce a large number of visual tokens, and KV cache usage grows accordingly during inference. A common practice is to downsample or merge visual tokens in intermediate layers or at the cache stage, lowering memory use and latency. The higher the compression ratio, the greater the risk of losing detail, so there is a trade-off between compression rate and spatial precision.
6. Engineering Example
The code below shows how to parse box markers in reasoning text and convert normalized coordinates into pixel coordinates for visual verification. This example assumes coordinate values range from 0 to 1.
import refrom dataclasses import dataclassREF_BOX = re.compile(r"<ref>(.*?)</ref><box>(.*?)</box>")COORD = re.compile(r"\[([\d.]+),\s*([\d.]+),\s*([\d.]+),\s*([\d.]+)\]")@dataclassclass Grounding:label: strboxes: list[tuple[float, float, float, float]]def parse_boxes(text: str) -> list[Grounding]:results = []for label, body in REF_BOX.findall(text):boxes = [tuple(map(float, m)) for m in COORD.findall(body)]results.append(Grounding(label=label.strip(), boxes=boxes))return resultsdef to_pixel(box, width: int, height: int):x1, y1, x2, y2 = boxreturn (round(x1 * width), round(y1 * height),round(x2 * width), round(y2 * height))if __name__ == "__main__":sample = "Observed <ref>pedestrian</ref><box>[[0.12,0.30,0.20,0.65]]</box>"for g in parse_boxes(sample):for b in g.boxes:print(g.label, to_pixel(b, 1280, 720))
After running, it prints pedestrian (154, 216, 256, 468). Before parsing, check that tags are closed and that the coordinate count is a multiple of four. When model output is unstable, this step catches format errors early and keeps malformed markers out of the downstream pipeline.
7. Evaluation and Limitations
Evaluation should separate three kinds of metrics: localization accuracy (box intersection-over-union, whether a point falls inside the target region), reasoning accuracy, and counting accuracy. Reporting final-answer accuracy alone cannot show whether the spatial markers actually help. A more reliable approach is an ablation study that compares performance with and without spatial markers, reported separately by task type.
The method has clear limits. The discretization precision of coordinates caps how finely objects can be located. Annotations of occluded and overlapping objects are inherently ambiguous. In long reasoning chains, an early incorrect marker propagates forward. Complex spatial reasoning remains hard and usually requires more structured training data combined with verification mechanisms.
8. Summary
Embedding spatial markers into the chain of thought is one workable way to keep language continuously bound to image locations throughout the reasoning process.
