DL0112 VLM Visual Grounding

How do VLMs perform Visual Grounding (predicting 2D/3D bounding boxes)?

Answer

Visual grounding asks the model to return the image region a phrase refers to, and current VLMs differ mainly in where the coordinates are physically produced. The dominant generalist recipe treats a box as text: coordinates are normalized and quantized onto a fixed grid (Kosmos-2 adds 1024 dedicated location tokens, Qwen-VL emits integers from 0 to 999 inside <box> markers, Qwen2.5-VL moved to absolute pixel values inside JSON) and the language model decodes them autoregressively under ordinary cross-entropy, so detection, referring expression comprehension, and grounded captioning all become one sequence task. The specialist recipe keeps a DETR-style decoder with learnable queries, a box regression head, and L1 plus GIoU losses, fusing text into the visual features and aligning region embeddings to word embeddings contrastively (MDETR, GLIP, Grounding DINO, Florence-2). A third, hybrid recipe uses an LLM hidden state as a prompt for an external mask or box decoder, as LISA does by feeding a <SEG> embedding to SAM. Whichever decoder is used, localization quality is mostly decided upstream: the connector has to hand the LLM patch tokens with their 2D layout and position information intact, at a resolution where the target object still covers several patches. 3D grounding extends the output to a 7 to 9 DoF box and introduces the real difficulty, depth and scale ambiguity, resolved either from point clouds (ScanRefer-style proposal-and-match pipelines) or monocularly with camera intrinsics, as in Cube-LLM.

(1) Coordinates As Text: a box becomes four discrete symbols on a normalized grid, so the only training signal is token cross-entropy, with no IoU-aware term and no set matching.
(2) The Connector Decides Localization: raster-ordered ViT patch tokens through an MLP projector preserve geometry, while abstractors that pool everything into a few dozen learned queries discard the spatial layout a box depends on.
(3) Resolution Beats Bin Count: quantization error at 1000 bins is sub-pixel, but a small object that occupies one patch cannot be localized tightly at any bin resolution, which is why dynamic resolution and tiling (AnyRes, Qwen2-VL M-RoPE) matter more than the tokenizer.
(4) Detection-Head Decoding: query-based decoders with region-word contrastive alignment still lead on tight-IoU metrics and emit hundreds of boxes in a single forward pass.
(5) Hidden State As Prompt: a referent or <SEG> token embedding can drive SAM or a 3D mask decoder, decoupling language reasoning from pixel-level decoding.
(6) 3D Adds Scale, Not Just Dimensions: monocular predictions are only consistent if camera intrinsics enter the model or the normalization, otherwise depth estimates do not transfer across datasets.
(7) Metrics And Supervision: RefCOCO family Acc@0.5 for 2D, [email protected] on ScanRefer for 3D, and every box target must be expressed in the same resized or tiled frame the encoder sees.

Diagram of a vision language model grounding pipeline: image, ViT encoder, MLP projector, LLM decoder, and three output paths producing location tokens, a referent hidden state for SAM or a DETR box head, and a 3D head using camera intrinsics

Figure 1: One shared perception stack, three places to produce coordinates. The path image → ViT patches → projector → LLM is identical; only the last stage differs, and the projector is where grounding is usually won or lost.

It is worth doing the arithmetic on the tokenizer, because interviewers often assume quantization is the limiting factor. With a 1000-bin normalized grid on a 1344 px side, the worst-case error per edge is about 0.67 px, far below what Acc@0.5 can detect. The real sensitivity is object size: a square object of side s whose four edges each shift by d has \mathrm{IoU} = (s-d)^2 / (2s^2 - (s-d)^2), so a 16 px object falls below 0.5 IoU once edges move about 3 px, while a 128 px object tolerates roughly 24 px. That is why generalist grounding scores jumped with higher effective input resolution rather than with finer coordinate grids: the earliest text-token generalists sat near 52 Acc@0.5 on RefCOCO val, Qwen-VL reached roughly 89, and Florence-2-L about 93, close to dedicated grounding detectors.

Mathematical Formulation:
t_k = \mathrm{round}\left(\frac{c_k}{S}(n-1)\right)
p(b \mid I, q) = \prod_{k=1}^{4} p(t_k \mid I, q, t_{1:k-1})
\epsilon_{\max} = \frac{S}{2(n-1)}
\epsilon_{\max} = \frac{1344}{2 \cdot 999} \approx 0.67
\mathcal{L}_{\mathrm{box}} = \lambda_1 \lVert b - \hat{b} \rVert_1 + \lambda_2 (1 - \mathrm{GIoU})
B_{3D} = (x, y, z, w, h, l, \theta)
(u, v, 1)^{\top} = \frac{1}{z} K (x, y, z)^{\top}

Where:

  • b = (c_1, c_2, c_3, c_4) is the target box in the encoder’s resized pixel frame of side S, and \hat{b} is the prediction.
  • t_k is the k-th coordinate token and n the number of bins (1024 for Kosmos-2 location tokens, 1000 for Qwen-VL integers).
  • I is the image, q the referring expression, and t_{1:k-1} the previously emitted coordinate tokens, so decoding is strictly autoregressive.
  • \epsilon_{\max} is the worst-case quantization error per edge in pixels, which scales linearly with input side and inversely with bin count.
  • \lambda_1, \lambda_2 weight the L1 and GIoU terms used by regression-head decoders; text-token models have no analogue of either.
  • B_{3D} is a 3D box with center (x, y, z), extents (w, h, l), and yaw \theta; full 9 DoF variants add pitch and roll.
  • K is the camera intrinsic matrix and (u, v) the projected image point; this constraint is the required initial condition for monocular 3D grounding, since without K the depth z and the extents trade off freely.
Two panel chart: left panel shows worst-case per-edge quantization error in pixels versus number of coordinate bins for 448, 1344 and 3840 pixel inputs on log axes; right panel shows IoU versus per-edge shift in pixels for 16, 32 and 128 pixel objects with an IoU equals 0.5 threshold line

Figure 2: Left: a 1000-bin grid costs well under one pixel per edge even at high resolution, so coordinate tokenization is rarely the bottleneck. Right: the Acc@0.5 budget is roughly 3 px of edge error for a 16 px object, 6 px for 32 px, and 24 px for 128 px, which is why small-object grounding is an effective-resolution problem.

PropertyCoordinates as text tokens (Kosmos-2, Qwen-VL)Detection-head decoding (MDETR, Grounding DINO, Florence-2)Hidden state as decoder prompt (LISA, Grounded 3D-LLM)
Where coordinates appearIn the text stream, as quantized or absolute numbers inside markers or JSONFrom query embeddings in a cross-modal decoder with an explicit box headImplicitly: a referent token embedding conditions an external mask or box decoder
Training signalToken cross-entropy only, no IoU termL1 plus GIoU with Hungarian matching, plus region-word contrastive alignmentMask or box loss backpropagated into the LLM through the prompt embedding
Multi-instance outputCosts about 4 to 8 decoded tokens per box, so dense scenes are slowHundreds of boxes in one parallel forward passOne region per referent token; needs several tokens for several targets
StrengthUnifies grounding with dialogue, counting, OCR, and grounded captioning in one headBest tight-IoU accuracy and recall under a fixed latency budgetPixel-accurate masks and 3D shapes without teaching the LLM geometry
Typical failureHallucinated coordinates for absent objects, plus parse failures and no calibrated confidenceWeak compositional or relational language, since reasoning capacity is limitedTwo-stage error coupling; the frozen decoder caps achievable boundary quality

Login to view more content


Log in to track your progress

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *