Optimizing Visual Encoders in Multimodal Large Models: Practical Engineering Guide

    This article examines why strong benchmark scores in image-text retrieval do not always translate into reliable fine-grained reasoning, and how training objectives shape what a visual encoder actually learns. It contrasts contrastive global alignment with generative fine-grained alignment, then walks through the key design choices that let language-level gradients reshape the vision tower: resolution and tiling strategies, loss composition with weighting coefficients, and freeze/unfreeze scheduling. It also covers data construction for supervision quality, a three-layer evaluation methodology, the supporting infrastructure for training and serving, and common pitfalls to avoid. Readers will gain a practical framework for improving real-world multimodal performance without simply scaling up parameters.

    1. The Starting Problem: “Seeing” Is Not the Same as “Reasoning Clearly”

    In multimodal large model engineering, one pattern keeps recurring: a model scores impressively on benchmarks like image-text retrieval and image-text matching, yet performance drops noticeably once the task demands precise reasoning — reading small-font tables in a document, understanding button hierarchy in a UI screenshot, or extracting fields from an invoice and running arithmetic checks on them.

    The reason is not mysterious. Retrieval-style tasks only require the model to compress an entire image into a single global representation that sits close to the text embedding. Reasoning tasks require the model to preserve local details, spatial relationships, and character structure.

    The core judgment in the source material is worth expanding on: when a model must produce the correct answer, gradients backpropagate into the visual encoder and force it to extract features that are genuinely useful for language reasoning, rather than merely learning a global embedding that happens to work well for image-text retrieval. In other words, the training objective determines what the visual side learns to “look at.”

    2. Two Alignment Objectives, Fundamentally Different

    2.1 Contrastive Global Alignment

    Contrastive learning maps images and text into a shared vector space, aligning them by pulling positive pairs together and pushing negative pairs apart. Its advantages are obvious: simple to implement, efficient to sample, robust to noise, and well suited to large-scale weakly labeled data. But its objective only cares whether the overall pair matches; it is completely insensitive to which region inside the image contributed to that match. As a result, it easily degenerates into relying on global statistical cues such as color distribution and background texture.

    2.2 Generative Fine-Grained Alignment

    Next-token prediction uses text as a conditional generation signal: to produce the answer token by token, the model has to know what is written in a specific row and column of the image, which object an arrow points to, or whether two color blocks are adjacent. This fine-grained supervision pressure propagates back along the attention path into the visual tower, giving high-resolution features and local tokens higher weight. The claim in the official material that generative objectives are better at shaping textual and structural information is simply a plain-language expression of this mechanism.

    2.3 They Are Not Substitutes

    The more robust engineering approach is staged. Start with a global contrastive objective to obtain a stable cross-modal semantic space and a shorter convergence cycle, then switch to a generative objective for fine-grained refinement. If only the generative objective is used from the outset, the visual side tends to overfit on long-tail regions, and training cost rises significantly.

    3. Key Designs That Let Gradients Reshape the Visual Encoder

    3.1 Resolution and Tiling on the Visual Side

    The ceiling on fine-grained understanding is set by how much information the input carries. A common approach is to split an image into local tiles, encode each one, and feed them to the language side together with a global view, so attention can explicitly switch between “whole” and “part.” Finer tiling is not automatically better: more tiles inflate the number of visual tokens, and attention cost grows quadratically, so the choice has to balance memory budget against detail fidelity.

    A schematic pseudocode structure looks like this:

    1. # Conceptual illustration, not a specific product API
    2. def encode_image(img, grid=(2, 2), high_res=True):
    3. global_feat = vision_backbone(img) # global semantics
    4. tiles = split_to_tiles(img, grid) # local details
    5. local_feats = [vision_backbone(t) for t in tiles]
    6. tokens = concat([global_feat] + local_feats) # fed to the language side
    7. return tokens

    3.2 How to Combine the Losses

    A reusable combination is: total loss = generative language modeling loss + λ₁ × global contrastive loss + λ₂ × region-level alignment loss. Region-level alignment can leverage weak supervision from detection boxes or OCR output to explicitly bind a text span to an image region. For the λ values, a practical starting point is to let the generative loss dominate (for example, a small λ₁), then fine-tune after observing how well the visual features transfer to downstream fine-grained tasks.

    3.3 Freezing and Unfreezing Cadence

    If the vision tower has already been pretrained on large-scale data, freezing it early prevents unstable gradients from the language side from damaging it. Once language-side alignment has largely converged, unfreeze the last few layers with a small learning rate so the backward pressure can actually take effect. Full unfreezing usually pays off only when both data scale and compute are ample.

    4. Data Construction: Supervision Quality Sets the Ceiling

    • Prioritize structured document data: layouts, tables, and formulas inherently carry positional and hierarchical information, making them a cost-effective source for training fine-grained capability.
    • Build questions that require computation: for example, “What is the March sales figure in the table minus the January figure?” This forces the model to be correct at all three steps: locate, read, and compute.
    • Add distractor negatives: swap numbers or units within the same layout to suppress the model’s tendency to guess from priors.
    • Control annotation noise: character errors in OCR output get amplified directly by the generative objective, so confidence filtering and rule-based validation are advisable.

    5. Evaluation: Don’t Draw Conclusions from a Single Leaderboard

    Back to the original question — whether real-world performance is overstated is fundamentally a question of evaluation methodology. A three-layer evaluation is recommended:

    1. Global semantics layer: image-text retrieval and classification, to verify that basic alignment is healthy;
    2. Fine-grained perception layer: text recognition, region localization, counting, and spatial relationships;
    3. Compositional reasoning layer: multi-step document QA, chart computation, and UI operation understanding.

    Only by reporting all three layers can you tell whether a model is genuinely strong or simply overfitting to retrieval-style benchmarks. It also helps to fix the prompt template and decoding parameters, so conclusions don’t drift because of evaluation setup differences.

    6. Infrastructure and Engineering Support for Deployment

    Both training and inference typically rely on a few categories of general-purpose infrastructure: object storage to hold massive volumes of image-text samples, a message queue to decouple data cleaning from the sampling pipeline, a container platform to run elastic training jobs, and logging plus monitoring with alerting to track loss curves, memory usage, and sample throughput. Capabilities offered by Baidu AI Cloud in these general categories can serve as a reference for selection, but specific parameters and specifications should follow the official documentation; this article makes no performance claims.

    7. Common Pitfalls

    • Equating “more parameters” with “stronger fine-grained ability,” while ignoring the decisive role of the training objective and data structure;
    • Running only global contrastive pretraining yet expecting the model to acquire table- and text-reading ability automatically;
    • Letting visual tokens expand without limit, so inference cost spirals out of control;
    • Replacing layered evaluation with a single composite leaderboard and arriving at one-sided conclusions.

    In summary, whether a visual encoder can be reshaped backward by language objectives depends on three things: whether the supervision signal demands fine-grained correctness, whether the data carries structural and positional information, and whether the freeze/unfreeze schedule and loss weighting are tuned appropriately. Get those three solid, and the improvement in real business scenarios is often more noticeable than switching to a larger model of the same generation.