Overview
Ask a model a question about a bank statement. It answers: “2,000 was withdrawn at the ATM on 12 May.” Now ask it to show where it read that. This post is about how a model should answer the second request.
Most vision-language models (VLMs) answer it by typing a box. They write four numbers, one token at a time, and hope the numbers land on the right pixels. On documents this is brittle. The evidence is often in two places at once. It can be a curved line of text, a wedge of a pie chart, or a whole table row. And a reader may want the number, the row it sits in, or the whole table.
M3Grounder, our CVPR 2026 paper, takes a different route. The VLM answers as usual. After each piece of the answer that needs evidence, it writes one special token, [GROUND]. That token's hidden state becomes a prompt for SAM, the Segment Anything Model, and SAM returns a pixel mask. The VLM decides what to ground and at which granularity. SAM marks where. The two are one model, trained end to end.
The idea behind it is simple. When people show evidence on a page, they do not read out coordinates. They do not just point either, because a paragraph or a table row has an extent that a point cannot express. They reach for a highlighter. A mask is that highlighter: it covers exactly the evidence, at any shape and size, and nothing else.
This is the third post in the Grounded Document Intelligence series. The hub post gives the whole thesis in one place. The REPLICA post explains how we rebuild a page as FID-HTML, the text form that supplies most of M3Grounder's training data. Here we go deep on M3Grounder: the problem from first principles, every design decision and its reason, the results and ablations, and what we learnt that applies beyond this one paper.
The post follows the order of the thesis talk. First, how a typed box cracks on one pie chart question. Next, what better evidence looks like: any shape, one span or many. Then the obvious two-tool chain and why it fails, the model, the two losses that encode what documents look like, and the data engine that supplies the training data. The results and ablations come last.
Why answers need evidence
A document answer without evidence has to be trusted or checked by hand. Checking means re-reading the page. On a ten-page contract or a dense lab report that defeats the point of asking a model in the first place.
Grounding changes three things. First, a reader can verify at a glance: one look at the highlighted region, not a re-read. Second, regulated settings such as healthcare, law and finance need answers that are auditable, where every claim can be traced to its source. Third, a grounded region can be acted on: redacted, extracted, cropped for a downstream model, or clicked in an interface.
The need is sharpest where documents are still physical objects. Land records, medical reports, court filings and government certificates are photographed and passed around as images, often tilted, faded or stamped. A person relying on one needs to see the exact line, field or stamp behind an answer, not only the answer.
Each of these uses wants something slightly different from the evidence. A citation wants the exact number. A redaction wants the whole transaction row, not just the amount. A retrieval system that chunks documents wants the whole table. This difference in granularity will matter later. First, look at how grounding is usually done.
How grounding works today
The dominant approach treats a location as more text. Pix2Seq (2021) showed that object detection can be cast as language modelling: quantise each box coordinate into a discrete token and predict the tokens one after another. VLMs adopted the same trick. Kosmos-2 divides the image into 32 bins per side and writes a box as location tokens linked to a text span. Shikra writes normalised coordinates as plain numbers. Florence-2 writes quantised coordinates for detection and grounding in one sequence format. Qwen2.5-VL writes absolute pixel coordinates in JSON. Ferret mixes discrete coordinates with continuous region features, which lets it accept free-form regions as input, but its grounded outputs are still coordinates.
Document models followed. mPLUG-DocOwl 1.5 trains on multi-grained text localisation, pairing text with boxes at several levels. TextMonkey adds text spotting and grounding with positions in its answers. DOGR, the strongest prior document grounding model, builds a data engine for grounded document QA and predicts answers together with boxes. BoundingDocs and MMDocBench evaluate document QA with the answer location given as boxes. General VLMs such as Qwen3-VL and InternVL3.5 also output boxes, but they are not optimised for grounding accuracy on documents.
Take a pie chart of city shares and ask: “What share does Mumbai hold?” The answer is 7.7%. Now show the evidence. A box around Mumbai's wedge also grabs the neighbouring wedges, such as Paris and Sydney, because a rectangle cannot follow a wedge. A mask covers Mumbai's wedge and nothing else. A box that hugs a curved shape closely would need a polygon, and a polygon is hundreds more coordinates, each one a token to predict.
In all of these, the evidence is a rectangle, and the rectangle is typed. That breaks in four ways.
- Typed coordinates are unanchored. The numbers are next-token predictions like any other text. Nothing ties them to the pixels, so they can be hallucinated.
- Rectangles are the wrong shape. A box around a curved line of text or a pie wedge covers mostly something else.
- Evidence is plural. One answer often rests on two or three separate places. A single box around all of them covers half the page.
- Precise shapes are expensive as text. A polygon that follows a curved line takes many coordinates, and each coordinate is several tokens.
There is a fifth, quieter problem, and it is about small evidence. Grounding is usually scored as correct when the intersection over union (IoU) between the prediction and the truth exceeds 0.5. Consider a box that is right in every way except that it is shifted by d pixels along a side of length s. A short derivation gives its IoU:
So the finest granularity, a single phrase, has the least room for error. A model that types its coordinates must be most precise exactly where precision is hardest. Figure 1 lets you test all of this on drawn document evidence. Pick a kind of evidence, then shift both predictions down and watch which one survives the 0.5 threshold.
What document evidence looks like
Natural-image grounding grew up on a simple case: one phrase, one object. “The dog on the left” is a dog. A box, or even a single point, identifies it well. Some recent VLMs, Molmo for example, answer with points for exactly this reason: a point is cheap and says which object.
Document evidence rarely looks like that. Three properties set it apart.
- It is multi-span. “Which three Asia Pacific cities have the highest prices?” rests on three separate labels. A good answer cites each one separately, so a reader can check each claim.
- It is irregular. Text curves around seals and along maps. Charts have wedges and thin bars. Stamps are rotated. Evidence can also sit next to graphics that a loose region would swallow.
- It is multi-granular. Documents have a natural hierarchy: words form lines, and lines form blocks. Different questions, and different uses of the answer, need different levels of it.
A point is not enough here. It says which thing, but not how much of it. A paragraph, a table row or a curved street name has an extent, and that extent is the evidence. This is why we model grounding as masks. The VLM decides what to highlight and how much. SAM does the highlighting.
Two answers from the paper's teaser show the range. In the first, the answer is “River Thames”, and the evidence is the curved lettering that follows the river. No box could cover those letters without covering the map around them. In the second, one answer cites a logo and three city rows. Each piece gets its own mask, in the same answer. So the output has to allow any shape, and it has to allow one span or many. Figure 2 shows both.
(A) One span, curved: the mask follows the letters along the river.
(B) Four spans in one answer: the curved logo text and three city labels, each with its own mask.
<e>…</e> span tags itself, then a [GROUND] token after each span. No box could follow the river's lettering in (A). In (B), one box around all four pieces of evidence would cover most of the chart.Why not chain two tools
Before building a new model, consider the obvious alternative. VLMs are good at answers. SAM is good at masks. Why not run them one after the other?
A typical chain looks like this. An OCR engine reads the page into lines of text with boxes. A VLM answers the question from the image. A matcher looks up the answer string in the OCR text and takes the box of the matching line. SAM turns that box into a mask. Every component is strong on its own, and nothing needs training.
The chain fails at its joints. On a poster with a curved banner, OCR misreads the banner as “5TH YFAR CE1F8RAT”. The VLM, reading the pixels, correctly answers “5th Year Celebrations”. The matcher finds no line that matches, so SAM never receives a prompt. Other joints fail in other ways. If the answer phrase appears in three places on the page, the matcher has to guess which one. If the VLM paraphrases “15 March 2024” as “March 15, 2024”, the strings no longer match. If the answer is abstractive, such as “the account is overdrawn”, there is no string on the page to match at all.
The structure makes this worse than it looks. If each stage succeeds independently with probability r1, r2 and r3, the chain succeeds with probability at most r1 · r2 · r3. Three stages that are each right 90% of the time give at most 73%. And no stage after OCR ever looks at the pixels again, so no stage can repair an earlier error. Figure 3 steps through both designs on the same poster.
The architecture: a grounding token that prompts SAM
M3Grounder couples a VLM with a promptable segmentation model. Given a document image x and a question q, the VLM generates the answer autoregressively, with span tags and grounding tokens woven into it:
Each [GROUND] token is emitted immediately after its span. That gives a one-to-one link between a piece of the answer and a region of the page. An answer with three cited facts has three tokens and three sets of masks. The token is a new entry in the vocabulary; the VLM learns when to write it like any other token.
From token to mask
Text never carries the location. Instead, the model takes the final hidden state of each [GROUND] token, a vector h̃k. Three small MLP heads project it into three prompt embeddings, one per granularity:
Each prompt embedding enters SAM where a click or a box prompt would normally go. SAM's mask decoder combines it with the image embedding and returns a mask. Figure 4 follows one forward pass on a blood report, from the question to six masks: three nested masks for each of two cited spans.
[GROUND] token after each cited span. Each token's hidden state goes through three projection heads, giving phrase, line and block prompts. SAM encodes the page once and decodes one mask per prompt. The final step shows training: the mask losses flow back through SAM's decoder and the heads into the language model.Why each piece is there
Why a token and not coordinates. A hidden state is a vector of thousands of numbers, computed with the whole page and the whole answer in view. It can carry which span, which instance of a repeated phrase, and what granularity, all at once. Coordinates have to commit to four numbers, one digit at a time. The paper calls this decoupling: the VLM concentrates on accurate answers and span boundaries, and the segmentation module handles geometry.
Why SAM. SAM was trained to turn a prompt into a mask of any shape, on 1.1 billion masks. It already knows how to follow a curved edge or a thin bar. M3Grounder only has to teach it what document prompts mean. The design is backbone-agnostic. The paper trains two variants: M3Grounder-I on InternVL3.5-8B and M3Grounder-Q on Qwen3-VL-8B, both with SAM.
Why three heads. One hidden state has to answer three questions: which phrase, which line, which block. A separate projection for each lets the three prompts differ. The ablations show this matters a great deal; we return to it below.
Why end to end. The mask losses flow back through SAM's decoder, through the heads, into the language model. So the language model learns to put into each grounding token exactly the information the segmenter needs. In a chain, nothing teaches the VLM what a good prompt looks like. In the authors' walkthrough of the model, the language decoder, the projection heads and SAM's mask decoder are trained, while the vision encoder and SAM's image and prompt encoders stay frozen. The mask decoder is kept in full FP32 precision for stability while the VLM uses mixed precision.
Who does what in M3Grounder
- Vision-language model
- reads the page and the question, writes the answer, marks each span that needs evidence, and decides what to ground
- [GROUND] hidden state
- the message between the two models: what to mask, carried as a vector rather than as coordinates
- Three projection heads
- turn that message into three prompts, one per granularity
- SAM
- the highlighter: encodes the page once and draws one mask per prompt, at any shape
M3Grounder is not the first model to join a language model to a segmenter. LISA introduced the embedding-as-mask idea for natural images: a <SEG> token whose hidden state SAM decodes into one mask. GLaMM grounds each phrase of a conversation with its own mask. PixelLM decodes several targets with its own light decoder instead of SAM. These models showed the route works, but they were built for natural scenes, and the M3Grounder paper reports that such models transfer poorly to documents. What M3Grounder adds for documents is the span tags that the model writes itself, one token per span, three granularity heads, two losses that encode document structure, and a document data engine.
Phrase, line and block
Every [GROUND] token returns three masks, nested inside each other: the phrase, the line that contains it, and the block that contains the line. In a table the rule changes shape but not meaning. The answer cell is the phrase, the cell's row is the line, and the whole table is the block.
Why three, and why all at once? Because the right granularity depends on the question and on what the reader will do with the answer. Extractive questions, such as “Name:” or “Address:”, want the exact phrase. Abstractive questions, such as “Summarise the reason for acceptance”, need a whole block. And the same answer serves different uses. On a bank statement, the phrase cites the number, the line redacts the transaction row, and the block chunks the whole table for retrieval. Try it in Figure 5.
How much was withdrawn at the ATM on 12 May, and what is the closing balance?
A different design would ask the user for a granularity and return one mask. Returning all three costs little, since the image embedding is shared and each mask is one light decoder pass. It also gives the model three related supervision targets for every grounded span. That turns out to matter more than the convenience. As the ablations show, training on all three levels improves the finest level.
Two document-specific losses
M3Grounder is trained end to end with four terms. Two are standard. Two encode what we know about documents.
ℒlm is the usual cross-entropy over all output tokens, including the span tags and the [GROUND] tokens. ℒseg supervises every predicted mask against its ground truth with Dice loss plus binary cross-entropy (BCE). Its weights fall with granularity. For BCE they are 2.0 for phrases, 1.0 for lines and 0.5 for blocks. For Dice they are 1.0, 0.5 and 0.25.
Each of the two new losses fixes one failure, and each can be said in one sentence. Bleed suppression stops SAM from spilling onto icons and graphics. Hierarchical enclosure keeps a finer mask inside its coarser one: phrase inside line, line inside block.
Bleed suppression
SAM is a general segmenter. Prompted near text, it tends to spill onto nearby icons, bars and graphics, because in natural images those would be part of the same object. Bleed suppression penalises every predicted pixel that falls outside text:
Hierarchical enclosure
The three masks of a span are three separate predictions. Nothing in ℒseg says a phrase mask must stay inside its line. Enclosure adds that rule:
Two details of these formulas explain a lot. First, both are fractions of the predicted mask, not averages over the page. Second, in ℒhier the coarser mask is the ground truth, and the block level never appears on the left. Figure 6 makes the first point concrete. Drag the sliders and compare each loss with the share of the whole page that is wrong.
Because the losses are fractions of the predicted mask, they are scale-invariant. A phrase mask that spills 40% of its area onto a graphic gets the same penalty as a block mask that spills 40% of its area. A per-pixel loss averaged over the page would see the phrase error as a few hundred wrong pixels among a million and barely react. The falling BCE and Dice weights point the same way: small masks get more weight. One reading of the design is that both document losses act mainly as strong, targeted penalties on the errors that small masks make.
The remaining training details are conventional. The optimiser is AdamW with a learning rate of 2×10−6, 3% warmup, cosine decay and gradient clipping at 1.0. Training runs with full fine-tuning on 64 H100 GPUs with DeepSpeed ZeRO-3 and an effective batch size of 128. M3Grounder is trained on GroundingDocQA together with subsets of general document VQA datasets, so that it keeps its question-answering ability while it learns to ground.
Where the training data comes from
Training this model needs about two million questions, each with answer spans and three nested masks per span. No such dataset existed. Existing document grounding datasets are mostly extractive and use boxes, and none has the hierarchy needed for multi-granular grounding. Hand-labelling at this scale is not realistic. So the data has to be generated, and the question is how to generate it without the generator itself typing coordinates.
The direct route, and why we avoided it
The obvious generator is a strong VLM: show it the page and ask for a grounded question and answer. That puts every job in one coupled step. The model must read the text, infer the layout, recover the structure, reason, write the question and then type a box. If any step is wrong, nothing shows it. The box is a guess like any other output.
Perception first, reasoning second
For the 140K text-rich documents in GroundingDocQA, we split the jobs. REPLICA first rebuilds each page as FID-HTML (see the REPLICA post). In FID-HTML every element has an ID, its exact text, its place in the tree, its position and its style. A language model (gpt-oss-120b) then reads the HTML, which is the kind of text it reads best, and writes a question and answer. It cites the line-level element IDs that hold the answer, and the key phrases within them. It never sees a pixel, so it cannot invent a coordinate.
Here is the idea on a small case. A rebuilt government circular has a table row “Last date | 15 March 2024”, and the date cell has the ID e47. The language model asks “What is the last date for application?” and answers “15 March 2024”, citing e47. It writes the ID, not a coordinate. The ID leads to the box, and the box leads to the mask.
The masks then come out of the structure, not out of a model's guess:
- The line box is the box of the cited element, looked up from its ID.
- The phrase box is found by locating the key phrase inside that line.
- The block box is the element's parent in the HTML hierarchy. For tables, the cell is the phrase, the row is the line and the table is the block.
- Hi-SAM, a SAM-based hierarchical text segmenter, turns each box into a pixel mask that follows the actual text.
Two kinds of pages need different routes, because a rebuilt page is not the natural representation for them. In both, the location is known before any model writes a question.
Curved text: the mask comes first
For the 10K documents with curved and skewed text, a curved-text segmentation module first produces pixel masks. Each mask is overlaid on the image as a highlight, a visual prompt in the style of Set-of-Mark. A VLM (Qwen2.5-VL) then writes questions only about the highlighted text. The mask exists before the question, so no box-to-mask step is needed.
Charts: the renderer already knows the boxes
For the 50K charts, we start from public chart datasets that come with plotting scripts. Running each script with the plotting libraries' renderer functions intercepted logs every bar, tick, legend and title with its box and an ID. A VLM sees the chart and this ID-tagged record, and writes QA pairs that cite element IDs. The IDs map back to boxes, and Hi-SAM turns them into masks. Figure 7 walks through all three pipelines.
Every generated pair then passes two checks. The first checks alignment: the text of each answer span is compared, by sentence-embedding similarity, with OCR of the region its mask covers. Pairs with low similarity are removed. The second checks facts: for text documents, an LLM judge reads the document's HTML and the QA pair and decides whether the answer is supported. Pairs that fail are discarded.
How grounding is scored
Existing document QA grounding benchmarks annotate evidence with boxes only, so none could score masks at three granularities. We built GroundingDocQA-Bench. It has 2.5K documents and 5K QA pairs, drawn from private sources and from the test sets of public document datasets. It covers text-rich pages, charts, reports, forms, tables, webpages and infographics, and documents with curved and skewed text were included on purpose. 70% of the QA pairs have straight text and 30% curved or skewed text. 2,820 are single-span and 2,180 multi-span. QA pairs were generated with the data engine, then manually curated and verified; in the talk we describe every mask as checked by a second annotator.
Grounding is scored as F1 at IoU > 0.5. For multi-span answers, predicted and true regions are paired by bipartite matching before counting hits. The benchmark reports single-span F1 (SS), multi-span F1 (MS), F1 on the curved and skewed subset (CS), and overall grounding F1 (F1g). Answer quality (AQ) is scored with G-Eval, an LLM-based evaluation of the answer text.
Three external benchmarks test generalisation, all with box annotations. On BoundingDocs (a cleaned test subset of 1K documents and 3K QA pairs) and DOGR-Bench (0.2K documents and 1.1K QA pairs), grounding is F1 at IoU > 0.5, and AQ uses G-Eval. On MMDocBench (2.4K documents and 4.3K QA pairs), the official protocol uses IoU for regions, and exact match and word-level F1 for answers.
Comparing box models with mask models needs a conversion rule. If a model predicts boxes and the benchmark has masks, each box is rasterised into a mask. If a model predicts masks and the benchmark has boxes, each mask is replaced by its tightest enclosing box. All cross-benchmark comparisons in the paper are at phrase level.
Results
Both variants of M3Grounder set the state of the art on all four grounding benchmarks. On GroundingDocQA-Bench, M3Grounder-Q reaches 79.0 grounding F1. The strongest zero-shot model, Gemini-2.5-Pro, reaches 43.4. GPT-5 reaches 4.5. Qwen3-VL-8B, the same backbone, climbs in two steps: 12.8 zero-shot, then 60.6 after fine-tuning on our data with box outputs. The M3Grounder architecture takes it to 79.0. On the external benchmarks, M3Grounder-Q moves the best prior result from 70.0 to 81.4 on BoundingDocs (prior best: Gemini-2.5-Pro), from 66.4 to 73.3 on DOGR-Bench (prior best: DOGR at the same 8B scale), and from 49.4 to 68.2 IoU on MMDocBench (prior best: Gemini-2.5-Pro). Figure 8 shows every model on every metric.
The curved and skewed split shows the largest gap, as the shape argument predicts. M3Grounder-Q scores 85.3 there. The fine-tuned Qwen3-VL scores 38.3 and Gemini-2.5-Pro 32.1. A box around curved text often cannot reach IoU 0.5 even when it is perfectly placed, so box models are capped by geometry, not only by understanding. Multi-span grounding is the next largest gap: 63.5 for M3Grounder-Q against 37.7 for the fine-tuned Qwen3-VL and 14.0 for Gemini-2.5-Pro.
Scores rise with granularity. M3Grounder-Q reaches 79.0 F1 at phrase level, 81.37 at line level and 87.5 at block level. M3Grounder-I reaches 71.3, 74.9 and 82.5. The paper reads this as the model using wider spatial context. The derivation in the first section suggests a second, simpler contributor: under IoU > 0.5, larger regions tolerate larger absolute errors, so the same model scores higher on them.
Grounding did not cost much general document understanding. Across ten standard document benchmarks, M3Grounder-Q scores 92.1 on DocVQA, 79.6 on InfoVQA, 83.9 on ChartQA and 85.3 on TabFact, and is best or second best among the 8B models compared on eight of the ten.
Data versus architecture
Is the gain from the data or from the architecture? Table 1 lets us separate the two, because it reports the same 8B backbone three ways. Zero-shot, it barely grounds. Fine-tuned on GroundingDocQA with box outputs, it gets much of the way. With the M3Grounder architecture on the same data, it gets the rest. The hub post summarises this as “data brings the backbone into the task; the architecture closes the rest”. Splitting the score by evidence type shows which rest the architecture closes.
For the Qwen3-VL-8B backbone, data does most of the work on single-span evidence: single-span F1 goes from 15.7 to 68.1 with data, then to 84.2 with the architecture. On curved and skewed evidence the order flips. Data takes it from 11.6 to 38.3. The architecture takes it from 38.3 to 85.3, a gain of 47 points. Multi-span sits in between: 3.8 to 37.7 with data, then to 63.5. The InternVL3.5-8B backbone shows the same pattern, with curved and skewed F1 rising from 33.7 to 81.7 with the architecture.
What the ablations teach
Table 4 of the paper removes one design choice at a time from M3Grounder-Q. It reports phrase-level F1 on the three external benchmarks and F1 at all three levels on GroundingDocQA-Bench. Pick an ablation in Figure 10 to compare it with the full model.
| Setting | BoundingDocs | DOGR-Bench | MMDocBench | GDQA phrase | GDQA line | GDQA block |
|---|---|---|---|---|---|---|
| Phrase-level training only (no hierarchy) | 74.8 | 58.2 | 54.7 | 71.3 | not reported | not reported |
| One shared MLP + SAM | 64.2 | 61.7 | 53.5 | 63.6 | 69.3 | 77.6 |
| ℒlm + ℒseg | 78.3 | 70.1 | 65.6 | 74.0 | 77.6 | 84.4 |
| ℒlm + ℒseg + ℒhier | 80.1 | 72.8 | 67.4 | 78.2 | 79.1 | 84.7 |
| ℒlm + ℒseg + ℒbleed | 79.6 | 72.4 | 67.7 | 77.3 | 78.7 | 86.5 |
| LoRA on attention projections | 62.4 | 54.8 | 52.7 | 61.5 | 67.3 | 75.7 |
| M3Grounder-Q (full) | 81.4 | 73.3 | 68.2 | 79.0 | 81.4 | 87.5 |
How to read this table: every row except the last removes or changes one thing. The external benchmarks are scored at phrase level only. Compare each row with the last one, and look at which column moves the most.
Coarse supervision improves fine grounding
Training only at phrase level, with no line or block targets, lowers phrase-level F1 on GroundingDocQA-Bench from 79.0 to 71.3. The drop is larger on DOGR-Bench, from 73.3 to 58.2, and on MMDocBench, from 68.2 to 54.7. These are phrase-level evaluations. The model was asked for less, and it got worse at the one thing it was still asked for.
One prompt cannot serve three granularities
Replacing the three granularity heads with SAM's default, a single shared MLP that produces one prompt for all levels, gives 63.6 at phrase level on GroundingDocQA-Bench. That is lower than phrase-only training (71.3), and the full model gets 79.0. Asking one prompt to stand for three different regions is worse than not asking for granularity at all.
Full fine-tuning matters most for the finest masks
Applying LoRA to the attention projections, instead of full fine-tuning, lowers every score. The drop is largest at phrase level: 79.0 to 61.5 on GroundingDocQA-Bench, against 87.5 to 75.7 at block level. The paper concludes that precise grounding, especially at fine granularity, benefits from updating all parameters.
Examples on real documents
Figure 11 shows four outputs from the project's interactive demo: a financial filing, a legal agreement, a transcript and a chart. Each answer cites two or three spans. Switch the granularity to see the phrase, line and block regions of each span.
Question
M3Grounder
Two patterns are visible. In the legal agreement, each cited span runs across a line break, so its phrase region is two pieces while its block is one; a single box per span would have to include the end of one line and the start of the next. In the transcript, the grade “HD” is two characters, but its line is the whole course row and its block the whole table, so the three granularities answer three different questions about the same fact.
Comparison with prior grounding methods
The table below compares approaches along the aspects this post introduced: what the evidence is, how it is expressed, whether one answer can cite several regions, whether granularity is controlled, whether the location is learned end to end, and whether the method was built for documents.
| Approach | Evidence form | How location is expressed | Several regions per answer | Granularity | Irregular shapes | Location learned end to end | Built for documents |
|---|---|---|---|---|---|---|---|
| Coordinates as text (Kosmos-2, Shikra, Florence-2, Qwen2.5-VL) | Box | Typed coordinates or location tokens | Yes, one box per span | Not controlled | No | Yes, as next-token prediction | No, general |
| Hybrid region models (Ferret) | Box out; free-form regions in | Typed coordinates plus region features | Yes | Not controlled | As input only | Yes | No, general |
| Document box grounding (DocOwl 1.5, TextMonkey, DOGR) | Box | Typed coordinates | Yes in DOGR | Several levels as separate tasks, one per answer | No | Yes, as next-token prediction | Yes |
| Frontier VLMs zero-shot (Gemini-2.5-Pro, GPT-5) | Box | Typed coordinates | Yes when prompted | Not controlled | No | not reported | No, general |
| OCR + matcher + SAM chain | Mask | Answer string matched to OCR boxes | Only if every string matches | Whatever OCR returns | Yes, if a prompt arrives | No, fixed tools | Partly |
| LLM + segmenter for natural images (LISA, GLaMM, PixelLM) | Mask | Hidden state of a segmentation token | GLaMM and PixelLM: yes; LISA: one target | Not controlled | Yes | Yes | No, natural images |
| M3Grounder | Mask | [GROUND] hidden state, three projection heads, SAM | Yes, one token per span | Phrase, line and block for every span | Yes, with bleed suppression | Yes | Yes, with document losses and data |
How to read this table: going down, the location moves from typed text to a learned vector, and the evidence from a rectangle to a mask. Only the last row combines masks, several regions, controlled granularity and end-to-end learning on documents. That combination is the first-of-its-kind claim, stated precisely.
Cost, failure modes and limits
Compute. Masks cost more than boxes. The paper states this as a limitation. In practice the added inference cost is modest, about 63 ms per sample for grounding, because the image encoder is shared. Training is the larger cost: full fine-tuning of an 8B model on 64 H100 GPUs, since LoRA loses most at the finest level.
Failure modes the losses target. The two document losses exist because of two observed failures. SAM spills from text onto neighbouring graphics, as with the bar beside “1 billion active users”. And the three masks of a span can disagree: a phrase mask that overflows its line, or a line mask that runs into the next column. The losses reduce these failures; they do not forbid them, since they are soft penalties.
Single page. M3Grounder works on one page at a time. Evidence that spans a page break, or a question that needs two pages, is out of scope. The paper names multi-page and long-context grounding as open directions.
Metric limits. F1 at IoU > 0.5 is coarse, as discussed above. Answer quality is judged by an LLM, which is practical at this scale but is itself a model. Cross-benchmark comparisons are at phrase level and pass through box-mask conversion.
Availability. At the time of writing, the project page links the code and a demo, and lists the dataset and models as coming soon.
Where M3Grounder sits in the research loop
M3Grounder is where the series' second idea first becomes a model. The hub post argues that grounding as autoregressive box text is brittle, and that a VLM and SAM should be joined end to end, with the VLM deciding what to ground and at what granularity, and SAM marking where. M3Grounder is that argument made concrete for document question answering.
It also shows the series' third idea, the division of tasks between modules, at two levels. Inside the model, the language model reasons and the segmenter draws, and the grounding token is the interface that carries the right signal between them. Inside the data engine, REPLICA perceives, a language model reasons over FID-HTML, and Hi-SAM shapes. Each component does what it is good at.
And it is the first payoff of the loop. REPLICA's faithful reconstructions made 140K of GroundingDocQA's 200K documents possible without anyone drawing a box. The next posts build on M3Grounder directly. DoCoG grounds every step of a chain of reasoning, where the pointers of different steps must agree, so it adds a module that lets grounding tokens attend to each other. DocLayout-VL grounds the whole page as a tree, and carries M3Grounder's two priors over to it: enclosure becomes containment, and bleed suppression becomes a background loss. DocLayout-VL in turn feeds back into REPLICA, replacing its ensemble of layout detectors.
For the broader context on VLM grounding, see When Language Must Point. For how VLMs read documents in general, see How VLMs Read Documents. For why IoU thresholds and LLM judges need care, see Measuring What a VLM Can Do.
Key insights and nuances
- Small evidence is fragile under typed coordinates. A shift of a third of a side breaks IoU 0.5, so a 14-pixel line tolerates under 5 pixels of error. (How grounding works today)
- Masks fix shape, not localisation. On straight lines box and mask degrade alike; the gap is on curved, rotated and multi-span evidence. (How grounding works today)
- String matching is the weak joint. It breaks chained inference and older data generation alike; learned tokens and element IDs remove it. (Why not chain two tools)
- Grounding cost grows with decoder calls. SAM's image encoder runs once per page, so extra spans and granularities are cheap; about 63 ms per sample in total. (The architecture)
- A structural loss only helps the outputs it touches. Enclosure lifts phrase F1 by 4.2 points and block F1 by 0.3, because block masks never appear as the finer mask. (Two document-specific losses)
- Give the data generator something to cite. FID-HTML lets an LLM copy the page's exact words and cite an element ID instead of locating evidence. (Where the training data comes from)
- Data teaches what to ground; architecture decides what can be drawn. Data lifts single-span F1 by 52 points; the architecture lifts curved-text F1 by 47. (Data versus architecture)
- Coarse supervision improves fine grounding. Dropping line and block targets costs 7.7 points at phrase level, and 15.1 on DOGR-Bench. (What the ablations teach)
- One prompt cannot serve three granularities. A shared head scores below phrase-only training. (What the ablations teach)
- Box benchmarks measure finding, not shape. Masks are converted to boxes there, and F1 at IoU 0.5 hides mask tightness. (How grounding is scored)
- Grounding does not improve the answers. Answer quality and DocVQA are slightly below the base or fine-tuned backbone; the gain is checkable evidence. (Results)
- Fine masks need full fine-tuning. LoRA costs 17.5 points at phrase level, so adaptation is expensive. (What the ablations teach)
References
Grouped by topic, the paper first. Every entry links to its primary source.
The paper
- M3Grounder: Mask-Based Multi-Span and Multi-Granular Grounding for Document QA · Venna, Gunda, Jinka, Rachakonda, Srinivasan, Sarvadevabhatla. CVPR 2026, poster, pp. 23685–23695 (poster page)
- M3Grounder project page · with the architecture walkthrough, slides and video
- Also presented at CVPR 2026 workshops: DataMFM, MMFM5 and GRAIL-V (Highlight)
The series
- REPLICA: An Agentic Framework for Visually Faithful Document Reconstruction · Raghuveer, Srinivasan, Venna, Sreevatsa, Jain, Kukkala, Sarvadevabhatla. ICDAR 2026, oral (proceedings)
- DoCoG: Mask-based Multi-Type Grounded Chain-of-Thought for Document QA · Gunda, Jinka, Rachakonda, Jain, Venna, Srinivasan, Sarvadevabhatla. ECCV 2026, spotlight
- DocLayout-VL: A Foundational Model for Hierarchical, Open-set, and Promptable Document Layout Segmentation · Venna, Bandarupalli, Srinivasan, Raghuveer, Gunda, Sarvadevabhatla. ECCV 2026
Locations as text
- Pix2seq: A Language Modeling Framework for Object Detection · Chen et al., 2021
- Kosmos-2: Grounding Multimodal Large Language Models to the World · Peng et al., 2023
- Shikra: Unleashing Multimodal LLM's Referential Dialogue Magic · Chen et al., 2023
- Ferret: Refer and Ground Anything Anywhere at Any Granularity · You et al., 2023
- Florence-2: Advancing a Unified Representation for a Variety of Vision Tasks · Xiao et al., 2023
- Molmo and PixMo: Open Weights and Open Data for State-of-the-Art Vision-Language Models · Deitke et al., 2024
- Qwen2.5-VL Technical Report · Bai et al., 2025
- Qwen3-VL Technical Report · Bai et al., 2025
- InternVL3.5: Advancing Open-Source Multimodal Models in Versatility, Reasoning, and Efficiency · Wang et al., 2025
Segmentation and pixel grounding
- Segment Anything · Kirillov et al., 2023
- Hi-SAM: Marrying Segment Anything Model for Hierarchical Text Segmentation · Ye et al., 2024
- LISA: Reasoning Segmentation via Large Language Model · Lai et al., 2023
- LISA++: An Improved Baseline for Reasoning Segmentation with Large Language Model · Yang et al., 2023
- GLaMM: Pixel Grounding Large Multimodal Model · Rasheed et al., 2023
- PixelLM: Pixel Reasoning with Large Multimodal Model · Ren et al., 2023
- LLaVA-Grounding: Grounded Visual Chat with Large Multimodal Models · Zhang et al., 2023
Document grounding and benchmarks
- DOGR: Towards Versatile Visual Document Grounding and Referring · Zhou et al., ICCV 2025
- BoundingDocs: a Unified Dataset for Document Question Answering with Spatial Annotations · Giovannini et al., 2025
- MMDocBench: Benchmarking Large Vision-Language Models for Fine-Grained Visual Document Understanding · Zhu et al., 2024
- mPLUG-DocOwl 1.5: Unified Structure Learning for OCR-free Document Understanding · Hu et al., 2024
- TextMonkey: An OCR-Free Large Multimodal Model for Understanding Document · Liu et al., 2024
- DocVQA: A Dataset for VQA on Document Images · Mathew et al., 2021
Data generation, losses and evaluation
- Set-of-Mark Prompting Unleashes Extraordinary Visual Grounding in GPT-4V · Yang et al., 2023
- gpt-oss-120b & gpt-oss-20b Model Card · OpenAI, 2025
- Text Embeddings by Weakly-Supervised Contrastive Pre-training (E5) · Wang et al., 2022
- G-Eval: NLG Evaluation using GPT-4 with Better Human Alignment · Liu et al., 2023
- V-Net: Fully Convolutional Neural Networks for Volumetric Medical Image Segmentation (Dice loss) · Milletari et al., 2016
- End-to-End Object Detection with Transformers (bipartite matching) · Carion et al., 2020
- LoRA: Low-Rank Adaptation of Large Language Models · Hu et al., 2021