Native Multimodal Architecture and Causal Codec Design: A Technical Deep Dive
This article breaks down the design motivations, implementation details, and evaluation methods behind a new class of LLM architectures built for agentic and long-document workloads. It covers asymmetric activation for prefill and decode, causal codec structures for context compression, memory augmentation via lookup tables, shared KV cache with two-level sparse indexing, native multimodal vision, and a four-dimension inference benchmarking framework. Readers will also find selection guidance for matching architecture choices to specific scenarios.
1. Introduction: From Parameter Scaling to Structural Innovation
Over the past two years, gains in large model capability have come mostly from scaling parameters and data in tandem. But once models moved into agentic workflows and long-document understanding, the engineering bottleneck shifted. GPU memory capacity is no longer the only constraint. What now determines user experience is compute cost in the prefill stage, memory bandwidth in the decode stage, and the reuse efficiency of the context cache.
The core idea behind this new generation of model structures is to send “reading” and “writing” down different compute paths, and to introduce explicit memory structures into the model. This article takes a general technical perspective and systematically breaks down the design motivation, implementation essentials, and evaluation methods of this class of architecture.
2. Asymmetric Activation: Separate Paths for Prefill and Decode
2.1 The Cost Problem with Traditional Symmetric Activation
In a conventional mixture-of-experts (MoE) structure, the input side and the output side stay symmetric: every token activates the same scale of expert parameters regardless of whether it is in the prefill or decode stage. The design is simple to implement and easy to load-balance, but it carries a hidden assumption — that processing context and generating new tokens have equivalent compute requirements.
Reality is different. Agent tasks often “read long and write short”: a single request may ingest hundreds of thousands of tokens of code, logs, or documents, yet produce only a few hundred to a few thousand tokens of conclusions.
2.2 The Basic Form of Asymmetric Activation
Asymmetric activation decouples total parameter count from activated parameter count and assigns a separate budget to each stage:
Total parameters: 552BPrefill activated: 8B (focused on context compression and representation building)Decode activated: 16B (focused on per-token generation quality)
The payoff is direct: per-token cost drops in the prefill stage, and time to first token (TTFT) for long contexts improves markedly; the decode stage retains enough capacity to avoid a regression in generation quality. It is worth stressing that this mechanism is not a “free lunch” — it requires optimizing the two paths separately during training, otherwise a clear distribution shift between stages shows up at inference time.
3. Causal Codec Structure: A Second Compression of Context
3.1 Structure Breakdown
Splitting the network vertically into two functional segments is the key design of this architecture:
- Lower half (causal encoder): runs only during prefill, compressing long context into a compact set of representations;
- Upper half (decoder): this is where the main decode-stage compute happens. The global key-value cache is no longer built independently by each layer; it is projected directly from the hidden states of the encoder’s last layer.
Schematic:
Input tokens│[Causal encoder layers × N] ← activated only in prefill│ last-layer hidden states → projected into shared global KV[Decoder layers × M] ← main activation in decode│Output logits
3.2 Why Context Becomes Compact
In a traditional structure, every layer maintains its own full set of global key-value pairs, so the cache grows linearly as context length increases. Under the codec division of labor, all decoder layers reuse the same global representation produced by the encoder, reducing the number of cached copies from “one per layer” to “one shared copy.” Combined with a two-level sparse index that retrieves only the fragments relevant to the current token, the key-value scale actually participating in attention shrinks substantially.
3.3 Costs and Applicability Boundaries
An information bottleneck is the inherent cost of this structure: the more aggressively the encoder compresses, the more likely long-range precise retrieval (such as “a variable name at token 80,000”) is to lose fidelity. It is therefore better suited to semantic aggregation tasks; scenarios with extremely high demands for character-level exact matching still need to retain a full-context path.
4. Memory Augmentation: Offloading “What Should Be Memorized” to Lookups
Splitting capability into two parts is another important route:
- The part that needs reasoning is handled by attention and the multi-layer network;
- Local patterns that carry a lot of memory but little compute value — high-frequency collocations, entity names, fixed fragments — are mapped to an explicit memory table via n-gram hashing, replacing repeated computation with table lookups.
Three engineering points matter here: hash collisions need multi-way mapping to mitigate; memory table size directly affects GPU memory usage and must be trimmed against the business vocabulary; and memory hits must be gated and fused with the attention output, otherwise artifacts from “abrupt stitching” are introduced.
5. Reorganizing Attention: Shared Cache and Two-Level Sparse Indexing
Converting the original dense attention into “shared key-value cache + coarse-grained index + fine-grained selection” is the standard move for cutting long-context costs:
- Shared cache: reuse the global representation across layers to reduce repeated projection;
- Level-one index: score by block and filter out candidate fragments;
- Level-two index: perform token-level selection within candidate blocks before entering attention compute.
With a high cache hit rate, repeated prefixes (system prompts, code context) are reused at nearly zero cost, which is the main source of throughput gains in long-session scenarios.
6. Native Multimodal Visual Understanding
Native multimodal means visual input shares the same representation space as text from the pretraining stage onward, rather than bolting on an adapter module at inference time. The difference shows up in fine-grained localization, chart reading, and understanding of documents that mix text and images. The practical recommendation is to unify the preprocessing pipeline, make explicit configuration choices for image resolution and chunking strategy, and keep vision-localization samples in the evaluation set as a separate category.
7. An Inference Performance Evaluation Framework
Do not look at a single “tokens/s” number. Build four dimensions instead:
| Dimension | Key Metrics | Notes |
|---|---|---|
| Latency | TTFT, TPOT | Time to first token and per-token generation latency |
| Throughput | Output tokens/s | Must be measured under fixed concurrency |
| Cost | Input/output token consumption | Cache hits change the structure significantly |
| Quality | Per-task accuracy | Long-context retrieval needs its own evaluation set |
A reusable load-test skeleton:
def bench(client, prompt, max_new=512, runs=3):results = []for _ in range(runs):t0 = time.perf_counter()first, ttft = None, Nonen = 0for tok in client.stream(prompt, max_new=max_new):if first is None:first, ttft = tok, time.perf_counter() - t0n += 1results.append({"ttft": ttft,"total": time.perf_counter() - t0,"tps": n / (time.perf_counter() - t0),})return results
8. Working with AI Coding Tools
The coupling between models and AI coding toolchains is deepening: the tool side supplies real execution feedback, retrieval results, and failure traces, while the model side is optimized specifically for different tool configurations. This forms a loop — tools produce high-quality traces, traces feed back into training, and training results in turn raise tool completion rates. When evaluating such systems, treat “task completion rate” and “average number of interaction turns” as primary metrics rather than looking only at single-turn generation speed.
9. Deployment in the Cloud
When deploying this class of model on Baidu AI Cloud, general-purpose capabilities can be combined: a container platform hosts elastic inference instances, object storage holds models and datasets, a message queue smooths traffic peaks, and log and monitoring services track TTFT, cache hit rate, and GPU memory levels. Elastic scaling policies should be triggered by both queue backlog and time to first token, avoiding the jitter caused by scaling purely on CPU utilization.
10. Conclusion and Selection Guidance
The gains of the new-generation architecture concentrate in three places: lower prefill cost, higher context cache reuse, and explicit memory that reduces repeated computation. For selection, decide by scenario — prioritize asymmetric activation and the codec structure for long-document and agent tasks; retain the full-context path for precise-retrieval tasks; and for high-concurrency online services, focus on tuning cache hit rate and sparse index parameters. Architectural innovation does not automatically convert into business value; the supporting evaluation system and engineering tuning are the path to realizing it.
