Open-Source Multimodal LLM Architecture and Inference Adaptation: PLE, KV Cache Sharing, and Native Multimodal Support

    This article examines the architecture and inference adaptation of a recently released open-source multimodal model family that spans edge, desktop, and cloud deployments. Rather than simple parameter scaling, the family combines differentiated mechanisms, including Per-Layer Embedding (PLE), KV cache sharing, K=V attention variants, heterogeneous KV heads, dual RoPE, and native multimodal encoders. The article reviews the three-generation design evolution, analyzes each core mechanism, and describes the main challenges encountered when adapting an inference engine—dynamic model structures, PLE lookup and projection fusion, shared KV cache management, and heterogeneous attention shapes. It also presents indicative export and benchmark results across four model sizes, followed by deployment and fine-tuning recommendations for edge, cloud, multimodal, and resource-constrained scenarios.

    As large-model application scenarios continue to expand, the industry is placing higher demands on inference performance, memory footprint, and deployment flexibility. A recently released open-source multimodal model family offers multiple specifications, from lightweight edge models to desktop and cloud variants, covering a full compute range from mobile devices to servers. Notably, these specifications are not simple parameter scalings; they use differentiated architecture combinations, which creates substantial challenges for inference engine adaptation. Based on adaptation work across the full model family, this article focuses on three distinctive innovation mechanisms—Per-Layer Embedding (PLE), KV cache sharing, and native multimodal support—and provides export benchmark data and usage recommendations.

    1. Architecture Design Across Three Generations

    To understand the current design direction, it is useful to review the technical accumulation of the first two generations. The first-generation base model used a hybrid attention mechanism, with an independent KV cache per layer and a globally shared embedding layer. The second-generation edge multimodal model introduced Per-Layer Embedding (PLE) and KV cache sharing across 10 layers for the first time, normalized Q, K, and V, and added features such as activation sparsity. The third generation builds on these mechanisms and evolves further:

    • KV cache sharing: Expanded from 10 layers to 18–20 layers, significantly reducing cache usage during long-sequence inference.
    • Embedding design: Upgraded from simple lookup-table direct injection to “lookup + linear projection fusion,” improving feature representation.
    • Attention head structure: Some variants merge K and V (K=V), omitting the independent V projection; heterogeneous KV head configurations also appear, with different layers using different head counts or head dimensions.
    • Multimodal support: The vision encoder returns from a lightweight convolutional network to a stronger vision Transformer with an added pooler; the audio encoder combines convolutional and Transformer structures and supports multilingual speech input.
    • MoE variant: For very large-scale scenarios, the family provides a sparse mixture-of-experts model with 128 experts and Top-8 routing, where activated parameters are much smaller than total parameters.

    These changes show that the model designers are balancing memory efficiency and inference speed while pursuing high representation capability, forming a distinctive architecture evolution path.

    2. Core Mechanisms in Depth

    2.1 Per-Layer Embedding (PLE): Evolution and Implementation

    Traditional Transformers usually use a shared embedding table, where all layers share one token embedding matrix. Although parameter sharing reduces storage, it limits the different feature needs of different layers. PLE assigns an independent embedding table to each layer, allowing shallow layers to focus more on lexical semantics and deep layers to focus more on contextual associations. In the second generation, PLE used direct lookup-table injection: each layer retrieved a vector from its corresponding embedding table and added it to the output. The third generation adds a linear projection layer that transforms the embedding vector before fusing it with the main features, improving nonlinear representation.

    In inference, PLE must maintain multiple embedding tables, increasing memory access overhead. An optimization strategy is to pack the embedding tables of all layers into contiguous storage and use cache alignment to accelerate lookups. For multimodal input, text, image, and audio features have different dimensions, and PLE also supports assigning different projection matrices by modality.

    2.2 KV Cache Sharing and K=V Fusion

    During autoregressive generation, the KV cache occupies a large amount of GPU memory. Traditional models cache one Key and Value matrix per layer, so more layers mean a larger cache. The core idea of KV cache sharing is to let multiple consecutive layers reuse the same KV cache—that is, these layers share one set of key-value pairs. This reduces total cache size and, in theory, allows information transfer across layers. In implementation, shared layers are usually grouped, for example every 10 or 20 layers, and each group shares one cache.

    Some variants go further and directly set K equal to V, so the V matrix is no longer projected separately and the Key projection result is also used as Value. This design reduces attention parameters by about one third and eliminates one matrix multiplication. To compensate for reduced representation capability, the model fixes the attention scaling factor at 1.0 and adjusts the Q scaling factor to maintain numerical stability. Measurements show that the K=V design has little loss on short-sequence tasks but a slight drop on long-sequence and complex reasoning tasks, making it suitable for latency-sensitive edge scenarios.

    2.3 Heterogeneous KV Heads and Dual RoPE

    In traditional multi-head attention, the head count and head dimension of each layer remain consistent. This model introduces heterogeneous KV heads, where different layers use different KV head counts or head dimensions. For example, the first few layers use fewer KV heads to reduce computation, middle layers use the standard head count, and later layers use more KV heads to capture long-distance dependencies. This design requires the inference engine to support flexible attention operators and prohibits hard-coded shapes. During adaptation, we abstracted attention computation into a general kernel and dynamically generated operators according to layer configuration during graph construction.

    Dual RoPE (rotary position embedding) is designed for multimodal input: text sequences are usually short, while image and audio sequences are long and have two-dimensional or one-dimensional spatial structure. The model sets different RoPE frequencies for different modalities—for example, two-dimensional RoPE for images and higher-frequency one-dimensional RoPE for audio—so that relative consistency across modalities is maintained when encoding positions.

    2.4 Native Multimodal Support

    Unlike approaches that require externally concatenating a separate vision model, this family unifies vision and audio encoders with the text decoder in one network. The vision encoder uses an improved SigLIP ViT and adds a pooling layer to compress image patch features into a fixed length; the audio encoder uses a USM Conformer and can process raw waveforms or mel spectrograms. During training and inference, sequences from each modality are separated by modality identifiers, and position encoding is also adjusted by modality. This native design reduces the complexity of feature alignment, but it requires the inference engine to efficiently handle multimodal preprocessing and cross-modal attention.

    3. Inference Engine Adaptation: Challenges and Solutions

    Given these architecture features, the adaptation workload for the inference engine is clearly larger than for traditional models. The main challenges and our solutions are listed below.

    3.1 Dynamic Structural Diversity

    Different model specifications vary in layer count, head count, whether PLE is enabled, the number of shared KV layers, and whether K=V is used. To handle this, we adopted a unified graph description language, parameterized the model structure, and supported runtime compilation. At the operator level, we abstracted all attention computation into a standard QTensor interface with dynamic shape support.

    3.2 PLE Lookup and Projection Fusion

    PLE requires layer-by-layer embedding lookup and linear transformation. A poor implementation can cause memory fragmentation and memory-access bottlenecks. We designed a fused operator that first stores multiple embedding tables contiguously by layer index at the lower level, then uses warp shuffle for efficient lookup, and finally completes projection and additive fusion within the same kernel to avoid intermediate tensor round trips.

    3.3 Implementing Shared KV Cache

    Shared KV cache means that attention computation in multiple layers reads the same buffer, but writes require version control. We use a memory pool to manage shared buffers and assign an independent “KV slot” to each shared-layer group. During inference, different shared groups can write in parallel, while writes within a group are sequential. To improve throughput, we also implemented a polling-based cache cleanup strategy so that long sequences do not need to restart because of cache overflow.

    3.4 Heterogeneous KV Heads and K=V

    Heterogeneous heads require the attention operator to support per-layer head count and head dimension. We dynamically initialize operators by passing a head-configuration struct and use template specialization to accelerate common shapes. For K=V, we directly reuse the K matrix as V to avoid allocating extra memory, and multiply the Q scaling factor by a coefficient to ensure the numerical range.

    4. Export and Performance Evaluation

    We exported four specifications of the family—corresponding to edge, edge-server, desktop, and cloud—into a common inference format (tool unspecified) and benchmarked them on a standard Linux server with a multi-core x86 CPU and a consumer-grade GPU. Tests covered text generation, image question answering, and speech recognition tasks, using FP16 and INT8 quantization. The following are selected representative results; the data are illustrative means and actual results vary by hardware and quantization:

    • Edge specification: On a mobile-class CPU, text generation speed is about 30 ms/token with memory usage below 2 GB; with INT8, it reaches about 20 ms/token.
    • Edge-server specification: On an edge GPU, text generation speed is about 80 tokens/s, and KV cache usage is about 38% lower than with a traditional sharing scheme.
    • Desktop specification: On a desktop GPU, generation speed is about 60 tokens/s and mixed image + text input is supported. End-to-end latency is about 18% higher than text-only input, mainly due to the vision encoder.
    • MoE specification: The model has 26B total parameters but only 4B activated. Inference throughput is close to that of a dense model of similar scale, while memory usage is lower, making it suitable for high-concurrency cloud services.

    It is important to note that these data depend on specific hardware and optimization configurations. Developers should tune for their actual deployment environment, for example by using low-bit quantization, operator fusion, and memory pool reuse.

    5. Deployment Recommendations and Best Practices

    5.1 Edge Deployment

    Prioritize the smallest specification and enable INT8 quantization. For battery-sensitive scenarios, further prune the vision branch or reduce image resolution.

    5.2 Cloud Services

    Use the MoE variant with dynamic batching and KV cache management to maximize throughput. At the same time, use shared KV cache to reduce memory pressure and increase concurrency per machine.

    5.3 Multimodal Applications

    If images are processed frequently, cache the output of the vision encoder to avoid repeated computation. For audio streaming scenarios, use streaming inference and reuse the first few layers of the speech encoder.

    5.4 Model Fine-Tuning

    Because PLE and KV sharing change gradient propagation paths, consider freezing some shared layers and fine-tuning only the top layers and modality-specific encoder layers. Low-rank adaptation (LoRA) can effectively reduce the number of parameters while maintaining stability.

    6. Conclusion and Outlook

    This open-source model family shows a high density of architectural innovation. Through Per-Layer Embedding, KV cache sharing, heterogeneous attention heads, and native multimodal support, it significantly improves deployment efficiency while maintaining strong representation capability. For inference engine developers, adaptation complexity increases, but the benefits are considerable. In the future, as hardware vendors accelerate optimization of large-model operators, such heterogeneous structures may become a mainstream design direction. As a technical community, we should continue to monitor architecture evolution and adjust the abstraction layers of the inference stack in advance to respond quickly to model innovation.

    Finally, consider an open question: can these mechanisms be extended to other model families, or even become default configurations for general Transformers? In any case, this adaptation practice has demonstrated their feasibility and accumulated valuable experience for follow-up work. We look forward to more open-source community collaboration to advance efficient large-model deployment.