Adding Image Understanding to Text-Only LLMs at Low Cost

    This article explains how to give text-only large language models image understanding without routing every request to an expensive multimodal model. It breaks down a three-layer architecture (an ingress interception layer, a middle routing layer, and a model execution layer), then covers input normalization, on-demand vision forwarding, cost and latency trade-offs, security and reliability requirements, a comparison with common alternatives, and practical rollout advice.

    In LLM applications, whether a model can “see” images often determines the ceiling of what a product can do. Many teams already run text-first models in production, but the context chain breaks at the input end as soon as a screenshot, a photo of a port, a scanned form, or a flowchart shows up. The common industry fix is to validate the input type for each request at the application layer and switch to a separate multimodal interface once an image is detected. The problem with this approach is that business code needs heavy rewriting, multimodal capability becomes deeply entangled with existing business logic, and later tuning, testing, and version upgrades all require dual-track maintenance, which is expensive.

    A more important issue is the cost structure. Routing every single request to a high-capability multimodal model forces pure text tasks to pay for image understanding they do not need. A more sensible approach is to keep the existing text model as the primary inference engine, call a dedicated visual understanding interface only when an image input actually appears, and feed its output back into the original context. The value of this route shows up not only in dispatch cost but also in capability decoupling: text inference, image understanding, and task orchestration can each evolve independently without blocking one another.

    The rest of this article uses a “hybrid multimodal request forwarding” practice as a thread, and breaks down its working principle, implementation details, and engineering considerations.

    1. Overall Architecture: A Three-Layer Decoupled Request Path

    The whole solution splits into an ingress interception layer, a middle routing layer, and a model execution layer.

    1. Ingress interception layer: placed between the application and the model interface, integrated in a way that stays compatible with existing call patterns. It identifies whether a request contains non-text content and normalizes the input.
    2. Middle routing layer: holds context state, decides whether the current round needs external visual capability, and if so builds a dedicated request to the visual understanding interface and injects the result back into the main path.
    3. Model execution layer: the text model and the visual understanding interface can be different models or service branches under the same cloud platform, or deployed in separate environments and connected through a unified network protocol.

    The contracts between these three layers should stay stable: the ingress layer only cares about input normalization and response backfilling, not which specific model is used; the middle layer only cares about dispatch and state, not internal model implementation. This separation means that when a visual capability provider is swapped later, upstream business code needs almost no changes.

    2. Input Interception and Normalization: Making Multimodal Input Acceptable to the Main Path

    The core job of the interception layer is to rewrite inputs of every shape into a text-parallel structure the main model can accept. A common practice is to insert a specific system or tool message into the existing message list, declaring that this round contains image references that need parsing, and attaching a stable internal identifier. The image itself can be passed as an object storage reference, a short link, or an internal resource identifier, avoiding large volumes of binary data in the main path.

    Illustrative interception logic:

    1. # Ingress interception: detect multimodal input and tag the image reference
    2. if request.has_multimodal_input():
    3. image_ref = storage.put(request.image_bytes)
    4. request.messages.append({
    5. "role": "system",
    6. "content": "[VISION_REF]" + image_ref + "[/VISION_REF]"
    7. })
    8. request.strip_native_image_parts()
    9. forward_to_text_model(request)

    Three details matter at this layer. First, the tag format must be globally consistent and should use marker strings that are hard to hit in normal text, to avoid collisions with user input. Second, for interfaces that do not support multimodal input, native image nodes must be stripped before forwarding, otherwise the request body will fail schema validation. Third, the storage and deletion policy for image references must be explicit; set an expiration time and clean up after the session ends to avoid long-term cost buildup.

    The middle layer needs to decide whether the current round genuinely needs image parsing. This decision cannot simply rely on “whether the input contains an image tag,” because in many scenarios the user merely attaches a file without asking the model to analyze the image content. A more robust approach is to have the middle layer first send a lightweight request to the main model in text form, letting the model itself decide whether it needs to look at an attachment. If the model signals that it needs visual information, the middle layer then builds a dedicated request, resolves the image reference into readable content, and calls the visual understanding interface.

    The middle layer’s output should be a structured parsing result, not free text. A recommended output shape:

    1. {
    2. "image_id": "ref-7f3a",
    3. "summary": "The screenshot is an error page containing request parameters and a timestamp",
    4. "details": {
    5. "text": "Readable text on the page",
    6. "layout": "Single-column modal"
    7. },
    8. "confidence": 0.86
    9. }

    On backfill, add the result above to the context as a tool execution result or system message, and keep the original image reference identifier so later rounds avoid repeated parsing. The engineering detail here is that backfilled content must be clearly distinguished from the user’s original input; otherwise the model may mistake the parsing result for user intent, which affects the accuracy of later answers.

    4. Balancing Cost and Performance

    The cost advantage of the on-demand routing approach comes from cutting wasted calls. The following strategies control spend further:

    • Cache parsing results: parse the same image reference only once within a session, and reuse the structured result in later rounds.
    • Batch merging: when multiple images appear at once, merge them into a single vision request to reduce request overhead.
    • Tiered routing: split the parsing interface into tiers by price, latency, and capability, and prefer lightweight models for low-cost scenarios.
    • Preprocessing and compression: apply moderate compression and size normalization to images at the upload step, controlling bandwidth without hurting text readability.

    What needs emphasis is that the performance cost mainly shows up as the latency of one extra request round. For real-time conversational scenarios, run vision parsing and main inference in parallel as much as possible, and use streaming output to give users visible progress feedback instead of long blank waits. For offline batch processing, you can instead use stronger parsing capability to prioritize accuracy.

    5. Security and Reliability Must Be Considered Together

    After introducing the middle layer, the trust boundary shifts: image content becomes a new input source, and parsing results enter the main model as text. Parsing output must therefore be treated as untrusted input, and instructions inside it must never be executed with high privilege. Common engineering measures include length limits and character filtering on parsing results, wrapping them in explicit delimiter markers, and declaring in the system prompt that the content is reference information only.

    On reliability, vision calls need timeout, retry, and fallback policies. When parsing fails, the whole request should not fail; instead, backfill a notice to the main model saying the image could not be parsed, so it can offer suggestions or ask follow-up questions in text form. Each forwarding should also log the path target, elapsed time, and result status for later troubleshooting and cost analysis.

    6. Comparison with Mainstream Parallel Approaches

    Three alternative routes are common in practice. The first is switching directly to a native multimodal interface at the application layer: the upside is a short path, the downside is deep business code coupling and high cost. The second is using a dedicated parsing model at the ingress layer to turn images into text: the upside is simple implementation, the downside is that it cannot re-interrogate based on the question, and one-shot parsing easily loses detail. The third is the middle forwarding approach described here, whose value lies in handing the “do we need to look at the image” decision to the model, gaining lightweight intelligence without adding business cost.

    What should be stated clearly is that this approach does not give the text model genuine native visual understanding; it provides a method for organizing capability. For high-frequency, highly interactive scenarios with extremely high demands on parsing detail, native multimodal models should still be evaluated. But for businesses with mostly low-to-mid frequency, text-first tasks, and occasional need to reference images, middle forwarding is the best balance of cost and rework savings.

    7. Implementation Recommendations

    1. Measure before going all in: pilot on a single business path, track image input share, parsing call frequency, and per-call cost, and confirm the return before expanding.
    2. Fix the protocol and tags: bring image reference tags and parsing result structures under version management as internal conventions, avoiding incompatibilities from later changes.
    3. Build a quality baseline: collect a set of representative image samples and periodically re-test parsing accuracy and latency as a basis for switching decisions.
    4. Layer security protections: filtering, isolation, and auditing of parsing content all need to land, especially clarifying data flows and retention policies for scenarios involving sensitive images.

    In summary, a hybrid multimodal path centered on middle forwarding is essentially about wrapping capability differences in a unified request protocol, letting upstream applications gain on-demand visual capability with minimal change. Its success depends not on tuning parameters of one specific interface, but on the engineering completeness of four links: input normalization, on-demand dispatch, reference injection, and security isolation. Land these links along clear layers, and even non-vision models can extend from text-only to text-plus-image capability at a controlled cost.