Technical Architecture and Engineering Practices of Native Multimodal Large Language Models

    This article examines the technical architecture and engineering practices behind native multimodal large language models, focusing on sparse activation, hybrid attention, and ultra-long context. It explains how decoupling total parameters from activated parameters reduces inference cost, how combining sparse and linear attention enables million-token windows, and why unified pretraining across text, image, video, and documents differs from bolt-on multimodal pipelines. It also covers cost modeling for long context, implementation guidance for coding and AI Agent scenarios, and general lessons from adapting inference to domestic compute backends.

    1. Introduction: From the Parameter Race to Cost per Unit of Intelligence

    Over the past few years, gains in large model capability came mainly from expanding parameter counts and training corpora in parallel. Once models move into production, however, the metric engineering teams care about shifts from “how large is the model” to “how much effective intelligence do we get per million tokens.” A model profile described in the source material offers a representative answer: roughly 320B total parameters with about 18B activated per inference pass, delivering general capabilities close to frontier closed-source models while pushing the call price down to roughly one tenth of a flagship model.

    Setting aside specific product attributes, this article breaks down the design logic and engineering implementation of a “sparse + native multimodal + ultra-long context” architecture from a general technical perspective.

    2. Sparse Architecture: Why Total and Activated Parameters Are Decoupled

    2.1 Separating Capacity from Compute

    Every forward pass of a traditional dense model touches all weights, so memory bandwidth and compute cost grow linearly with parameter count. A Mixture-of-Experts (MoE) architecture splits “knowledge capacity” from “compute per token”: total parameters determine how much knowledge and how many patterns the model can hold, while activated parameters determine the real cost of a single inference pass.

    320B total parameters with 18B activated means an activation ratio of about 5.6%. The matrix multiplication scale per token is close to that of an 18B dense model, while the representational capacity far exceeds a dense structure with the same activation budget.

    2.2 Rebalancing Depth and Width

    The material notes that the layer count was compressed from 92 layers to 45. This is not simply “making the model shallower” but a rebalancing of depth and width: fewer layers paired with a wider feed-forward structure reduces the number of layers to split for pipeline parallelism, shortens cross-device communication hops, and cuts kernel launch and scheduling overhead during inference. For inference serving, a lower layer count often directly improves time to first token (TTFT) and shifts the throughput inflection point for batching.

    2.3 The Engineering Cost of Sparsity

    Sparsity is not free. Imbalanced routing overloads hot experts, and setting the capacity factor too high wastes memory. In practice this usually requires expert parallelism, capacity limits, a load-balancing auxiliary loss, and a stable path design for shared experts. On the engineering side, weight distribution and caching strategy for experts also matter, so that each request does not trigger large-scale weight swapping in and out.

    3. Hybrid Attention: Sparse Attention Working with Linear Attention

    The core bottleneck of ultra-long context is the quadratic complexity of attention. A common industry approach combines two mechanisms:

    • Linear attention (or state-space style structures) carries long-range history in a constant-size state, with complexity that is approximately linear in sequence length.
    • Sparse/local attention preserves precise global interaction at key positions, compensating for the weakness of linear structures in exact retrieval.

    Alternating the two by layer keeps memory and compute within an acceptable range at million-token windows. One caveat: hybrid structures place higher demands on inference cache management (KV Cache / state cache). The linear branch must maintain a recurrent state, while the sparse branch needs paged caching and an eviction policy. When both coexist, cache hit rate and memory fragmentation become new tuning points.

    A schematic view of how attention layers can be arranged:

    1. # Illustrative layer arrangement for hybrid attention only
    2. def build_attention_layers(num_layers: int, sparse_ratio: float = 0.25):
    3. layers = []
    4. for i in range(num_layers):
    5. if (i + 1) % int(1 / sparse_ratio) == 0:
    6. layers.append("sparse_global_attn") # precise global interaction
    7. else:
    8. layers.append("linear_attn") # constant-size state for long-range dependencies
    9. return layers

    4. Native Multimodality: Unified Encoding Instead of Bolt-On Adapters

    The key difference between “native multimodal” and “stitched-together multimodal” is whether modeling is unified during training. A native approach mixes text, images, video, and documents in the pretraining corpus and uses a unified tokenization and encoding space, so cross-modal alignment happens at the low-level representation rather than being sewn together afterward by extra projection layers. The roughly 30T tokens of multimodal pretraining data cited in the material is the foundation for this unified representation.

    For developers, the direct benefit is that one set of prompts and one tool-calling protocol can handle screenshots, screen recordings, design files, and error logs at the same time, without maintaining a separate pipeline for each modality.

    5. A Cost Model for Million-Token Context

    Long context does not mean “stuff in whatever you want for free.” It helps to build an evaluation matrix along these dimensions:

    1. Effective context length: distinguish “accepting length” from “effective recall length,” and validate mid-context information usage with needle-in-a-haystack style retrieval tests.
    2. Caching strategy: reuse rates for prefix caching, paged caching, and state caching determine the marginal cost of multi-turn conversations.
    3. Batching strategy: scheduling fairness when long and short requests are mixed, so long requests do not block the queue.
    4. Tiered memory: keep long-term knowledge in object storage or a vector index, and inject only the fragments the current task needs into the context.

    A simplified cost comparison:

    1. Cost per task ≈ (input tokens × input price) + (output tokens × output price)
    2. where input tokens = system prompt + retrieved fragments + compressed history summary + current request
    3. Optimization priority: history compression > retrieval reranking > prefix cache reuse > prompt trimming

    6. Implementation Notes for Intelligent Coding and AI Agents

    Applying multimodal capability to coding scenarios typically involves inputs such as UI screenshots, terminal recordings, architecture diagrams, and requirement documents. Recommended practices:

    • Unified entry point: carry text and media references in a single multimodal message structure; store media as large objects in object storage, and pass only references and necessary thumbnail information to the model.
    • Tool orchestration: wrap file read/write, command execution, and test runs as controlled tools, with permission allowlists and sandbox containers.
    • Observability: use logging services and monitoring alerts to track TTFT, throughput, routing imbalance rate, and cache hit rate.
    • Quality guardrails: run static checks and unit tests on generated code, and treat model output as a patch to be verified rather than a finished artifact.

    7. General Lessons from Adapting to Domestic Compute

    The material notes that during the test period all requests were served by domestic chips. From a general engineering standpoint, this kind of adaptation usually focuses on operator coverage, mixed-precision support, topology-aware communication libraries, and custom kernels for sparse routing. The practical recommendation is to first build a rollback-capable inference image on a container platform, compare consistency and latency distributions across backends with shadow traffic, and then shift traffic gradually.

    8. Conclusion

    Stacking sparse activation, hybrid attention, native multimodality, and ultra-long context forms the technical foundation for “frontier intelligence at Flash-level cost.” For teams, the real payoff does not come from any single parameter but from bringing the cost model, caching strategy, and quality guardrails into the design together. If an organization wants to validate a similar architecture on Baidu AI Cloud, it can combine general capabilities such as container platforms, object storage, logging services, and monitoring alerts to build an evaluation and canary pipeline, then decide model selection and traffic allocation in a data-driven way.