Native Multimodal LLM Architecture: A Guide to Engineering Implementation
This article breaks down the architecture of native multimodal large language models and how to deploy them in production. It explains why decoupling total parameters from activated parameters has become the mainstream design, how sparse and linear attention are combined for long context, and what million-token context actually costs in throughput and scheduling. It also covers practical patterns for agents and coding workflows, cost and observability governance, and a reference layered architecture on Baidu AI Cloud. Engineers will find actionable guidance on caching, scheduling, tool orchestration, and monitoring.
1. Why “High Total Parameters + Low Activated Parameters” Became the Mainstream
Over the past two years, growth in LLM capability has mainly come from scaling parameter count. But inference cost scales almost linearly with total parameters, which creates an awkward situation: the capability is usable, but the cost is not. The answer from the new generation of native multimodal models is decoupling: put knowledge capacity in the total parameters, and compress the compute per forward pass into the activated parameters.
Take a recently open-sourced multimodal model as an example. It has roughly 320 billion total parameters, while a single forward pass activates only about 18 billion, an activation ratio of around 5.6%. Its weights are released under a permissive MIT-style license, allowing commercial use and redistribution.
For engineering teams, the significance of this approach goes far beyond “saving GPU memory”:
- Capacity and compute are decoupled: expanding knowledge does not necessarily raise the cost per request, so capacity planning can be based on business peak load rather than average load.
- Predictable cost structure: the cost per token is mainly determined by activated parameters and context length, which makes financial modeling easier.
- Native multimodality: text, images, video, and audio share the same representation space, avoiding the interface fragmentation and semantic loss of “stitched-together” multimodal systems.
2. Attention Mechanisms: The Division of Labor Between Sparse and Linear
The core bottleneck of long context is the quadratic complexity of attention. There are two common approaches in the industry. One is hybrid sparse attention, where each query interacts with only part of the history, pushing complexity close to linear. The other is linear attention and its gated variants, which replace the full history cache with a recurrent state.
In engineering practice, the two are usually combined in layers: shallow and local patterns use sparse windows to preserve fine-grained fidelity, while deep and global patterns use linear or gated recurrence to carry long-range memory. It is worth emphasizing that sparsification sacrifices some “exact retrieval” capability. Long-context scenarios must therefore be paired with retrieval augmentation, rather than expecting the model to remember a million tokens in full.
An illustrative attention mask construction (conveying the idea only, not a specific implementation):
# local: local window; global: a few global anchors; linear: recurrent statedef build_mask(seq_len, window=4096, n_global=64):m = torch.zeros(seq_len, seq_len, dtype=torch.bool)for i in range(seq_len):lo = max(0, i - window)m[i, lo:i + 1] = True # local windowm[i, :n_global] = True # global anchorsreturn m
3. The Real Cost of Million-Level Context and Scheduling Strategies
The window limit is a capability claim; throughput is the engineering reality. The longer the context, the more pronounced the KV cache, memory fragmentation, and scheduling jitter become. Practical measures include:
- Tiered caching: keep hot data resident in GPU memory, move warm data down to memory or high-speed storage, and send cold data to object storage, migrating by access frequency.
- Prefix reuse: fix system prompts, tool descriptions, and coding conventions as a stable prefix, so cache-hit requests require almost no repeated computation.
- Chunked prefill: slice very long inputs into a pipeline, avoiding a single prefill occupying a batch slot for a long time and reducing tail latency.
- Context compression: produce structured summaries and key-point extraction for conversation history, keeping only decision-relevant information.
{"model": "multimodal-llm","messages": [{"role": "system", "content": "<stable tool and convention prefix>"},{"role": "user", "content": "<current task + retrieved snippets>"}],"max_tokens": 4096,"temperature": 0.2}
4. Implementation Essentials for Agents and Coding Scenarios
In automated agents and office tasks, the model is only the decision core; real stability comes from surrounding engineering: a unified tool-calling protocol, an idempotent and retryable action layer, a sandboxed execution environment, and a two-stage “plan first, then execute” flow. For coding scenarios, it is recommended to make repository retrieval, dependency resolution, static checks, and test execution into deterministic tools, with the model responsible for orchestration rather than memorization.
Planning stage: goal breakdown -> impact analysis -> change listExecution stage: retrieve context -> generate patch -> static check -> unit test -> rollback point
5. Cost, Observability, and Governance
Cost governance needs to track three curves at the same time: cost per token, cache hit rate, and average context length. The observability system is best organized in three layers: the request layer records latency percentiles and error codes, the model layer records input and output tokens and cache hits, and the business layer records task success rate and human takeover rate. On the governance side, data classification, masking policies, and audit trails must be defined to prevent long context from indiscriminately pulling sensitive information into prompts.
6. A Reference Architecture on Baidu AI Cloud
A reusable layered structure is as follows: the access layer handles authentication and rate limiting; the gateway layer handles routing, protocol adaptation, and caching; the model layer carries inference and multimodal preprocessing; the data layer uses object storage to hold long documents and artifacts, with a message queue decoupling long-running tasks; and the observability layer connects the three layers of metrics through logging services and monitoring alerts. Elastic scaling should be triggered by queue backlog and latency percentiles, not by CPU alone.
7. Conclusion
The value of a highly sparse native multimodal model does not lie in any single metric, but in rebalancing the triangle of “capability, cost, and context.” What engineering teams truly need to build are four pieces of infrastructure: caching, scheduling, tool orchestration, and observability. Only by making these four solid can you achieve stable and predictable cost-performance under long-context and agent workloads.
