Local LLM Multimodal Testing: The mmproj Projector Layer, Benchmarked on OCR and Screenshot-to-Code Tasks
This article walks through enabling vision in a local LLM by loading the multimodal projector (mmproj) layer, explains how vision-language models are built, and benchmarks the setup on two real-world task groups: document and table OCR, and turning UI screenshots into runnable code. It covers which metrics to track, what the tests actually showed, and the variables that most affect results — image resolution, visual token count, context length, quantization precision, and concurrency — plus practical advice on choosing models and shipping them locally.
Getting Started: The Loading Parameter Most People Overlook
Plenty of people run local inference frameworks for LLMs — writing code, answering questions, holding conversations — and never leave text-only mode. What they are actually missing is not a smarter model. It is a pair of eyes.
This is the default behavior: the inference service boots as a pure language model and stays that way until you attach an extra multimodal projector layer — usually called a multimodal projector, commonly abbreviated as mmproj — to the same backend. Once it is mounted, the backend starts accepting image input.
The parameter itself is unremarkable. It points to a separate projector weights file that translates the output of the vision encoder into vectors the language model can understand. Only when that file is loaded does the model genuinely gain joint image-and-text reasoning.
Think of it as buying a device with a camera and using it for phone calls for months. Now that you know the capability is there, it is worth pulling every vision-language model you have on hand and running each one against realistic scenarios.
How a VLM Actually “Sees” an Image
To understand what that parameter does, you first need the general architecture of a multimodal model. Nearly every mainstream vision-language model (VLM) today is built in three stages:
- Vision Encoder — cuts the image into patches and encodes them into a set of visual feature vectors. The usual backbone is a ViT-style structure.
- Projector / Connector — maps those visual features into the language model’s word-embedding space, so image features and text token vectors sit in the same semantic coordinate system. It can be a simple linear layer or an adapter built from learnable queries.
- Large Language Model (LLM) — receives the concatenated sequence of image vectors and text vectors, then generates an answer autoregressively.
The projector is both the key piece and the one most easily overlooked, for a simple reason: a pure text runtime never needs to load it, so inference frameworks treat it as an optional component. But as soon as you move to vision tasks, the projector is the bridge between “seeing” and “thinking.” If its quality is poor, even a very strong language model will misread the image.
Enabling It Locally: The Common Pattern
The exact flag names differ slightly between inference frameworks, but the approach is the same: main model weights plus projector weights, and the two must come from the same model family and match each other. The command below is illustrative — the parameter names exist to show intent, so always check the documentation for your actual framework.
inference-server start \--model <path to main LLM weights> \--mmproj <path to multimodal projector weights> \--ctx-size 8192 \--host 0.0.0.0 --port 8080
A few matching rules you must respect:
- The projector and the main model must be the same source and the same version. Mixing weights from different sources will leave visual features misaligned.
- The projector is usually tiny, but it noticeably changes VRAM usage and prefill cost, because it expands a single image into a large number of visual tokens.
- If you quantize the vision encoder and projector, watch for amplified precision loss on fine-grained tasks such as OCR.
Test Setup: Two Task Types, Four Models, One GPU
To stay close to real usage, I compared two scenarios that differ sharply and cover different capability dimensions:
- Test group 1 (text recognition / OCR): input is a screenshot of a document containing dense text, tables, and numbers. This checks how accurately the model reads.
- Test group 2 (screenshot → code): input is a screenshot of a web or app interface I designed myself, and the model is asked to generate runnable HTML/frontend code. This checks whether it understands the layout and reproduces it faithfully.
On hardware, a single 24GB-class consumer GPU is enough to run most mid-sized VLMs. But with long context plus high-resolution images, that ceiling is easy to hit — something I will come back to.
Test 1: OCR Parsing of Documents and Tables
Which Metrics Actually Matter
OCR is not simply “can it recognize characters.” Break it into dimensions and lean on established industry measurements:
- Character-level accuracy / edit distance — how faithfully a passage of text is reproduced.
- Table structure similarity — especially critical for tables. A TEDS-style metric based on tree edit distance works well, because it penalizes both content errors and structural errors (misaligned rows and columns, wrong judgments about merged cells).
- Field-level information extraction — for invoices and forms, the accuracy and recall of key fields such as amounts, dates, and headings.
- Hard cases — handwriting, multiple languages, stamps and signatures. These usually separate models the most.
What the Tests Showed
The general conclusion: general-purpose VLMs are adequate for standard printed documents, but error rates climb noticeably once you hit complex multi-column layouts, dense tables, or handwriting and stamp occlusion. VLMs that have been specifically optimized for OCR tend to be steadier on table structure and real-world documents. When selecting a model, do not look only at the overall accuracy number — break it down by the dimension you actually care about. If you mainly process financial invoices, watch field extraction and stamp handling closely.
Test 2: Screenshot → Runnable Code
This task demands something completely different from OCR. The model must not only recognize each element and each piece of text, but also understand the layout hierarchy, the component types, and the interaction intent — then translate that into structured code. Four dimensions are worth evaluating:
- Visual fidelity — does the generated page match the original in layout, color, and spacing?
- Structural correctness — does it use sensible semantic tags and component divisions, rather than a pile of meaningless
divs? - Runnability — can the code run as-is, without obvious syntax or dependency errors?
- Maintainability — is the generated code clear and easy to edit a second time?
A common pattern in practice: models reproduce the visual appearance reasonably well, but struggle with complex interactions such as dropdowns, modals, and linked state; simple static pages come out with high completion, while the longer the page and the more components it has, the more obvious the omissions and misplacements become. So evaluate with sufficiently complex real screenshots, not a simple login form.
Key Variables That Affect Multimodal Results
Even among models that “can see images,” differences often trace back to a few factors that get overlooked:
- Image resolution and visual token count — most frameworks resize images into a fixed size range. Higher resolution means more visual tokens, which means finer recognition, but VRAM use and prefill time rise roughly linearly. Small text and dense tables need higher resolution; long documents force a trade-off with context length.
- Context length — visual tokens eat into the text context budget. The larger the image, the less room is left for conversation or long documents, and in extreme cases it overflows.
- Quantization precision — quantizing the main model or the projector to save VRAM has limited impact on text tasks, but errors are amplified in OCR and fine-grained recognition. Prefer higher precision for critical scenarios.
- Concurrency and throughput — a single GPU gets tight on VRAM with high resolution plus multiple concurrent requests. Load-test in production to find a safe concurrency ceiling, and use queuing or rate limiting where necessary.
Selection and Deployment Advice
- Choose per task; do not expect one model to do everything. For document and invoice work, prioritize strong dedicated OCR capability. For screenshot-to-code work, prioritize a balance of layout understanding and code generation.
- Build your own evaluation set. Public leaderboards are only a reference. What you should really run are the actual images from your own business, scored by dimension, forming a reproducible baseline.
- Balance VRAM and precision. Get it working first, then optimize. Confirm that the projector and main model versions match before you start tuning quantization and resolution.
- Pay attention to engineering support. Image input magnifies preprocessing and storage pressure. Use object storage for assets, and track VRAM and latency with monitoring and alerts so that production behavior stays observable and traceable.
Wrap-Up
For local deployment, the barrier to multimodal capability usually lies not in “should I swap models,” but in “did I actually load the projector parameter.” Once you understand the three-stage division of labor — vision encoder, projector, language model — and use OCR plus screenshot-to-code as your yardsticks, measuring each by dimension, you move past the vague question of “which model is strongest” toward selection decisions that genuinely fit your business. As a next step, try running your most realistic image through it again.
