In-Depth Analysis of Open-Source LLM Architecture Evolution and Inference Adaptation Practices

    Recent open-source large language models (LLMs) have introduced dense architectural innovations to achieve full-scenario coverage from edge devices to the cloud. This article analyzes the evolution of these models, focusing on three core mechanisms: Per-Layer Embeddings (PLE), KV Cache sharing, and heterogeneous KV Heads. We also explore the engineering challenges and optimization practices for adapting these innovations in production inference engines, including graph restructuring, resource scheduling, and multimodal integration.

    I. Introduction: Architectural Innovation and Full-Scenario Coverage in Open-Source LLMs

    In recent years, the development of open-source large language models (LLMs) has shown a clear trend of increasing architectural innovation density. The latest series of open-source models not only achieve full-scenario coverage from mobile devices to the cloud through various specifications (from edge lightweight to desktop and server levels) but also conduct deep explorations of underlying architectural mechanisms. These innovations are not mere parameter scaling; rather, they introduce combinations of different architectural mechanisms (such as PLE, KV Cache sharing, and heterogeneous KV Heads) to find new balance points between computational efficiency and model performance.

    However, high-density architectural innovation also brings significant challenges to the adaptation work of mainstream inference engines. Using the evolution of this series of models as an entry point, this article will dismantle three of the most distinctive mechanisms and explore engineering practices and optimization suggestions in actual inference deployment.

    II. Architecture Evolution Path: From Standard Structure to Native Multimodal Support

    This series of models was not built overnight but underwent a clear evolution path. From the initial standard architecture, to a multimodal transition version designed specifically for edge devices, and now to the new-generation architecture integrating multiple innovations, its evolution clearly reflects the optimization strategies of LLMs in resource-constrained environments.

    The following table summarizes the key feature evolution across three generations of architectures in this model series:

    Feature Dimension Gen 1 Standard Version Edge Multimodal Transition Version New Gen Multi-Spec Version
    Attention Mechanism Hybrid Attention Hybrid Attention Hybrid Attention
    KV Cache Independent per layer Shared (approx. 10 layers) Shared (18-20 layers)
    Embedding Shared Embedding PLE (Direct lookup injection) PLE (Lookup + projection fusion)
    QKV Norm Q/K Norm Q/K/V Norm Q/K/V Norm + attn_scale=1.0
    V Projection Independent v_proj Independent v_proj Partial models K=V (No v_proj)
    KV Head Uniform Uniform Heterogeneous KV Head
    Vision Encoder Common ViT Architecture Lightweight Vision Network ViT + Pooler
    Audio Support None Basic Audio Encoder Enhanced Universal Audio Encoder
    MoE Architecture None None 128 Experts Top-8
    Unique Mechanisms — AltUp, Laurel Block, Activation Sparsity K=V, Heterogeneous KV Head, Dual RoPE

    As shown, the new-generation architecture inherits excellent mechanisms from the transition version—such as PLE, KV Cache sharing, and QKV Norm—while further expanding its capabilities in projection layers, attention head design, and multimodal fusion.

    III. Core Mechanism Analysis: Per-Layer Embeddings (PLE)

    In traditional LLMs, input sequences are typically mapped to vectors via a shared embedding layer at the bottom, which are then injected into each Transformer layer. The Per-Layer Embeddings (PLE) mechanism breaks this convention by introducing an independent embedding lookup mechanism in every layer.

    1. PLE Direct Lookup Injection: In the edge transition version, PLE primarily performs direct lookups and injects the results into the current layer’s computation. This effectively increases the information capacity of small-parameter models, allowing the model to remember more contextual features without significantly increasing computation.
    2. PLE Lookup + Projection Fusion: In the new-generation architecture, PLE evolved into a “lookup + projection fusion” mode. After retrieving features via lookup, the model passes them through an additional projection matrix for feature space transformation before fusing them with the main network’s features.

    Adaptation Challenges: For inference engines, the PLE mechanism alters the traditional computational graph structure. The engine must support dynamic lookup operations and allocate independent embedding lookup spaces in memory management for each layer. In quantization scenarios, the quantization strategy for the PLE table must be decoupled from the main network weights to ensure precision.

    IV. Core Mechanism Analysis: KV Cache Sharing and Heterogeneous KV Heads

    KV Cache is a core technology for accelerating LLM inference, but in long-context and multimodal scenarios, memory consumption becomes a bottleneck. The new-generation architecture effectively mitigates this issue through KV Cache sharing and heterogeneous KV Head design.

    1. KV Cache Sharing Expansion: Sharing expanded from the early 10 layers to 18-20 layers. This means that during inference, the model no longer saves complete Key and Value caches independently for each layer; instead, multiple adjacent layers reuse the same set of KV Cache.

      1. # Pseudo-code: KV Cache sharing logic
      2. def forward_layers(hidden_states, kv_cache_shared):
      3. for i in range(num_layers):
      4. # Every N layers share one KV Cache pool
      5. if i % shared_interval == 0:
      6. current_kv = kv_cache_shared[i // shared_interval]
      7. else:
      8. current_kv = kv_cache_shared[i // shared_interval]
      9. # Perform attention calculation, reusing current_kv
      10. hidden_states = attention_layer(hidden_states, current_kv)
    2. Heterogeneous KV Heads and K=V Design: In traditional multi-head attention, the number of KV Heads is typically uniform and fixed. The new-generation architecture introduces heterogeneous KV Heads, allowing different layers or modules to have varying numbers of KV Heads. Furthermore, some models even adopt a K=V design, directly eliminating the v_proj projection matrix.

    Adaptation Challenges: When allocating memory, the inference engine must implement a memory pool reuse mechanism for shared KV Cache to avoid VRAM waste caused by duplicate allocations. For heterogeneous KV Heads and K=V designs, the computational graph compiler needs to dynamically identify the Head configuration of each layer and generate corresponding operator kernels, which places higher demands on the engine’s general operator dispatching capabilities.

    V. Core Mechanism Analysis: Multimodal and MoE Architecture Integration

    The new-generation architecture is more natively supportive of multimodality while introducing the Mixture of Experts (MoE) mechanism in high-specification versions.

    1. Multimodal Encoder Upgrade: For vision, it adopts a “ViT + Pooler” combination, achieving a better balance between feature extraction richness and computational efficiency compared to a pure lightweight network. For audio, it upgrades to an enhanced Conformer architecture, improving the expressive ability of speech features. Simultaneously, dual RoPE (Rotary Position Embedding) is introduced to better handle positional information of multimodal sequences.
    2. MoE Architecture Implementation: In specific desktop and server-level specifications, a “128 Experts Top-8” MoE design is utilized. This means that in each forward pass, the router dynamically selects 8 out of 128 expert networks for activation and computation.

    Adaptation Challenges: The introduction of the MoE architecture requires the inference engine to implement an efficient Expert Routing mechanism. If VRAM is insufficient to hold all experts, the engine must also support dynamic swapping in and out of expert weights. Combined with Baidu AI Cloud’s container platform and object storage service, an efficient model weight cache pool can be built to enable high-speed on-demand loading of expert weights.

    VI. Inference Engine Adaptation Challenges and Cloud-Native Engineering Practices

    In response to the aforementioned high-density architectural innovations, developers should focus on the following aspects when deploying LLMs:

    1. Computational Graph Reconstruction and Operator Fusion: For designs such as QKV Norm + attn_scale=1.0 and the absence of v_proj, the inference engine needs to rewrite attention operators to perform operator-level fusion of these operations, reducing VRAM read/write operations for intermediate results.
    2. Elastic Resource Scheduling: Facing models with varying specifications from edge to cloud, especially large MoE models, a cloud-native elastic deployment solution is recommended. With Baidu AI Cloud’s Container Engine for Kubernetes (CCE), compute nodes can be dynamically adjusted based on inference request concurrency. Coupled with log services and monitoring alerts, the activation frequency and VRAM usage of MoE experts can be tracked in real-time, achieving an optimal balance between cost and performance.
    3. Quantization and Sparse Computation Optimization: Addressing the natively supported activation sparsity and the PLE mechanism, developers need to explore mixed-precision quantization schemes. Applying high-bit quantization to main network weights while retaining higher precision for PLE lookup features and MoE routing weights will achieve extreme inference performance on edge devices.

    VII. Conclusion

    The new generation of open-source LLMs demonstrates the immense potential of architectural innovation through mechanisms like PLE, KV Cache sharing, heterogeneous KV Heads, and MoE. These designs not only improve the parameter efficiency of models but also make multi-scenario deployment possible. However, transforming innovative architectures into actual productivity still requires deep adaptation at the inference engine and engineering practice levels. Developers must deeply understand the underlying logic of these mechanisms and combine them with efficient cloud-native infrastructure to fully unleash the technological dividends of the new-generation LLMs.