Local Multimodal Inference in Practice: The Overlooked Vision Adapter and a Four-VLM Test
Local LLM inference defaults to text-only because vision capability ships as a separate component that has to be loaded at startup. This article explains how vision-language models (VLMs) attach to a base language model through a projector adapter, and walks through confirming that a matching adapter exists, loading it, calling the image-text API, and verifying that the model actually sees the image. It then benchmarks four VLMs — OCR, receipt field extraction, multilingual screenshots, and screenshot-to-page generation — under a unified methodology, and turns the findings into practical guidance on preprocessing, context budgeting, indirect prompt-injection safety, and a five-step pipeline.
I run open-source inference locally, paired with a model in the tens-of-billions parameter range that I use mainly for writing code, reading documentation, and refactoring. Most day-to-day work is fine with it, but one class of tasks kept tripping me up: I had to transcribe stack traces from error screenshots by hand, type tables from requirement documents into code cell by cell, and translate UI design mockups into page structure by eye alone. My first instinct was “the model just isn’t capable enough,” so I swapped prompts, changed sampling parameters, and retried over and over. One day, while reviewing my startup flags, I noticed an option I had never enabled: loading a multimodal projector file that pairs with the language model. I added it, restarted the service, dropped a screenshot into the conversation, and for the first time the model actually “saw” the image.
1. What you overlook isn’t a flag, it’s an entire capability
By default, local inference “can’t read images” — usually not because the base model can’t see them, but because the vision capability ships as separate components that must be loaded explicitly at startup. There are three reasons for this:
- Separation of form: Most mainstream open-source vision-language models use a “vision encoder + projector + language model” structure, with the three components published separately and quantized separately so they can be combined on demand.
- Resource sensitivity: Text-only users don’t have to spend VRAM on an idle vision encoder, while vision-heavy scenarios can control image resolution and tiling strategy on their own.
- Version binding: The projector corresponds one-to-one with a specific language model’s weights, tokenization, and layer structure, so the inference service can’t guess which one to load for you.
For the user, this creates a very practical problem: for the same local inference service, the capability boundary is set by the startup flags, not by the model name. If you only look at the model name and skip the parameter documentation, it’s easy to mistake “unconfigured” for “unsupported” and burn time retrying in the wrong direction.
To avoid stepping on that rake again, I picked up two habits. First, after every framework upgrade or model swap, I re-read the startup flag list, paying particular attention to options that directly determine the capability boundary: adapter loading, context length, GPU layer allocation, concurrency, and quantization level. Second, I write my common configurations as startup-script templates, so adding a capability means editing the template rather than typing commands from memory.
2. How multimodal capability attaches to the language model
To understand the adapter that gets overlooked, you first need the basic structure of a vision-language model (VLM). It’s three parts connected in series:
- Vision encoder: cuts the image into fixed-size tiles and encodes them into a set of visual feature vectors.
- Cross-modal projector: maps the visual features into the word-vector space the language model understands. Common implementations include a two-layer MLP with an activation function, a resampling structure with learnable query vectors, or a cross-attention-based alignment module.
- Language model: concatenates the projected “visual vectors” with the text vectors into a single sequence and generates autoregressively as usual.
The adapter file you load separately in open-source inference frameworks is, at its core, the projector weights; some implementations bundle the vision encoder in as well. During training, this class of approach typically freezes the vision encoder and the language model and trains only the projector, which keeps the artifact small and maps it one-to-one to the base model.
This structure directly determines several rules of thumb:
- Base and adapter must match strictly. Change the language model version, quantization level, or tokenization and the original adapter may fail to load — or load successfully but degrade noticeably in output.
- Images occupy context as “visual tokens.” The higher the resolution and the more tiles, the more visual tokens, and the smaller the window left for conversation and output.
- The model only sees the encoding result. An image’s clarity, tilt, contrast, and the separation of text from background first affect the quality of the vision encoder’s input, and only then the final answer.
3. Wiring up vision: loading, calling, and acceptance testing
3.1 Confirm the base has a matching multimodal version
Not every language model has a matching vision component. First confirm whether the model publisher also provides the adapter, and which model version and quantization format it corresponds to. The documentation is the only reliable source. Guessing from words like “vl” or “vision” in the model name, or forcing another model’s adapter to fit, often leads to dimension mismatches at startup or, worse, silent failure.
3.2 Load the adapter
Most local inference services take the adapter path as a startup flag. Depending on the implementation it might be called an adapter, a projector, or a multimodal projector, but the essence is the same: loading the file also establishes the concatenation relationship between visual tokens and text tokens. For example:
# Text-only mode: the inference service reads only the text parts of the messagesserve_model --model ./llm_base-Q4.bin --ctx-size 8192# With a vision adapter: images first pass through the vision encoder, then are projected into visual tokens that take part in inferenceserve_model --model ./llm_base-Q4.bin \--vision-adapter ./llm_base-vision-adapter.bin \--ctx-size 16384 \--host 0.0.0.0 --port 8080
After a successful start, the service log usually prints vision-related loading information, such as the vision encoder’s hyperparameters (image size, number of tiles) and a note that the projector has been loaded. The most direct source of truth is always the official documentation for the version you’re using: flag names, adapter format, and image-size limits should follow the current version’s notes.
3.3 How to send image-text requests
Local inference services usually expose an HTTP API in the style of mainstream chat-completion endpoints, where the message content is an array of “text blocks + image blocks,” and images can be passed directly as base64 data URLs. The following example extracts a table from a screenshot:
{"messages": [{"role": "user","content": [{"type": "image_url","image_url": { "url": "data:image/png;base64,<BASE64_DATA>" }},{"type": "text","text": "Extract the table from the screenshot. Output only a Markdown table, no explanation; represent merged cells with empty values."}]}],"temperature": 0.1,"max_tokens": 2048}
Some implementations require a placeholder marker (such as <image>) to explicitly indicate where the image sits within the text, so that multi-image ordering, image-text interleaving, and “asking about a specific region” can be controlled. Here too you should follow the conventions in the corresponding documentation. Which message an image belongs to and where the placeholder goes directly affect how the model understands the correspondence between the question and the picture.
3.4 Acceptance: make sure the image is really “seen”
Loading successfully is not the same as calling correctly. I recommend three levels of testing to confirm things layer by layer:
- Wiring test: give it a solid-color image with only a few random keywords and ask “what’s written in the image.” A correct answer means the image is genuinely taking part in inference.
- Capability test: use cleanly printed tables, plain-text screenshots, and simple UI images, and check layout restoration and field completeness.
- Boundary test: try very high resolutions, vertical text, handwriting, and low-contrast scans, and record the server’s error behavior and downsampling.
4. Testing on the same footing: methodology
I had four usable vision-language models on hand: two small-to-medium general-purpose ones and one flagship general-purpose one in the tens-of-billions range, covering different sizes and training emphases, plus one specialized model aimed at document and table scenarios. To keep things fair, I fixed the test conditions first:
- Controlled variables: the same version of the inference service, the same quantization level, the same context length, the same image preprocessing (e.g., scaling the long edge uniformly to 1536 pixels), the same temperature (0.1) and prompt template, and the same output-length limit. Each task was repeated three times and averaged.
- Fixed task set: printed-screenshot OCR, receipt field extraction, multilingual mixed screenshots, UI-screenshot-to-page, and hand-drawn-sketch-to-page.
- Objective metrics: character error rate for OCR, recall and precision for field extraction, and “whether it renders, whether key elements are present, and the visual difference from the screenshot” for page generation. I also used “manual rework time” as an overall metric, since it directly determines whether a model can enter the workflow.
| Task | Primary metric | Small/medium general A | Flagship general | Document-specialized |
|---|---|---|---|---|
| Printed-screenshot OCR | Character error rate ↓ | Baseline | Slightly better than baseline | Best |
| Receipt field extraction | Recall / precision ↑ | Fair | Good | Good |
| Multilingual mixed screenshot | Manual rework time ↓ | Longer | Shorter | Close to the flagship |
| UI screenshot to page | First-pass rate ↑ | Lower | Higher | N/A |
| Hand-drawn sketch to page | First-pass rate ↑ | Low | Medium | N/A |
5. Results: each has its strengths rather than a single winner
5.1 OCR: resolution and preprocessing beat swapping models
Printed screenshots are the scenario where these models differ least, and they were all usable. What really opened the gap was image preprocessing: the same table screenshot, fed in as-is, often produced misaligned headers and digits running across rows, but a light upscale and contrast boost before input dropped the character error rate noticeably — and that gain held consistently across all four models.
The document-specialized model had a clear advantage on receipts, tables, and scans, restoring structure like merged cells and header hierarchy more completely. The general-purpose models were more prone to “mostly correct content, but structure invented on its own” — collapsing a multi-row header into a single row, or mixing footnotes into the data region, for example.
5.2 Information extraction: prompt constraints matter more than the model
For the same flagship model, how you write the prompt made a big difference in whether the output was usable. Ask only “what information is in this receipt?” and it produces long stretches of natural language that you then have to write parsing code for; change it to “output JSON by field name, fill missing fields with null, no explanation,” add a lower temperature, and the output can be consumed almost directly by a program.
For the small-to-medium models, the problem in this scenario wasn’t misreading so much as “not following the rules”: the occasional stray explanatory text, self-invented field names, and the total amount being repeated into the line items. The engineering fix is to add a structured-validation and retry layer on the server that sends non-compliant output back for regeneration, rather than hoping to get it right on the first try.
5.3 Screenshot to page: structure matters more than pixels, but the details test the model
This is the scenario with the biggest differences and the one that best reflects a model’s overall capability.
- Small/medium models: the layout skeleton of the generated page largely matched, but details like spacing, font size, rounded corners, and shadows often each went their own way. With complex forms or multi-column layouts they tended to drop elements or push the sidebar to the bottom. On the plus side, they output fast and suit batch drafts.
- Flagship general: the best overall restoration — grid layout, hierarchy, and the positions of the main text were largely accurate, though details like icons and color schemes were frequently invented, and a logo in the original screenshot was sometimes replaced with a placeholder graphic.
- Hand-drawn sketches: closer to “generate from intent” — every model proactively filled in styles, so the pages looked good, but their correspondence to the sketch’s structure was actually weaker. For this kind of input, the prompt should stress “strictly preserve the module positions and counts in the sketch, use default values for missing styles, and don’t add new blocks.”
This exposes a common trap in multimodal evaluation: judging only by static inspection of the “image-to-code” output makes it easy to reach the wrong conclusion that “the small models are fine too.” Only by comparing the generated page’s structure against the original screenshot, and then rendering it in a browser to check for layout overflow, do you see the real gap.
5.4 The same model at different quantization levels
The same base model also showed visible differences across quantization levels: OCR-style, character-by-character output tasks were relatively insensitive to quantization, while the stability of long-text generation and structured output dropped. In practice you can allocate resources by task — use a smaller quantization for recognition tasks to raise throughput, and keep higher precision for generation tasks.
6. Turning test results into practical work
6.1 Divide and conquer: different tasks, different paths
- Batch, long-document, archival OCR: prefer the document-specialized model, paired with a unified preprocessing pipeline.
- Single screenshot to code, interface restoration: use the flagship general model, with well-tuned prompt templates and output constraints.
- High-concurrency, low-cost scenarios: use a small model for first-pass screening, and escalate low-confidence samples to a larger model for review.
6.2 Budget context separately for multimodal tasks
The most common error in multimodal chat is context overflow. A single high-resolution screenshot can contribute thousands of visual tokens after tiling, and passing several images in a row drains the window quickly. My suggestions:
- Compress everything to a resolution where “the text is just barely legible” before uploading;
- pass only the necessary images in each turn, and drop historical images from the context when they’re no longer needed;
- split long documents by page and process them page by page, then merge the results, rather than stuffing an entire file in at once.
6.3 Treat images as data, not instructions
Screenshots and documents may contain text like “ignore the instructions above.” Technically this is indirect prompt injection: the model may take the recognized text as a system instruction and act on it. In engineering terms, treat recognition results as untrusted data used only as content fill; if the output contains links, validate them against a domain whitelist; and if the generated result will be rendered directly into a page, restrict script-execution permissions.
6.4 A pragmatic pipeline
Strung together, these scattered lessons fix the local multimodal workflow into five steps:
- Preprocess: scale, denoise, boost contrast, and correct rotation where needed;
- Split: cut long documents by page, wide tables by column, and oversized images by region;
- Infer: use a low temperature, an explicit output format, and a bounded content scope;
- Validate: parse the JSON, estimate the character error rate, and check the page render;
- Retry and cache: automatically retry samples that fail validation, and cache results by image hash to avoid recomputation.
7. Conclusion: the capability boundary lives in the config, the results live in the engineering
The biggest takeaway from this whole exercise wasn’t finding “the strongest multimodal model.” It was confirming two things.
First, half of the local-inference capability boundary is written in the startup flags. An adapter that was never loaded can turn “recognizing images” into “reading disability,” and it leads people to mistake a configuration problem for a model problem.
Second, multimodal results depend far more on engineering details. Resolution, tiling, prompt constraints, structured validation, context budget — if any one of them is done poorly, switching to a bigger model only shortens rework time from an hour to half an hour.
If your local inference service has only ever been reading text, spend ten minutes checking the startup flags and the model’s companion components, then put together a set of your own real samples and run them under a unified set of conditions. That’s closer to your actual business than any benchmark leaderboard.
