Technical Analysis and Practice of Visual Primitives in Multimodal Large Language Models
Multimodal Large Language Models (MLLMs) have made significant progress in image understanding and visual question answering, but still struggle with fine-grained tasks like dense counting and complex object localization. This article delves into the "visual primitives" approach, analyzing its underlying technical logic. It explores bridging the perception and reference gaps, tokenizer designs for geometric tokens, the evolution from explicit symbolic markers to implicit spatial coordinates in chain-of-thought reasoning, and the engineering practices for image-text interleaved placeholders. These insights provide a deeper understanding of how MLLMs enhance spatial reasoning and adapt for scalable deployment.
In recent years, Multimodal Large Language Models (MLLMs) have made significant progress in fields such as image understanding and visual question answering. However, as application scenarios become more complex, models frequently experience logical breakdowns or recognition errors when handling fine-grained tasks like dense counting and complex object localization. Recently, an open-source experimental MLLM sparked widespread attention in the tech community. Its “visual primitives” approach offers a novel perspective on addressing these pain points. This article strips away specific product attributes and delves into the underlying technical logic, deeply analyzing the principles, implementation evolution, and engineering practices of the visual primitive mechanism.
1. Visual Cognitive Challenges: Perception Gap and Reference Gap
Before exploring visual primitives, we must clarify the two core challenges currently facing MLLMs. Earlier this year, a frontier research paper on visual primitives re-examined the image recognition problem of multimodal models and introduced two key concepts:
- Perception Gap: The problem where the “LLM cannot see clearly.” This usually stems from insufficient resolution of the visual encoder or limited feature extraction capabilities, preventing the model from capturing tiny details in the image. With the popularization of high-resolution visual encoders, the perception gap has been somewhat mitigated.
- Reference Gap: This is a deeper cause limiting the model’s recognition ability. Even if the model “sees” the image content, it still tends to use natural language to describe objects when performing logical reasoning. Natural language is highly ambiguous and vague. When facing dense scenes with many similar objects, such as “the second red apple in the top left,” this descriptive method easily causes the logical chain to break.
To bridge the “reference gap,” the industry introduced the concept of “visual primitives.” Visual primitives aim to serve as “unambiguous pointers” that accurately describe objects in continuous visual space. By using a non-natural language symbol system to directly anchor targets in a spatial coordinate system, they avoid the negative impact of natural language ambiguity on recognition tasks.
2. Visual Primitive Definition in the Tokenizer Mechanism
The implementation of visual primitives is first reflected in the tokenizer design. Analyzing the configuration files of this open-source MLLM reveals a series of carefully designed special tokens used to denote geometric and spatial concepts such as “polygon,” “point,” “box,” and “reference.”
Specifically, its tokenizer.json includes the following key configurations:
{"id": 129271, "content": "<|/polygon|>", "special": true,"id": 129272, "content": "<|polygon|>", "special": true,"id": 129273, "content": "<|/point|>", "special": true,"id": 129274, "content": "<|point|>", "special": true,"id": 129275, "content": "<|box|>", "special": true,"id": 129276, "content": "<|/box|>", "special": true,"id": 129277, "content": "<|/ref|>", "special": true,"id": 129278, "content": "<|ref|>", "special": true}
The introduction of these special tokens equips large language models with the ability to directly manipulate spatial geometric elements during chain-of-thought reasoning. For instance, <|box|> can delineate a region, <|point|> can precisely point to a pixel coordinate, and <|polygon|> can outline the contour of a complex object. Discretizing visual space into symbols that can be directly processed by language models represents a significant paradigm shift in multimodal reasoning.
3. From Explicit Markers to Implicit Coordinates: Evolution of Chain of Thought
However, during actual testing and inference verification of this model, a puzzling phenomenon emerged: explicit “visual primitive” markers did not appear in the actual output chain of thought. For example, we expected the model to output structures like <|point|[[120, 340]]|/point|> when analyzing objects, but these special tokens seemed “invisible” in the generated text.
Instead, the model directly adopted a pure numeric coordinate system when describing objects, such as “the object located at (120, 340).” This phenomenon sparked in-depth discussions within the tech community. A reasonable speculation is that during the model’s later alignment and reinforcement training phases, it gradually acquired the ability to internalize explicit visual primitive tokens into implicit spatial coordinate representations.
This evolution holds significant engineering value. On one hand, directly outputting coordinate descriptions can drastically reduce the generation overhead of special tokens, improving inference efficiency. On the other hand, it indicates that the model has truly understood the spatial semantics represented by the coordinates, rather than merely applying symbol templates mechanically. This transition from “explicit symbol dependence” to “implicit spatial cognition” may be a hallmark of the maturing cognitive capabilities of multimodal large models.
4. Engineering Practice of Image-Text Interleaved Placeholder Mechanism
In addition to visual primitives for spatial localization, the model’s tokenizer includes another type of special placeholder token: place_holder_mm_span_xxxx, where xxxx ranges from 0001 to 0442.
Based on its literal meaning and functionality, these placeholders are primarily used for multimodal input processing in image-text interleaved scenarios. When processing documents containing numerous images, the model needs a mechanism to mark the insertion positions of image features within the text stream. place_holder_mm_span plays this role, aligning the image feature vector blocks extracted by the visual encoder with the text sequence, ensuring that the model correctly fuses cross-modal information during autoregressive generation.
It is worth noting that while some documentation claims the model supports inputs of over 600 images, the placeholder numbering limit appears to be around 440. This might be a consideration for engineering optimization: in extreme multi-image scenarios, the system might dynamically merge or downsample image features, or allow the same placeholder to be reused for feature blocks of multiple images. This supports larger-scale image-text interleaved tasks while keeping the context window length controllable.
5. Summary and Outlook
The introduction of the “visual primitives” technical route in MLLMs fundamentally re-examines the expression method of visual spatial information. By bridging the “reference gap,” the model’s logical reasoning capabilities in dense counting and complex localization tasks have seen substantial improvements. Furthermore, the evolution from explicit markers to implicit coordinates, along with the introduction of the image-text interleaved placeholder mechanism, demonstrates the model’s flexibility and adaptability in engineering implementation.
When deploying such complex multimodal models at scale, robust underlying computing power and infrastructure support are often required. Relying on Baidu AI Cloud’s general computing platform and container services, developers can build highly available model inference environments, utilizing elastic GPU resource scheduling to handle the high-concurrency computing pressure brought by multimodal tasks. In the future, as spatial cognition technology further deepens, multimodal large models will undoubtedly unleash greater technological dividends in fields such as autonomous driving, industrial quality inspection, and medical imaging analysis.
