Local Multimodal Inference in Practice: Selecting and Deploying Four VLMs
This article walks through a hands-on approach to running multimodal inference locally. It explains why many local setups cannot accept image input (a missing multimodal projector in the launch parameters), why text-only benchmarks do not transfer to vision tasks, and how to design a controlled evaluation across two scenarios: document OCR and screenshot-to-frontend-code generation. It summarizes four shared findings from testing, then offers practical engineering advice on tiered model selection, input cleanup, output contracts, resource planning, and observability, plus notes on moving to a container platform when elastic concurrency is needed.
1. The Long-Idle “Vision” Capability
Many local inference environments are effectively half-disabled: the model runs stably and text generation is good enough, but the server never has the vision input channel enabled. The cause is usually not insufficient hardware, but a missing multimodal projector in the launch parameters.
In mainstream local inference frameworks, the pure language model weights and the vision encoder are separate. The former handles language modeling; the latter encodes an image into a sequence of tokens. The bridge between them is a small but essential projector weight file. If it is not explicitly loaded at startup, the service accepts text-only requests, and image input is either ignored or rejected. A representative launch looks like this:
local-infer-server \--model llm-weights.gguf \--mmproj vision-projector.gguf \--ctx-size 8192 \--n-gpu-layers 99
This is like using a camera-equipped device only for phone calls. Once the parameter is added, the same service immediately supports mixed text-and-image input, with no need to swap the inference engine.
2. Why Multimodal Models Need Their Own Evaluation
Conclusions from text-model evaluations rarely transfer to multimodal scenarios, for three reasons:
- The vision branch adds extra VRAM and compute overhead, so a context length that previously fit may have to be shortened.
- An image is split into tiles and expanded into a large number of visual tokens; long images and dense tables consume the context budget quickly.
- Models differ greatly in how they trade off recognition accuracy against structured-output stability. A model strong on text-only tasks does not necessarily produce reliably parseable structured results.
Selection therefore has to return to the specific task, with horizontal comparisons run in a unified environment on identical inputs.
3. Test Environment and Method Design
Keep a single variable fixed: the same 24G-class consumer GPU, the same quantization level, the same context length, and the same sampling parameters, changing only the model and projector weights.
Scenario 1: document text recognition. The input is a screenshot containing a multi-column table and multi-level headings. Metrics include character-level accuracy, how faithfully row and column structure is reproduced, and whether the output can be parsed directly by downstream programs.
Scenario 2: converting UI screenshots into frontend code. The input is screenshots of a self-built web application. Metrics include layout structure fidelity, consistency of style details, the proportion of generated code that runs, and the first-pass success rate.
Public leaderboard scores are only useful for initial screening. Leaderboards typically use a single image, a single concurrent request, and ideal input conditions, which differ markedly from skewed photos, low resolution, and seal or stamp occlusion in real business use. Measured results often disagree with leaderboard ordering.
4. Observations and Shared Conclusions
Observation 1: purpose-built recognition models have a clear advantage in text-dense and tabular scenarios. They are usually optimized specifically for layout analysis, table structure, stamps, and handwriting, and their output is closer to markup text that can be consumed directly, with a lower character error rate than general-purpose vision language models.
Observation 2: general-purpose vision language models cover the “understand + generate” chain more completely. For screenshot-to-code work, they can infer component hierarchy, spacing, and color intent at the same time, producing code whose structure is closer to human-written code. However, on very long tables and mixed-language content, they tend to merge or skip rows.
Observation 3: structured-output stability is a hidden barrier to production deployment. If the output format is unstable across repeated runs on the same input, the parsing layer needs a large amount of fallback logic. In practice, constrain decoding, fix the prompt template, and where necessary validate results and retry to make output converge.
Observation 4: throughput is strongly tied to VRAM. The number of visual tokens grows with image resolution and the tiling strategy, and when long context is combined with high concurrency, time to first token rises noticeably. The sensible approach is to reduce input resolution, cap the maximum number of tiles, and plan the resource budgets of the vision branch and the text branch separately.
5. Practical Engineering Recommendations
- Tiered selection: route recognition tasks to purpose-built recognition capability and understanding/generation tasks to general-purpose multimodal capability, chaining them into a two-stage pipeline when needed.
- Input governance: apply denoising, deskewing, and scaling uniformly, and keep the long edge of the image within a model-friendly range. This significantly reduces cost and improves stability.
- Output contracts: define a strict output template for each task type, with validation and limited retries, so downstream parsing does not break.
- Resource planning: stress-test peak VRAM at the target context length before deciding concurrency; if VRAM is insufficient, lower the quantization level or the tile limit first.
- Observability: bring time to first token, generation rate, failure rate, and parse failure rate into monitoring, alerting, and logging to form a continuous tuning loop.
6. Filling the Gaps in the Cloud
A local environment suits validation and low-concurrency use. When elastic concurrency, longer context, or unified operations are required, the inference service can be moved onto a container platform, with object storage used to archive evaluation images and results, a message queue used to smooth traffic spikes, and monitoring, alerting, and logging used to locate long-tail issues. Baidu AI Cloud offers corresponding product categories for these general capabilities and they can be combined as needed, while the models and evaluation methods themselves stay platform-agnostic, which makes later migration easier.
7. Summary
What gets overlooked is never the hardware, but the vision projector parameter that was never enabled, and the absence of a scenario-based evaluation method. Open the input channel first, then run two typical task types in a unified environment, and finish with output contracts and resource observability. That is how local multimodal inference moves from “it runs” to “it is usable.”
