Native Multimodal LLM Architecture and Engineering Practices Explained
This article breaks down the architecture and engineering practices behind native multimodal large language models with sparse activation. It explains why combining native multimodality with sparse MoE routing has become a mainstream technical approach, then examines three key architectural designs: hybrid attention, layer compression with width compensation, and fine-grained expert routing. It also covers the engineering constraints of million-token context windows and multimodal inputs, what end-to-end inference on domestic accelerators signals for developers, why cost should be evaluated by activated parameters and first-pass success rate rather than unit price, and how to structure model selection across capability, engineering, stability, and cost layers. A reusable release path from anonymous canary testing to open source and a list of common pitfalls are included.
1. Why Native Multimodality Plus Sparse Activation Became the Mainstream Approach
Over the past two years, multimodal capability has been built in two main ways. The first bolts a vision encoder onto a text-only model and aligns it through a projection layer. The second mixes text, images, video, and documents into a single corpus and a single set of training objectives from day one of pretraining — the so-called native multimodal approach.
The first approach is fast to retrofit, but it tends to produce a “semantic gap” during cross-modal reasoning, which limits performance on chart understanding, document layout reconstruction, and long-video temporal reasoning. The second approach costs far more to train, but the representation spaces of different modalities are aligned by construction, making complex instruction following and cross-modal transfer more stable.
Running in parallel is the tension between growing parameter counts and inference cost. The industry has converged on a shared view: scale total parameters to hold knowledge capacity, while keeping activated parameters per inference pass small, trading sparsity for throughput and cost efficiency. A representative configuration is roughly 320 billion total parameters with about 18 billion activated per pass — an activation ratio under 6%. That puts per-token compute closer to a 10-billion-class dense model, while knowledge capacity and generalization approach those of a much larger dense model.
2. Three Key Architectural Decisions
2.1 Hybrid Attention: Sparse Attention Working With Linear Attention
The core bottleneck for very long context is the quadratic complexity of attention. A common engineering solution is a hybrid layout: most layers use linear attention or a recurrent state-space structure, pushing complexity to roughly linear in sequence length; a small number of layers retain sparse attention (local windows plus a few global anchors) to handle precise cross-segment retrieval and long-range dependencies.
The payoff is twofold — first-token latency and memory footprint on long inputs drop substantially, while avoiding the recall degradation that pure linear structures suffer on needle-in-a-haystack tasks.
2.2 Layer Compression With Width Compensation
Cutting from roughly ninety layers to about forty-five is not simple deletion. It moves abstraction capacity that was previously expressed through depth into width and routing: wider feed-forward dimensions, finer-grained expert partitioning, and more aggressive activation. Fewer layers directly reduce memory accesses and pipeline bubbles, which is especially friendly to inference throughput. The cost is greater sensitivity to routing quality — load imbalance shows up immediately as tail latency.
2.3 Fine-Grained Expert Routing and Load Balancing
The stability of a sparse model depends on its router. Three things matter in practice: the load-balance loss coefficient, the expert capacity factor, and how experts are partitioned for inference. The configuration logic below is illustrative and expresses a general idea rather than any specific product interface:
# Pseudocode: key tunable knobs for sparse routingrouter = TopKRouter(num_experts=256, # total number of expertstop_k=8, # experts activated per tokencapacity_factor=1.25, # capacity factor, controls overflow droppingbalance_loss_weight=0.01,)# Training: balance loss prevents the rich from getting richerloss = task_loss + 0.01 * router.load_balance_loss()# Inference: partition by expert parallelism to cut cross-device communicationexpert_parallel = ExpertParallel(rank_size=8, all2all_overlap=True)
3. Engineering Constraints for Very Long Context and Multimodal Inputs
A context window of about 1 million tokens (1,048,576) is a capability ceiling, not something free to use. Production deployments need to design three things at the same time:
- Input-side preprocessing. Images are split into blocks and compressed into visual tokens, video is sampled at key frames with temporal position encodings preserved, and document inputs go through layout and structure parsing first. The token budget must be allocated uniformly across modalities so a single high-resolution image cannot consume the entire window.
- Position encoding extrapolation. Long context depends on how well position encodings extrapolate. Common techniques include interpolation, per-frequency-band scaling, and long-sample annealing during training.
- Memory and caching. The key-value cache is the main source of memory consumption for long context, and needs paged caching, prefix reuse, and quantization. In multi-turn conversations, making the system prompt and document prefix reusable caches often pays off more than switching models, because the hit-rate improvement is larger.
4. Compute and Deployment: Reading “Full Domestic Chip Coverage During Testing”
The original information notes that all request traffic during the anonymous testing phase was served on domestic chips. For developers, the practical signal is that mainstream LLM inference pipelines can now be served end to end on domestic accelerators — but migration is not zero cost. The areas that need validation are operator coverage and fallback paths, mixed-precision strategy, communication-library topology adaptation, and memory fragmentation under long context. A sensible validation order is to start with small-scale offline evaluation for numerical alignment, then run load tests to confirm throughput and tail latency, and finally ramp traffic gradually.
On the cloud, a complete pipeline can be assembled from generic capability categories: a container platform hosts inference services and elastic scaling, object storage holds multimodal samples and model artifacts, a message queue smooths request spikes and decouples asynchronous tasks, and logging plus monitoring and alerting cover token usage, cache hit rate, and latency percentiles.
5. Cost Model: Why Billing by Activated Parameters Matters More
Sparse models are priced differently from dense ones. Pricing is usually anchored to activated parameters and output tokens, so the effective cost of the same model varies enormously across tasks. A reusable estimate:
cost per request ≈ input tokens × input price + output tokens × output priceeffective cost = cost per request / task success rate
The second formula is what actually drives engineering decisions: choosing a cheaper model that needs multiple retries raises total cost. Treating first-pass success rate as the core metric is more meaningful than comparing unit prices. Against larger variants in the same model family, the lightweight sparse version is often priced at around one tenth, which suits high-concurrency, long-context online workloads.
6. Evaluation and Selection: Don’t Look at a Single Composite Score
A composite intelligence index (for example, a score in the 57 range from a public evaluation suite) is fine for initial screening, but production selection needs at least four layers of validation:
- Capability: cross-modal understanding, long-document extraction, code and structured output, instruction following.
- Engineering: first-token latency, output tokens per second per user, and the latency degradation curve under long context.
- Stability: jitter caused by load balancing, rate limiting and degradation strategy, and idempotent design for retries.
- Cost: cache hit rate, average input-length compression ratio, and first-pass success rate.
A minimal working integration wrapper:
def call_multimodal_model(images, video_frames, prompt, budget=1_000_000):payload = build_messages(prompt, images, video_frames)used = estimate_tokens(payload)assert used < budget * 0.9, "reserve 10% headroom for output and system prompt"resp = client.chat.completions.create(model="general-multimodal-sparse",messages=payload,max_tokens=4096,extra_body={"cache_prefix": "system+docs"},)return resp.choices[0].message.content
7. From Anonymous Canary to Open Source: A Reusable Release Path
The most transferable lesson from the original event is not a specific model but the release method: serve real traffic for free on a public platform under an anonymous identity, use real call volume for stress and preference testing, then reveal the identity and open the weights. This path works for any in-house model team — anonymous canary testing avoids brand-preference bias in evaluations, real traffic exposes long-tail input distributions, and open sourcing turns ecosystem feedback into the next round of training signal. Three things should be settled in advance: the compute and rate-limit budget for the canary phase, a version switch that can be rolled back, and data compliance and de-identification boundaries.
8. Common Pitfalls and How to Avoid Them
- Treating the context window as effective memory. A very long window does not guarantee long-range precision; pair it with retrieval and segmented summarization.
- Looking at activated parameters without routing quality. Router collapse degrades a small-activation model into a weak model.
- Ignoring the multimodal token budget. High-resolution inputs easily crowd out text budget, so use a unified quota.
- Skipping numerical alignment when migrating compute platforms. Operator fallback and mixed-precision differences cause effect drift that is hard to localize.
- Substituting unit price for total cost. First-pass success rate and cache hit rate are the bigger cost levers.
In short, native multimodality combined with sparse activation, hybrid attention, and million-token context is pushing LLMs from capability demos toward accountable online services. For developers, the real competitive edge is not whether the largest model is used, but whether four variables can be managed at once: token budget, cache hit rate, routing stability, and first-pass success rate. Teams that want to build a similar pipeline on Baidu AI Cloud can assemble it from generic capabilities such as container platforms, object storage, message queues, and monitoring and alerting, without depending on any proprietary interface, to complete end-to-end validation and launch.
