Evolution of Large-Scale Model Architecture: Hybrid Attention and Native Multimodality Explained

    This article explains the key technical building blocks behind today's ultra-large-scale models. It clarifies the difference between total and activated parameters in Mixture-of-Experts architectures, shows how hybrid linear attention brings long context from quadratic to linear cost, and describes how attention residual improves information flow in deep networks. It also covers native multimodality, the prefill and decode stages of inference with common optimization techniques, a layered evaluation methodology, and cloud deployment with cost governance. Readers will gain practical ways to evaluate, deploy, and control the cost of large models rather than relying on scale numbers or leaderboards.

    1. Introduction: In the Trillion-Parameter Era, “Scale” Is Only an Entry Ticket

    Over the past two years, ultra-large-scale models with parameter counts reaching the trillions have continued to emerge, and the update cycles of flagship models keep shrinking. Each update sparks a round of discussion, and the core topics are always similar: how strong is it, has it “restored its former glory,” and can it join the top tier.

    Behind these discussions lies a misconception worth clarifying: parameter scale is merely an “entry ticket” to model capability, not a “certificate of qualification.” What truly determines whether a model can enter the top tier and hold its position long-term is usually three mutually reinforcing capabilities. This article groups them into “three keys”:

    1. Architecture efficiency: what structure is used to convert compute and data into capability;
    2. Engineering system: how to train the model stably and cost-effectively and deliver it to users;
    3. Evaluation and mindshare: how to prove that capability genuinely exists and win the trust and adoption of developers.

    These three points correspond precisely to the three common types of evaluation of flagship models in the industry: first, the “brute force” scale intuition; second, discussion of the “top tier” position; third, emphasis on SOTA brand mindshare.

    • Scale intuition: intuitive, but only answers “how much was invested,” not “how efficient the conversion was”;
    • Tier discussion: has reference value, but lacks a unified standard;
    • Mindshare perception: reflects the actual influence of leading models in developer selection. A clear, perceivable “SOTA mark” that performs consistently across various tasks does matter. But mindshare ultimately must be supported by reproducible capability, not marketing volume.

    This article takes the typical technical elements of ultra-large-scale models as a thread (including trillions of parameters and sparse activation, hybrid linear attention, attention residual, and native multimodality), breaks down their design motivations and engineering costs item by item, and provides actionable evaluation methods and deployment practices to help developers make rational judgments amid a flurry of model updates.

    2. Reading Parameter Scale Correctly: Total vs. Activated Parameters

    When the industry discusses numbers like “3T,” two concepts need to be distinguished:

    • Total parameters: the total number of all weight elements in the model, which determines the model’s “capacity ceiling”;
    • Activated parameters: the number of parameters actually involved in computation during a single forward pass, which determines the computational cost of a single inference.

    Current trillion-parameter large models generally adopt a Mixture of Experts (MoE) structure. It contains multiple “expert” subnetworks, and each token is routed by a gating mechanism to a few experts. As a result, the total parameter count can be made very large while the computation of a single inference remains relatively controllable. The same idea is also reflected in the “sparsification” of attention structures, where each token only attends to a portion of key positions.

    Engineering implications:

    • Different deployment profiles: total parameters determine the lower bound of memory and storage usage, while activated parameters determine computational throughput. A “trillion-parameter, low-activation” model may have memory requirements close to a dense model, but much lower compute requirements. Hardware selection must be accounted for separately;
    • Different parallelism strategies: MoE requires expert parallelism, and the expert load on each device may be uneven; linear attention-type structures need to maintain a fixed-size recurrent state. These change the memory layout and communication patterns;
    • Different communication patterns: the All-to-All communication introduced by gating routing, as well as changes in attention implementation, shift the location of cluster communication bottlenecks;
    • Unified comparison standards: when comparing two models, one should look at total parameters, activated parameters, context length, and inference cost simultaneously. Looking at any single metric alone easily leads to biased conclusions.

    3. Hybrid Attention: Taking Long Context from “Quadratic” to “Linear”

    3.1 Attention Is the Main Source of Long-Context Cost

    The computation of standard self-attention grows quadratically with sequence length n. At the same time, autoregressive decoding needs to cache the Key/Value of historical tokens (i.e., the KV cache), whose memory usage grows linearly with sequence length and the number of concurrent requests. When context expands from a few thousand to hundreds of thousands or even millions of tokens, both costs become the primary bottleneck. There are three common optimization routes:

    • Sparsification: sliding window, block-sparse, etc., computing only part of the attention scores;
    • Compression: aggregating historical information into a more compact representation;
    • Linearization: rewriting attention into a recursive form, reducing complexity from quadratic to linear.

    3.2 Linear Attention and State Compression

    Linear attention uses kernel functions to rewrite Softmax attention into an associative form. During inference, a fixed-size “state” can be maintained (in common implementations, a set of key-value matrices summarizes history), and the state is updated each time a token is read in, with O(n) complexity. Independent recurrent state space models (SSMs) have similar properties: historical information is compressed into a fixed-dimensional hidden state, and both computation and memory costs do not grow with context length.

    The advantages of such methods are obvious:

    • Constant decoding cost: no matter how long the context, the cost of each decoding step is essentially constant;
    • Low inference cost: with no ever-growing KV cache, the cost of long-context inference drops significantly;
    • Parallelizable training: with algorithms such as parallel scan, linear structures can be computed in parallel during training just like attention.

    But their shortcomings are equally clear: a fixed-size state is a “lossy compression” that struggles to precisely recall specific details from long ago. In tasks like “needle in a haystack” that require precise localization and verbatim retrieval of information, the advantages of a purely linear structure are diminished.

    3.3 Hybrid Structures: The Best of Both

    The core idea of hybrid linear attention is division of labor by layer: some layers are responsible for low-cost propagation of global information, while others retain precise retrieval capability. Common combination methods in the industry include:

    • Most layers use linear/state-type structures, while a few layers retain full attention;
    • Sliding-window local attention alternates with global attention;
    • Alternating different types of attention across different layers.

    This design strikes a balance between “global coverage” and “local precision.” In public materials, such hybrid linear attention mechanisms are usually described as balancing long-context efficiency with precise information recall, enabling models to handle ultra-long contexts while maintaining strong global modeling capability.

    Illustrative code (to explain the design idea):

    1. ATTENTION_WINDOW = 4096 # Local attention window size
    2. LINEAR_EVERY = 3 # Arrange 1 linear attention layer every 3 layers
    3. def build_blocks(hidden, layer_id):
    4. if layer_id % LINEAR_EVERY == 0:
    5. # Linear/state-type layer: constant-cost state update, O(n) complexity
    6. y = linear_state_block(hidden)
    7. else:
    8. # Local attention layer: attends only to tokens within the window, O(n * w) complexity
    9. y = windowed_attention(hidden, window=ATTENTION_WINDOW)
    10. return hidden + y

    Note: The code is used only to illustrate the design idea and does not represent the implementation details of any specific model.

    3.4 Engineering Impact

    • Operator and framework adaptation: custom operators such as linear attention and state updates require dedicated support from inference frameworks; otherwise, the theoretical complexity advantage is hard to realize;
    • Memory layout changes: the longer the context, the more obvious the advantage of linear structures over the KV cache. In short-context scenarios, the mature optimizations of full attention may still be more cost-effective;
    • Evaluation cannot look at average length only: it is recommended to cover short, medium, and long ranges, and measure the accuracy and cost curves at different lengths separately.

    4. Attention Residual: Letting Deep Information “Flow”

    4.1 Limitations of Traditional Residuals

    The standard Transformer block uses the residual structure x + F(x), which allows gradients to flow back smoothly and makes stacking dozens or hundreds of layers possible. But in ultra-deep networks, each layer’s output is added directly to the main path, and the “superposition” of inter-layer information also brings two problems:

    • When the model wants to use a specific representation from a certain earlier layer, it can only do so through a fixed additive path, lacking selectivity;
    • Deep representations are easily “drowned out” by a large number of layer outputs, and the effective signal decays.

    4.2 The Core Idea of Attention Residual

    Attention residual can be intuitively understood as upgrading the “indiscriminate superposition” of residual connections into a “weighted aggregation on demand” residual connection. Each sub-layer does not directly receive the single output of the previous layer, but instead uses an attention-like mechanism to weightedly aggregate the representations of several preceding layers, then uses the aggregated result as input. Its key points include:

    • Content-related queries: each sub-layer generates a “query” based on the current representation, deciding from which layers to take information;
    • Learnable weights: the contribution of different layers to the current computation is learned by the model rather than fixed at 1;
    • Enhanced deep plasticity: local details retained in shallow layers can be recalled again at any depth, alleviating deep information dilution.

    Illustrative code (to explain the design idea):

    1. def attn_residual_block(hidden, layer_outputs, layer_id):
    2. # layer_outputs: output representations of the already-computed layers
    3. keys = [proj_k(out) for out in layer_outputs] # layer outputs as keys
    4. vals = [out for out in layer_outputs] # layer outputs as values
    5. scores = [qk_similarity(proj_q(hidden), k) / scale for k in keys]
    6. weights = softmax(scores) # learn each layer's contribution weight
    7. aggregated = sum(w * v for w, v in zip(weights, vals))
    8. return hidden + ffn(norm(hidden + aggregated))

    Note: The code only expresses the idea of “weightedly aggregating preceding layer outputs” and does not represent any specific implementation.

    4.3 Benefits and Costs

    • Potential benefits: improves the expressive power and training stability of deep networks, and enhances the model’s ceiling on long-chain reasoning, complex instruction following, and other tasks;
    • Memory cost: more intermediate layer representations need to be retained or cached, increasing memory and bandwidth costs during inference;
    • Complementarity with MoE: attention residual solves information routing in the “inter-layer/depth” direction, while MoE solves parameter selection in the “intra-layer/width” direction. The two can be used together.

    It should be noted that “attention residual” is a generalization of a class of structural ideas, and the details of different implementations may vary greatly. Developers should refer to the official technical documentation and not infer the implementation directly from the name.

    5. Native Multimodality: From “Bolted-On Vision” to “Native Understanding”

    5.1 Two Multimodal Routes

    There are roughly two implementation routes for multimodal capability:

    • Late fusion: first train a language model, then attach a vision encoder, map image features into the text space via projection layers or adapters, and then perform alignment training. This approach is simple to implement and reuses mature language capability, but the interaction between vision and language is relatively limited, and much structural information may be lost during the adaptation process;
    • Native multimodality: during the pre-training stage, images, text (as well as audio and video frames) are uniformly mapped into tokens in the same sequence space, so that the model learns the joint distribution across modalities from the very beginning.

    Ultra-large-scale models generally emphasize “native multimodality,” mainly for three reasons:

    1. Cross-modal alignment happens at the earliest stage, so language reasoning ability is not “pulled” by visual alignment;
    2. The format of interleaved image-text data is more uniform, and mixed corpora such as documents, web pages, screenshots, and charts can directly enter training;
    3. The model can naturally process mixed image-text inputs within the same context.

    5.2 Key Engineering Issues

    • Resolution and visual token budget: images are split into patches and encoded into vector sequences; the higher the resolution, the more visual tokens, and the higher the context cost. Dynamic resolution and multi-scale tiling (splitting a large image into several sub-images while retaining a global thumbnail) are common balancing techniques;
    • Interleaved image-text data quality: the correspondence between OCR text and the original layout, and the accuracy of pairing charts with descriptive text, directly determine the upper limit of native multimodal effectiveness;
    • Clear task boundaries: native support for visual understanding does not equal support for image generation. The former is input understanding, while the latter is output generation.

    Illustrative code:

    1. def encode_image(image, max_patches=4):
    2. # Global thumbnail + multi-scale sub-images, balancing the whole and the details
    3. tiles = split_image(image, scale=2, max_patches=max_patches)
    4. return [vision_encoder(t) for t in [thumbnail(image)] + tiles]
    5. def build_multimodal_prompt(image, question):
    6. visual = encode_image(image)
    7. return [IMG_START] + visual + [IMG_END] + tokenize(question)

    5.3 Implications for Application Development

    • Document and form understanding: for complex-layout materials such as invoices, contracts, and reports, it is recommended to provide both the high-definition original image and structured text, allowing the model to cross-verify;
    • UI and screenshot analysis: details such as button positions and control hierarchy are sensitive to resolution, so layout segmentation may be needed first;
    • Cost control: limit the number and resolution of input images in business prompts to avoid excessive growth of visual tokens.

    6. Inference Performance: Turning “Capability” into a “Usable Service”

    6.1 The Two Phases of Prefill and Decode

    Large model inference is divided into two phases:

    • Prefill: processes all input tokens at once. It is compute-intensive and determines the time to first token (TTFT);
    • Decode: generates tokens one by one. It is memory-intensive, reading model weights and the KV cache at each step, and determines the per-token output latency and overall throughput.

    6.2 Common Optimization Techniques

    1. Paged KV cache management: split the KV cache into fixed-size blocks allocated on demand, reducing memory fragmentation and improving concurrent capacity;
    2. Prefix cache reuse: fixed prefixes such as system prompts, long documents, and few-shot examples can be cached and reused, significantly reducing TTFT;
    3. Quantization: use low-precision (such as FP8, INT8) representations for weights, activations, and the KV cache to reduce memory usage and memory access, at the cost of possible accuracy loss;
    4. Speculative decoding: use a small draft model (or the model’s own shallow predictions) to generate candidate tokens, then verify them in parallel with the target model in one pass, improving decoding speed while ensuring a consistent output distribution;
    5. Chunked prefill and continuous batching: cut long prompts into small chunks and schedule them mixed with requests that are decoding, avoiding long requests blocking short ones; continuous batching immediately releases compute slots when a sequence finishes, improving GPU utilization.

    Illustrative code:

    1. CHUNK = 4096 # Number of tokens processed per prefill step
    2. def prefill(model, prompt_ids, kv_cache):
    3. logits = None
    4. for start in range(0, len(prompt_ids), CHUNK):
    5. chunk = prompt_ids[start:start + CHUNK]
    6. logits = model.forward(chunk, past_kv=kv_cache) # incremental computation
    7. kv_cache.append(chunk) # only append the KV of this chunk
    8. return logits[-1] # used for the first token sampling

    6.3 Which Metrics to Focus On

    • TTFT: the key to the experience of interactive applications (customer service, code completion, real-time conversation);
    • TPOT/ITL: whether streaming output is “smooth”;
    • Throughput and concurrency: determine the per-token cost and capacity planning;
    • Cost curve under long context: how memory usage and per-request cost change as context length increases.

    For developers, load testing is more meaningful than looking at leaderboards. It is recommended to measure P50/P95/P99 latency, throughput, and error rates on real business corpora, avoiding being misled by a single average metric.

    7. Evaluation: How to Judge Whether It Can “Restore Its Former Glory”

    Demos are usually carefully selected and show the ceiling of capability, not engineering usability. It is recommended to replace intuitive judgment with a layered evaluation system:

    Evaluation Dimension Key Question Suggested Method
    Fundamental capability General knowledge, reasoning, code, math Use public benchmarks and build a business-specific question set
    Long context Can it precisely locate and synthesize within ultra-long text Multi-depth “needle in a haystack,” multi-hop QA
    Multimodal Is understanding of documents, charts, and screenshots accurate Sample real business materials and verify manually
    Instruction following Are formats, constraints, and tool calls stable Structured output validation, function-call testing
    Engineering performance Are latency, throughput, and cost acceptable Load testing with real corpora + cost accounting
    Stability and ecosystem Is the API stable, is the documentation complete, is the iteration pace sustainable Canary validation, long-term observation

    7.1 Long-Context Testing

    Illustrative code:

    1. def needle_test(model, filler_text, needle, depth):
    2. context = filler_text.copy()
    3. pos = int(len(context) * depth) # insert the target information at the specified depth
    4. context.insert(pos, needle)
    5. answer = model.generate(context + "\nQuestion: " + needle.question)
    6. return needle.check(answer) # judge whether it is correctly recalled

    It is recommended to repeat the test at different depths and different context lengths, observing the recall rate curve as a function of position, rather than taking a single-point result.

    7.2 Several Principles for Evaluation Design

    • Reproducibility: fix prompts, random seeds, and sampling parameters, and take statistical results over multiple runs;
    • Contamination prevention: avoid directly using public questions that may have entered the training data, and update the private question set in a timely manner;
    • Business alignment: build a small-scale “gold standard set” from real business samples, which reflects actual effectiveness better than general leaderboards;
    • Cost inclusion: incorporate token cost, latency, and stability into the decision matrix.

    Whether a model can “restore its former glory” should ultimately answer three questions: Is it significantly better than existing solutions in the target scenario? Is the cost acceptable? Can it provide service stably and continuously?

    8. Cloud Deployment and Cost Governance

    Once model selection is determined, the deployment architecture is equally critical. Taking general cloud capabilities as an example, a typical large model application architecture can be organized as follows:

    • Container platform: hosts the inference service, with elastic scaling and rolling releases based on GPU resource pools;
    • Object storage: stores model weights, training data, and business documents;
    • Message queue: smooths peaks and fills valleys, isolating inference clusters from the impact of sudden traffic spikes;
    • Log service and monitoring alerts: collect metrics such as latency, throughput, error rate, and token usage, and set threshold alerts.

    Deployment topology illustration:

    1. Client → API Gateway (auth/rate limiting) → Message Queue (peak shaving) → Inference Cluster (container platform)
    2. ↕
    3. Object Storage (model/data) Log Service Monitoring Alerts

    8.1 Cost Governance

    The cost of large model applications often grows rapidly with context length and call volume. The following measures are recommended:

    1. Context trimming: control the number of retrieved fragments in retrieval-augmented generation (RAG) to avoid stuffing irrelevant content into the context;
    2. Prefix reuse: route fixed prompts, system instructions, and long documents through the prefix cache;
    3. Model-tiered routing: assign simple tasks to lightweight models or rule-based processing, and only call the flagship model for complex tasks;
    4. Capacity planning: estimate the number of GPUs based on peak QPS and average context length, with a buffer reserved;
    5. Usage observability: track token consumption by business line and tenant, and promptly identify abnormal calls.

    On Baidu AI Cloud, enterprises can build the above architecture based on general cloud products such as the container platform, object storage, message queue, log service, and monitoring alerts it provides. Specific specifications and capabilities are subject to the official documentation.

    9. Conclusion: Returning to Engineering Rationality

    Back to the initial question: can ultra-large-scale models “restore their former glory”? The answer depends on what ruler we use to measure.

    • Parameter scale and sparse activation determine the capability ceiling and cost floor;
    • Hybrid linear attention takes long context from “theoretically feasible” to “economically feasible”;
    • Attention residual makes information flow in deep networks more efficient;
    • Native multimodality takes the model from “language-centric” to “giving equal weight to perception and understanding.”

    These technical advances are real and valuable. But the models that truly enter the top tier and maintain leading mindshare are certainly those that have polished all three keys—architecture, engineering, and evaluation—simultaneously. For developers, rather than chasing the hype of every release, it is better to build a reproducible evaluation system and a clear cost model. Finding the balance point that best fits your business among capability, cost, and stability is the rationality that technology selection should have.