All articles

Multimodal Models in Production: Evaluate Text, Images and Documents Together

Build multimodal evaluation around faithful preprocessing, document layout, cross-modal reasoning, grounded answers and the cost of each successful task.

A document, photograph and text prompt converge on an evaluation grid for reading, layout, reasoning and safe responses.

A multimodal model does not turn an attached document into reliable evidence merely by accepting it. Between upload and answer sit image decoding, resizing, page selection, possible OCR and a language model that can fill gaps with plausible text. Each stage can remove or invent the detail on which an answer depends. Production evaluation must therefore follow the evidence through the whole pipeline.

This article concerns image and document understanding: extracting, describing and reasoning about supplied material. Image generation is a separate output task with different quality and safety tests. GPT-4V accepts user images with text instructions; Gemini 1.0 was trained jointly across text, images, audio and video. Neither capability makes an input self-explanatory. The useful release question is narrower: can this configuration answer the application’s questions from the evidence actually preserved?

Preprocessing determines what the model can know

Start with an input contract, not a prompt. Record accepted file types, page and pixel limits, orientation rules, colour handling, maximum document length and behaviour on encrypted or corrupt files. Keep the source artefact and a trace of every derived image or text segment. Without that lineage, a wrong answer cannot be assigned to perception, extraction or reasoning.

Resolution is a quality and compute decision. Downsampling a dense page can erase small type, punctuation and chart marks; aggressive cropping can detach a value from its heading. Gemini’s report explicitly describes variable input resolution as a way to spend more compute on fine-grained understanding. Treat that as an engineering control to measure, not a promise that more pixels always improve an answer.

Documents add structure that a flat image caption misses. A table cell inherits meaning from its row and column; a tick box depends on its label; a footnote modifies text elsewhere on the page. For multipage files, test whether the selected pages contain the required evidence and whether references cross page boundaries. Preserve page numbers and coordinates alongside rendered pages so that an answer can lead a reviewer back to the source.

Preprocessing also needs adversarial cases: rotated pages, skewed scans, faint contrast, handwriting, mixed alphabets, redactions and near-duplicate forms. These are not decorative robustness checks. They define whether the system should process, request a better input or stop.

OCR is evidence with geometry, not a clean transcript

External OCR can expose exact strings to a text model and provide a useful comparison with direct image input. TextVQA made this division explicit: its LoRRA system combined visual features with OCR tokens and could either copy recognised text or choose an inferred answer. The design shows why reading and reasoning need separate attention. A correctly recognised label may still be the wrong label for the question.

OCR output is not interchangeable with the page. Serialising tokens from top left to bottom right can interleave table columns, separate keys from values and discard the position of a signature or stamp. DocVQA’s questions draw on forms, tables, figures, handwriting and layout, and its baseline comparisons show different systems succeeding on different cues. Keep bounding boxes, reading order, line and cell relationships, and links back to the image region.

Run both routes where the choice matters: pixels alone, OCR-assisted input, or a combination. Gemini 1.0’s image results were reported without an external OCR engine, which demonstrates that direct visual processing is viable; it does not make OCR redundant for every application. Measure character errors on critical fields as well as final answers. A minor spelling change may be harmless in a description but decisive in an account number.

Pipeline from source images and documents through structure-preserving preprocessing and cross-modal tasks to groundedness, safety, latency and cost release gates.
Evaluate the complete path from source to answer. Preserved coordinates connect extracted text to its visual context, while separate task and release gates expose where a failure entered the system.

Test the dependence between modalities

A useful suite should contain tasks that cannot be solved from the prompt’s wording or a generic caption alone. Organise it by required operation rather than by a single aggregate score:

  • Perceive: locate objects, symbols, legends and small text under realistic image quality.
  • Extract: reproduce exact fields, quantities and dates, including cases with several similar candidates.
  • Relate: connect a label to a diagram part, a value to its table headers, or a question to the correct page.
  • Reason: combine visual evidence with supplied instructions and domain knowledge.
  • Abstain: reject missing, illegible or insufficient evidence instead of completing a familiar pattern.

Public benchmarks help seed this matrix. TextVQA tests reading in natural images; DocVQA moves into document structure; Gemini’s evaluation adds ChartQA and InfographicVQA for charts and layout, and MMMU combines heterogeneous images with specialist knowledge and reasoning. MMMU’s error analysis usefully separates perceptual, knowledge and reasoning failures. That is more actionable than one multimodal score.

Application cases still decide release. Build paired examples in which one relevant detail changes while the rest stays fixed: two totals in similar invoices, a swapped chart legend, or the same question with its supporting region obscured. Add image-order permutations and conflicting text–image evidence. GPT-4V’s red teaming found sensitivity to input image order, so order belongs in the test harness rather than in an assumption.

Match the metric to the error. Use exact matching for identifiers, explicit tolerances for numeric extraction, and human review for whether an explanation follows from the cited region. Report slices by document type, language, quality and operation. Gemini’s own comparison table warns that zero-shot and task-fine-tuned results are not always like for like; production comparisons need the same discipline about prompts, tools and preprocessing.

Ground answers and test image-borne attacks

Groundedness has two parts: whether the answer is supported and whether the system can show where that support came from. Require source page and region references for consequential fields, then check the reference itself. A fluent citation to the wrong cell is another failure, not evidence of reliability. When the source lacks an answer, the desired output is an explicit unknown or a route to review.

GPT-4V’s system card supplies concrete failure modes for this suite. Red teamers observed merged neighbouring labels, missed symbols, weak spatial interpretation and confident factual errors. Its ungrounded-inference tests concern conclusions not justified by the image or prompt. Separate these from knowledge errors: a model can recognise every element and still make an unsupported claim about what they imply.

Safety tests must cross the same boundary. Text-only filters cannot see instructions rendered in a screenshot. OpenAI evaluated known jailbreaks converted into images and added OCR-based moderation for overlaid text as one system-level mitigation. Reproduce that attack class with application-specific prompts, including cases where image and text are benign alone but harmful together. Test benign refusals too; a control that blocks every document containing prohibited words may make the service useless.

High-stakes outputs need containment beyond a refusal score. Restrict what the model can trigger, require independent validation or human approval where errors carry serious consequences, and preserve the reviewed source region with the decision.

Price successful work, not accepted input

Measure latency from upload to usable answer. Include file decoding, page rendering, OCR, model prompt processing, output generation, validation and retries. Report typical and tail latency at representative page counts and resolutions. A fast response on one cropped image says little about a dense multipage request.

Model choice belongs in the same measurement. Gemini 1.0 distinguishes Ultra, Pro and Nano deployment targets rather than implying one cost curve. Test those deployment options at representative resolutions and page counts; a configuration earns its place only by improving passed tasks enough to justify its processing cost.

Compare candidates on cost per task that passes correctness and safety gates. Route simple extraction to the cheapest sufficient path, reserve higher resolution or a stronger model for cases that need them, and cap retries. Keep failed requests in the account. The production system is ready only when its evidence, refusal and escalation behaviour survive the same tests as its answers.

Sources and further reading