Multimodal Visual Reasoning in LLMs: Token Compression and Low-Cost Optimization

    This article explores the technical and economic challenges of integrating multimodal capabilities into large language models (LLMs), focusing on the high computational and memory costs associated with visual tokens. It details how visual token explosion leads to quadratic complexity in self-attention mechanisms and massive KV cache consumption. To maintain low-cost business models, the article introduces practical optimization approaches such as visual primitive-driven reasoning and compressed sparse attention. Finally, it highlights the engineering significance for developers, illustrating how reduced visual token costs enable scalable and affordable multimodal AI applications.

    Multimodal Visual Reasoning in LLMs: Token Compression and Low-Cost Optimization

    Recently, a large language model (LLM) team known for its extreme cost-effectiveness finally opened an experimental version of its multimodal API to the public. Compared to other leading teams that launched native multimodal capabilities supporting images and video months ago, this team’s pace has been noticeably slow—it only supports image input without video processing, carries an “experimental” tag, and its weights remain closed-source.

    This has sparked widespread discussion in the tech community: why did this team wait until now to enter the multimodal space? Is it a lack of technical reserves, or is there another reason? Looking beyond the surface, this is not a lag in technical capability, but a profound trade-off between “visual token cost” and a “low-price business model.”

    1. The “Gold Swallower” of Multimodal Reasoning: Visual Token Cost Pain Points

    Before exploring why LLMs delay multimodal rollouts, we must understand why visual tokens are so expensive.

    Current mainstream multimodal LLM architectures typically use a visual encoder (such as ViT) to split an input image into fixed-size patches, which are then mapped into a series of vectors as visual tokens fed into the LLM. The problem is that a high-resolution image contains extremely rich details. To preserve the model’s image understanding capabilities, the encoder generates a massive token sequence.

    For instance, a standard 1080P image, after 16x16 patch splitting and feature extraction, can easily generate thousands or even tens of thousands of visual tokens. When these tokens enter the LLM’s self-attention layers, they cause catastrophic cost increases:

    1. Quadratic Growth in Computational Complexity: The complexity of the self-attention mechanism is $O(N^2)$, where $N$ is the total sequence length. The massive influx of visual tokens drastically inflates the sequence length, causing a multiple-fold increase in computation and inference time.
    2. Surging KV Cache Memory Footprint: During inference, the model needs to cache the Key and Value tensors of historical tokens. Assuming the LLM has $L$ layers, a sequence length of $S$, a hidden dimension of $H$, and uses half-precision (FP16), the memory consumption is approximately $2 \times L \times S \times H \times 2$ bytes. Thousands of visual tokens will instantly consume tens of GB of VRAM, severely reducing the number of concurrent requests a single GPU can support.

    For LLM services focusing on a “low-price” model, the core demand of the user base is to obtain high-quality text generation at a minimal cost. Introducing native multimodal capabilities with high inference costs would instantly shatter their existing low-price pricing system. This is the core pain point the team must cautiously navigate.

    2. The Trade-off: Low-Price Strategy vs. Multimodal Capabilities

    Looking across the industry landscape, some LLM teams completed their multimodal layouts months ago, covering text, image, video, and other modalities. Others chose to split their multimodal branches, using independent high-performance visual models to supplement capabilities. However, teams sticking to a “low-price persona” must first cross a threshold: proving that they can “do vision well with very little money.”

    If a multimodal API is launched hastily without solving the token efficiency problem, it will inevitably lead to one of two outcomes: either the price of the multimodal API is raised, alienating price-sensitive users; or the team bears the high server costs itself, leading to financial losses. Therefore, the delayed release is not due to a lack of technology, but a necessity of underlying engineering and business logic—they must find a technical solution that can drastically reduce the number of visual tokens while preserving visual understanding capabilities.

    3. The Breakthrough: Visual Primitive Reasoning and Attention Compression

    To break this deadlock, the team conducted in-depth exploration in both academia and engineering, adopting a unique cost-reduction technical path. The core idea centers on two key technical concepts: visual primitives participating in reasoning and compressed sparse attention.

    1. Visual Primitive-Driven Reasoning

    Traditional multimodal models tend to convert images into dense pixel-level tokens, letting the LLM “see” the image itself. The concept of “visual primitives” instead performs dimensionality reduction and abstraction of visual features first. Instead of blindly feeding massive pixel blocks to the LLM, the system extracts structured information such as key feature points, bounding boxes, and contour lines from the image, converting them into a small number of high-density “primitive tokens.”

    These primitive tokens do not merely represent a stacking of pixels; they carry entities of spatial position and semantic concepts. They directly participate in the logical reasoning chain of the language model. This approach can convey an equivalent amount of key information using a much smaller token count when handling tasks like document OCR, chart understanding, and object detection.

    2. Compressed Sparse Attention

    After addressing the token count at the input level, the attention mechanism within the model also needs optimization. Standard global self-attention requires every token to interact with all other tokens. Compressed sparse attention mechanisms argue that there is a massive amount of redundant information among visual tokens, and not all patches need to attend to one another.

    By introducing local window attention or dynamic token dropping strategies, the model can significantly reduce the interaction frequency between Queries and Keys/Values. For example, shallow network layers retain the local spatial interaction of visual tokens, while deep network layers use sparse sampling to retain only key global context. This mechanism effectively suppresses the $O(N^2)$ complexity explosion, ensuring that even with a certain number of visual tokens, the inference computational overhead remains on the same order of magnitude as text tokens.

    Pseudo-code example (illustrating the simplified logic of sparse attention in visual processing):

    1. def sparse_visual_attention(query, key, value, mask):
    2. # query, key, value: [batch, heads, seq_len, d_k]
    3. # mask: sparse mask matrix, marking the attention connections to retain
    4. scores = torch.matmul(query, key.transpose(-2, -1)) / math.sqrt(d_k)
    5. # Set positions where mask is 0 to negative infinity, so weight becomes 0 after softmax
    6. scores = scores.masked_fill(mask == 0, float('-inf'))
    7. attn_weights = F.softmax(scores, dim=-1)
    8. output = torch.matmul(attn_weights, value)
    9. return output

    4. Developer Perspective: The Engineering Significance of Low-Cost Multimodal

    For enterprises and developers, the reduction in LLM visual token costs means the barrier to entry for multimodal application deployment is further lowered. In the past, constrained by high API calling fees or the VRAM pressure of local deployments, many long-tail image-text processing scenarios struggled to achieve commercial viability.

    In engineering practice, developers can leverage general cloud infrastructure platforms like Baidu AI Cloud to build highly cost-effective multimodal applications. For example, they can store massive amounts of unstructured image data in object storage, use container platforms to elastically schedule multimodal API requests, and combine logging and monitoring services to fine-tune token consumption control.

    When visual token costs are compressed to a level similar to text tokens, high-frequency, low-cost scenarios such as massive e-commerce product image tagging, batch digitization and parsing of historical archival documents, and real-time early warning for industrial quality inspection will truly explode. Developers no longer need to make difficult compromises between “accuracy” and “cost.” Instead, they can utilize multimodal capabilities optimized through token compression to achieve stable service output under extremely low budgets.

    In summary, the delay in releasing a multimodal API by this LLM team reflects the industry’s deep rethinking of “visual computing economics.” Through visual primitive extraction and sparse attention compression, multimodal capabilities in LLMs are breaking out of the “gold-swallowing” dilemma. This is not just a victory for a single technical route, but a crucial step toward making multimodal AI universally accessible and affordable.