Why Low-Cost Vision Models Are Slow: The Cost Account of Visual Tokens
This article analyzes the high inference costs associated with visual tokens in multimodal large language models, focusing specifically on how this impacts low-cost models. It explores the origin of visual tokens, the computational bottlenecks they create in the Prefill stage and KV cache, and strategic cost-reduction approaches such as compressed sparse attention and visual primitives. The article also provides practical advice for developers on evaluating and optimizing vision model performance.
1. The Bottom Line: Why Visual Tokens Are Expensive
Multimodal capabilities have become standard in large language models (LLMs). When an image is inputted, the model converts the picture into a massive number of visual tokens, causing inference costs to spike. For high-priced flagship models, this additional cost can easily be absorbed by their higher unit pricing. For low-cost inference services, however, the situation is different. Users choose these services specifically because they are cheap. If visual features double the cost of each API call, the overall pricing strategy becomes unsustainable.
2. Where Visual Tokens Come From
Mainstream Vision Language Models (VLMs) generally consist of three components: a vision encoder, a projection layer, and a language model. An input image is first sliced into fixed-size patches. Each patch is then mapped into a visual token by the encoder. Using a 14×14 patch size as an example:
- A 448×448 image produces approximately 32×32 = 1,024 visual tokens.
- A 756×756 image produces approximately 54×54 = 2,916 visual tokens.
- When using slicing or native resolution strategies, the number of tokens for a single image skyrockets further, with tens of thousands of tokens not being uncommon.
The token count is directly determined by image resolution and patch size. Therefore, the first step in reducing costs is understanding exactly how many tokens an input image will generate.
3. Cost Pressure on Two Critical Stages
3.1 Prefill Stage
Visual tokens and text tokens enter the attention computation together. As the sequence lengthens, the computational load for linear layers grows roughly linearly, while standard full attention grows quadratically. The extra tokens generated by images push up the overhead for both. This quadratic relationship assumes standard full attention; if sparse or compressed structures are employed, the growth curve changes.
3.2 KV Cache
Each token generates Key and Value caches in every layer. The cache size for a single token can be estimated using the following formula:
Per-Token KV Cache Bytes = 2 × Number of Layers × Number of KV Heads × head_dim × Bytes per Element
Assume a model has 32 layers, 8 KV heads, a head_dim of 128, and is stored in FP16 format (2 bytes per element). Each token then occupies approximately 128 KB of memory. A 756×756 image generating 2,916 visual tokens would require about 365 MiB of KV cache for its visual portion alone. If that same image is compressed to just 81 tokens, the cache requirement drops to about 10 MiB. These numbers are illustrative of the scale; actual values depend on the specific model architecture.
As memory usage increases, the number of concurrent requests a single GPU can serve decreases, lowering the overall service capacity per unit of compute.
4. A Compression Approach: Compressed Sparse Attention
A common and straightforward approach is to directly integrate an established vision encoder. This method can go live in a matter of weeks, but it does not change the token count or the cost structure. An alternative approach involves compressing within the attention layer itself: continuous tokens are aggregated into blocks, with each block distilled into a small number of representative tokens. Attention is primarily computed on the compressed, coarse-grained representations, returning to fine-grained tokens only when necessary.
The following code illustrates the shape changes brought about by block compression and does not represent an actual implementation of any specific model:
# tokens: [N, d], block_size = B, yielding M = ceil(N / B) block representations after compressioncoarse = mean_pool(tokens, block_size=B) # [M, d]# Queries use all tokens, while keys and values only use coarse representations# The attention matrix shape is [N, M]out = softmax(Q @ coarse_K.T / sqrt(d)) @ coarse_V # [N, d]
According to public materials, a 756×756 image can retain only about 81 compressed tokens in the vision section. Calculated by token count, dropping from 2,916 to 81 is roughly a 36x reduction. Claims of “thousands of times” compression seen in some articles lack clear measurement criteria and should not be cited directly. When describing compression ratios, it is necessary to specify whether the ratio is calculated by token count, KV element count, or memory footprint, while also noting the model’s layer count and precision.
5. Visual Primitives: Letting Models Reference Image Positions
Another design choice is integrating structured visual primitives, such as coordinate points or bounding boxes, into the chain of thought. The model can explicitly reference spatial positions within the image during inference, transforming the workflow into: locate first, reason second, and answer last. Visual evidence thereby becomes an integral part of the reasoning chain rather than just a preliminary input.
However, this approach has its boundaries. Coordinate precision is limited by token granularity, and dense small objects can easily be lost during compression. Furthermore, the training data requires spatial annotations, which are significantly more expensive to produce than standard image-text pairs. If a task only requires holistic image recognition, directly integrating a mature encoder is usually more efficient.
6. The Price: Data and Training Cycles
Compressed attention and visual primitive reasoning cannot be plugged directly into existing models. The engineering work required includes:
- After altering the attention structure, training strategies must be redesigned to ensure the compressed and fine-grained representations converge collaboratively.
- Changing the chain-of-thought format means that supervision data and reward models in post-training must be rebuilt accordingly.
- A trade-off curve exists between compression rate and accuracy, requiring extensive experimentation to find the appropriate working point.
On the data side, training samples must undergo multiple rounds of filtering. The pool of candidate data is far larger than the final retained samples, and the filtering criteria directly determine the ceiling of the visual reasoning capability. Combined, these processes make the engineering cycle much longer than simply connecting an off-the-shelf encoder.
7. Strategic Choice: Vision Serves the Agent Loop
Some teams prioritize language models and Agent capabilities, treating vision as a component of the execution feedback loop within these systems. For instance, when automating software interface operations, a screenshot can be taken to verify execution results; when reading charts, analytical conclusions can be validated; when checking generated pages, rendering correctness can be confirmed. As long as the visual capability is sufficient and cheap enough, it can successfully accomplish these tasks.
Other vendors, conversely, position native omni-modal capabilities as the core selling point of their flagship releases. Neither route is absolutely superior; they simply reflect different logics of resource allocation.
8. What Developers Can Do
- Determine the role of visual capabilities in your business: Whether used for perception input, execution verification, or result presentation, the requirements for accuracy and cost vary drastically across these three.
- Evaluate compression rates separately: Test scenarios like OCR, dense small object detection, and chart understanding independently. Looking only at aggregate leaderboards makes it difficult to spot the loss of fine-grained information.
- Monitor key metrics: Track prefill latency, KV cache memory usage for the visual portion, concurrent QPS, and token consumption per request. Cost issues typically surface early on these metrics.
- Cache image features: Store image feature results in object storage or a local cache. When the same image is requested repeatedly, there is no need to re-encode it.
Conclusion
Vision recognition capabilities arrived late to LLMs primarily because the costs had to be brought down first. From visual token compression and visual primitive reasoning to data pipeline construction, these choices follow a unified logic: match the cost structure to the product positioning before considering the rollout of capabilities. For developers, understanding this “calculate the account first, launch second” approach is far more valuable than merely tracking the release date of a specific model.
