Visual Primitives in Multimodal Models: An Engineering Deep Dive into Pointers, Tokens, and Protocols

    Many multimodal models can "see" objects in an image yet still refer to them through ambiguous natural language, which breaks down in dense counting, precise localization, and region-grounded reasoning. This article explains how "visual primitives"—special tokens such as points, boxes, and polygons—serve as precise pointers into visual space, why they rarely appear in user-facing outputs, and how to design the protocols, parsers, validation, and evaluation needed to apply this technique in your own systems.

    1. Background: From “Seeing Clearly” to “Pointing Precisely”

    In image understanding tasks, multimodal models typically focus on perception first: whether image resolution is sufficient, whether details get compressed, and whether text and visual features are properly aligned. However, in tasks like dense counting, complex object localization, and fine-grained region description, a model may “see” a target yet still introduce ambiguity by describing it in natural language. Phrases such as “the second smaller object from the left” or “the blue region near the edge” can refer to different objects depending on the observer or context.

    Common industry analyses frame this as two gaps:

    • The perception gap: the model fails to acquire or understand fine-grained image details.
    • The grounding (referring) gap: the model still relies on natural language to refer to visual objects during reasoning, leading to imprecise references and broken reasoning chains in complex tasks.

    Visual primitives were proposed to address the second problem. The core idea is not to have the model “explain” the image with more natural language, but to introduce a set of “pointers” that can precisely locate objects in continuous visual space—points, bounding boxes, and polygons. These pointers enter the model’s representation and reasoning process as special tokens, allowing the model to directly reference regions of an image instead of repeatedly describing them in vague language. For developers, understanding this mechanism helps in designing more stable multimodal output protocols, parsers, and evaluation systems.

    2. What Visual Primitives Are: Special Tokens with Coordinate Payloads

    Based on implementation clues, visual primitives typically appear as special tokens in the vocabulary—for example, paired markers like <|polygon|> and <|/polygon|>, <|point|> and <|/point|>, <|box|> and <|/box|>, and <|ref|> and <|/ref|>. These are not ordinary text tokens: they are flagged as special symbols in the vocabulary configuration, so they are not split apart by regular tokenization rules and remain atomic within a sequence.

    The paired tokens work like a lightweight structured protocol: the opening marker signals “a certain type of visual primitive follows,” the closing marker signals the end of that primitive, and the content in between carries coordinates, reference IDs, or object identifiers.

    A schematic structure looks like this:

    1. {
    2. "objects": [
    3. {
    4. "ref": "obj_1",
    5. "shape": "box",
    6. "coords": [0.12, 0.35, 0.48, 0.72]
    7. },
    8. {
    9. "ref": "obj_2",
    10. "shape": "point",
    11. "coords": [0.81, 0.22]
    12. }
    13. ],
    14. "answer": "The image contains 2 target objects"
    15. }

    Inside the model, these tokens can be associated with the visual feature space: a point maps to one coordinate, a box maps to a bounding range, a polygon maps to a finer region contour, and reference markers bind subsequent descriptions to a specific object. Compared with natural-language references, visual primitives are unambiguous, parseable, and verifiable—especially valuable for dense counting and complex localization. It’s important to note, however, that visual primitives are not the final answer itself; they are intermediate representations or control signals that must work together with image coordinates, object IDs, and the final natural-language conclusion.

    3. Vocabulary-Level Design Clues and Intent

    From a vocabulary configuration perspective, special tokens typically exhibit characteristics such as “excluded from standard normalization, never split, treated as special symbols.” This design lets the model treat them as protocol control characters during training and inference, rather than ordinary text.

    Paired tokens offer clear boundaries: a parser can extract payloads by matching opening and closing markers, avoiding ambiguity when coordinates and natural language are mixed together. Reference markers enable object-level binding—for example, the model first outputs a box with a reference ID, then cites that ID in the answer, reducing repetitive descriptions.

    That said, the presence of special tokens in the vocabulary does not guarantee they will be explicitly emitted in the service output. In real products, the model may only use these tokens in specific training data, specific task modes, or internal reasoning chains; user-facing text often passes through post-processing, protocol conversion, or safety filtering. So if you only observe outputs from a general-purpose chat endpoint, you may find “no visible visual primitives”—which is not a contradiction.

    4. Why Visual Primitives Rarely Appear in Actual Usage

    First, training objectives differ from presentation objectives. During training, the model may see data annotated with visual primitives, learning “when to use a point, box, or polygon to refer to an object.” At inference time, user-facing output is usually expected to be natural language, structured JSON, or rendered visual overlays. Internal tokens may be consumed by the parser, with only the readable conclusion retained.

    Second, special tokens behave more like control characters than text. The server may restrict direct output of special tokens, or filter out control characters during streaming responses, exposing only parsed coordinate fields. This prevents users from seeing unreadable markers and reduces the risk of protocol misuse.

    Third, trigger conditions are limited. In general conversational data, explicit visual primitives occur far less frequently than natural language. Without explicit prompts, tool constraints, or task requirements, the model tends to describe things in natural language. Only in tasks like dense counting, precise localization, or region referencing will the system force structured pointers via prompt templates, output schemas, or tool calls.

    Fourth, decoding constraints and post-processing reshape visible output. A common engineering pattern: the model generates intermediate tokens, a parser converts them into an object list, and the presentation layer renders boxes, points, or polygons. The final API returns natural language plus structured fields—not the raw token sequence. “Not seeing explicit visual primitives” is therefore a normal consequence of productization.

    5. Engineering Practice: Protocol, Parsing, Validation, and Evaluation

    If you want to adopt the visual primitive approach in your own system, start by defining a stable output protocol—for example, requiring the model to output shape, coords, ref, and answer in structured fields, with coordinates in a normalized range and boundary validation applied. A parsing sketch:

    1. def parse_visual_primitives(tokens):
    2. objects = []
    3. stack = []
    4. for tok in tokens:
    5. if tok in ("<|box|>", "<|point|>", "<|polygon|>"):
    6. stack.append({"shape": tok.strip("<|>"), "coords": []})
    7. elif tok in ("<|/box|>", "<|/point|>", "<|/polygon|>"):
    8. obj = stack.pop()
    9. if validate_coords(obj["coords"]):
    10. objects.append(obj)
    11. elif stack and is_number(tok):
    12. stack[-1]["coords"].append(float(tok))
    13. return objects

    After parsing, you must perform consistency checks: whether coordinates fall within the image bounds, whether points/boxes/polygons are properly closed, whether reference IDs actually exist, and whether the object count matches the answer. For evaluation, don’t just look at the final text—also track parse failure rate, localization IoU, counting accuracy, reference consistency, and structured-output compliance. On the data side, cover dense small objects, occlusion, edge-adjacent targets, and multi-object reference scenarios, so the model doesn’t learn to “emit tokens that don’t correspond to real regions.”

    6. Limitations and Best Practices

    Visual primitives cannot replace high-quality visual encoding and resolution management. If the perception layer is weak, even precise pointers may land on the wrong regions. Engineering efforts should therefore optimize image preprocessing, resolution strategy, and visual feature alignment in parallel. Second, special-token output needs strict constraints to prevent injection or forgery; similar markers appearing in user input should be escaped or filtered. Finally, evaluation should distinguish between “does the model know how to use pointers” and “are the pointers actually accurate”—format alone doesn’t prove capability.

    Overall, the value of the visual primitive approach is that it converts vague natural-language references into parseable, verifiable visual pointers, providing a more stable intermediate representation for dense counting and complex localization. The fact that these primitives don’t appear explicitly in practice doesn’t mean the mechanism is absent—it is usually the combined result of training objectives, control-character design, and product-level post-processing. Developers should focus on protocol design, parsing and validation, and evaluation feedback loops, rather than simply checking whether special tokens appear in the final text.