Multimodal Visual Primitives: How Discrete Markup Unifies Spatial Understanding Tasks

    This article explains the visual primitive approach used in experimental multimodal models, where geometric structures in images are written as special text tokens instead of relying on continuous visual encoder outputs. It covers the two main pain points of mainstream designs, the roles of box, point, and polygon markers found in the tokenizer, the benefits and costs of this route, and practical engineering guidance for preprocessing, output parsing, sequence length control, and evaluation.

    1. Why Multimodal Models Need Visual Primitives

    A recent open-source experimental multimodal model, the first vision experiment in a general-purpose model series, has drawn attention in the community. Setting the specific model aside, what matters for developers is the technical route it continues: instead of depending on the output of an additional continuous visual encoder, it writes the geometric structures in an image directly as a sequence of special tokens and lets the language model handle them in a unified way. These tokens are usually called visual primitives.

    Two pain points of mainstream approaches explain the value of this idea.

    The first is modality fragmentation. The common practice is to have a visual encoder emit a batch of continuous vectors and then align them to the language space through a projection layer. This works well, but the vision side and the language side remain two sets of parameters with two training schedules, so engineering work has to maintain two models plus an alignment layer.

    The second is weak interpretability. Continuous vectors are hard to verify directly, and when something goes wrong it is difficult to tell whether the model “looked at the wrong location” or “recognized the wrong category.” If detection boxes, segmentation polygons, and keypoints are written as text sequences, the model’s intermediate output becomes a human-readable structured description, which makes debugging and data cleaning more direct.

    The core claim of visual primitives is to unify spatial localization and shape description into a kind of “writable language.”

    2. Reading the Design from the Vocabulary: What the Three Token Types Mean

    The most direct evidence that a model follows the visual primitive route is in the tokenizer configuration. The vocabulary of such models typically contains paired opening and closing markers that wrap polygons, points, and bounding boxes, for example paired symbols shaped like <|polygon|>, <|/polygon|>, <|point|>, <|/point|>, <|box|>, and <|/box|>.

    The division of labor among the three primitive types is clear:

    • Bounding box: expresses coarse-grained localization; four values are enough to describe the target extent, token cost is the lowest, and it suits detection-style tasks.
    • Point: expresses single-point localization, commonly used for keypoints, center points, or referring to a specific position.
    • Polygon: expresses precise contours with a variable number of vertices, suited to segmentation and shape description.

    The point of paired opening and closing markers is to give the sequence explicit boundaries. During generation the model knows when one geometric object ends, and the inference side can parse the output with a simple state machine rather than complex post-processing.

    An illustrative way of organizing the sequence is shown below (structure only, not a specific interface):

    1. <image>
    2. <|box|> x1,y1,x2,y2 <|/box|>
    3. <|polygon|> x1,y1 x2,y2 x3,y3 ... <|/polygon|>
    4. <|point|> x,y <|/point|>
    5. A red sedan on the left side of the image
    6. </image>

    Coordinates are usually quantized by mapping pixels to integers in a fixed range (such as 0–999), which the tokenizer then splits into several numeric tokens. This keeps the vocabulary size manageable and decouples coordinate precision from image resolution.

    3. Benefits and Costs of This Route

    The benefits come down to three points.

    First, unified modeling. Detection, segmentation, localization, referring, and similar tasks are compressed into a single paradigm of “look at the image, describe it, and write coordinates.” One set of weights covers multiple tasks, and fine-tuning costs drop significantly.

    Second, high data utilization. Geometric annotations are themselves structured text, so they can be mixed into image-text corpora for training directly, without designing a separate task head for each task type.

    Third, interpretability and verifiability. The output is text, so rules can compare and score it directly, which also makes automated data feedback loops easier.

    The costs are equally clear.

    The first is sequence length inflation. When a complex scene contains dozens of instances and each instance has dozens of vertices, coordinate tokens lengthen the context quickly and inference decoding costs rise accordingly.

    The second is a precision ceiling constrained by quantization granularity. For small or densely packed targets, rounding errors in integer coordinates get amplified.

    The third is a high demand for annotation quality in training data. If polygon vertex ordering and closure conventions are not consistent, the model learns noise.

    4. Engineering Implementation Notes

    When integrating this capability into real business systems, four areas deserve attention.

    1. Input preprocessing. Settle on a unified aspect-ratio strategy, define the coordinate normalization range explicitly, and fix both in documentation to avoid mismatches between training and inference.
    2. Output parsing. Parse paired markers with a state machine rather than regular expressions, and add defensive validation for vertex counts and out-of-range coordinates.
    3. Length control. For very large images, slice first and run inference slice by slice, or cap the number of instances per image to keep the context within an acceptable range.
    4. Effectiveness evaluation. Beyond standard accuracy, track localization metrics separately (such as intersection over union) along with format validity rate, so that “cannot see clearly” and “cannot write correctly” are distinguished.

    Deployment does not have to be tied to a specific platform. Model weights can sit in object storage, training jobs can run on a container platform, and inference services can scale elastically to handle peaks; feeding logs and metrics into a logging service plus monitoring and alerting closes the loop. If you use general cloud products from Baidu AI Cloud, these capabilities are offered as standard categories and can be integrated smoothly into an existing architecture.

    5. Summary

    The essence of the visual primitive route is trading discrete markers for modality unification and interpretability. It does not aim to beat task-specific models on any single task; it lets one general model cover more spatial understanding tasks at lower cost. The practical advice for developers is to first confirm the coordinate quantization and marker conventions, then assess the sequence length budget, and finally validate format validity rate and localization precision with a small set of annotated data before scaling up gradually.