On-Device Open-Source LLMs: Architecture Tradeoffs from MoE Selection to Long-Context Practice

    This article analyzes the architecture choices behind open-source on-device LLMs, including the counterintuitive dense-versus-MoE specification split, dual RoPE configurations for long context, per-layer embeddings for memory efficiency, integrated multimodal and native audio input, and practical guidance for model selection and edge deployment.

    1. Background: Why On-Device LLMs Deserve Separate Discussion

    Over the past two years, the main battlefield for open-source LLMs has been the cloud: models with tens of billions or even hundreds of billions of parameters, served by data-center-grade GPU clusters. As compute on mobile devices, edge boxes, and home workstations continues to improve, however, one technical trend is becoming increasingly clear: deploy models directly on-device.

    On-device deployment is attractive for three main reasons:

    • Privacy and compliance: Data does not leave the device, which naturally avoids compliance risks associated with uploading sensitive information.
    • Latency and cost: Inference runs locally, with no network round trip and no ongoing API call fees.
    • Offline availability: Functionality does not degrade without network access, which is critical for mobile assistants, automotive scenarios, and industrial edge devices.

    But on-device deployment also introduces very different constraints: VRAM or memory budgets are often only a few GB to a few tens of GB, compute is limited by mobile SoCs or consumer-grade hardware, and power consumption and heat directly affect user experience. As a result, a new generation of open-source models designed for on-device use shows several architecture choices that deserve deeper technical analysis. This article examines those choices.

    2. Dense and MoE: A Counterintuitive Specification Combination

    The conventional approach for open-source models is: small parameter counts use dense architectures, while large parameter counts use MoE, because MoE can activate only part of the experts during inference and trade a larger total parameter count for better cost efficiency. Some recent new-generation open-source models, however, present the opposite combination: the smaller specification is MoE, while the larger specification is a dense model.

    This seemingly counterintuitive pairing can be understood from two dimensions of product positioning.

    1. Dense models pursue the capability ceiling

    A dense model computes every token through all parameters, so parameter utilization is 100%. When compute allows—for example, on professional home workstations or multi-GPU inference servers—the dense route can provide a more stable and consistent capability ceiling. It is especially suitable as a fine-tuning base: during full-parameter fine-tuning, gradient signals cover all parameters, behavior is highly controllable, and the community ecosystem is more mature.

    2. MoE pursues cost efficiency per unit of compute

    Although an MoE model has a large total parameter count, each inference activates only a small portion of it. Combined with routing optimizations, this can significantly reduce the computation per token under the same memory residency conditions. For scenarios with tight memory but high throughput requirements—such as local batch processing or edge services—MoE is an engineering tradeoff that exchanges capacity for speed.

    A simple conceptual comparison of inference cost:

    1. # Conceptual illustration: active parameters per token
    2. dense_active_params = total_params # Dense: all parameters active
    3. moe_active_params = top_k * expert_size # MoE: only top-k experts active
    4. speedup_estimate = dense_active_params / moe_active_params

    Of course, MoE’s memory residency cost still remains at the level of the total parameter count. This requires the inference framework to work with techniques such as expert offloading and quantization before it can run on-device. This is also why MoE specifications are usually paired with smaller activation granularity and more aggressive quantization schemes.

    3. Dual RoPE Configuration: An Engineering Solution for Long Context

    Ultra-long context is a core requirement for on-device agent scenarios—local document question answering, call record summarization, and multi-turn task planning all require the model to reliably handle inputs of tens of thousands or even hundreds of thousands of tokens.

    In recent years, the industry has widely adopted RoPE (rotary position embedding) and its variants to address extrapolation. A representative dual RoPE configuration has appeared in new-generation on-device models:

    • Sliding-window attention layers: These use standard RoPE. Such layers focus only on tokens within a local window, so the position encoding only needs to ensure correct relative positions inside the window.
    • Global attention layers: These use proportional RoPE (p-RoPE). That is, when computing attention scores, position frequencies are scaled proportionally to reduce the weight of high-frequency components at distant positions, making extrapolation more stable over ultra-long sequences.

    This hybrid strategy of “standard encoding for local attention, decayed encoding for global attention” essentially makes a layered tradeoff between the expressive precision of position information and extrapolation robustness: near-distance interactions are handled by sliding windows to preserve fidelity, while long-distance dependencies are handled by p-RoPE to prevent breakdown. For scenarios that need to process long documents on-device, this is a more economical solution than simply increasing the window size.

    4. PLE: A Conditional Embedding Pathway Built for On-Device Memory

    In a standard Transformer, each token receives only one embedding vector at the input layer. This means all potentially useful information—token identity, semantics, and task context—must be “packed” into this single vector at the entrance. As models become deeper, the information density this initial vector must carry becomes increasingly high.

    The Per-Layer Embeddings (PLE) approach offers a different path: generate a dedicated small vector for each token at each decoding layer, forming a low-dimensional conditioning pathway parallel to the main pathway. Its value lies in the following:

    1. On-demand supply: Each layer receives only the specific token information it needs, rather than being filled with all information at the start.
    2. Decoupling of identity and context: Token identity signals and context-aware signals are transmitted separately, giving each more room for expression.
    3. Memory friendliness: These small vectors have dimensions far lower than the main embedding, and part of the content can be computed during prefill and then released, which is well suited to memory-constrained on-device inference.

    Building on experience from earlier on-device multimodal model designs, PLE has been further improved in new-generation models, allowing small parameter specifications (such as 2B and 4B scales) to maintain quality while compressing memory usage to a range acceptable for phone-class devices. This idea of “not filling the entrance, but supplementing on demand along the way” offers useful lessons for any team optimizing on-device inference.

    5. Multimodal and Native Audio: Infrastructure for On-Device Agents

    From an application perspective, another major advance in new-generation open-source on-device models is the integration of multimodal input:

    • Visual input: Text, images (with variable resolution support), and video enter the model in a unified way. Images no longer need to be cropped to a fixed size, which is important for real-world scenarios such as document OCR and screenshot understanding.
    • Native audio input: Small specifications directly support audio inputs of tens of seconds, so on-device systems no longer need an external automatic speech recognition (ASR) model.

    The significance of native audio is often underestimated. The traditional on-device voice assistant pipeline is “ASR model → text → LLM,” with the two model stages each occupying memory and each introducing latency and error accumulation. After integration:

    1. Old pipeline: Audio ──► ASR model ──► Text ──► LLM ──► Response
    2. New pipeline: Audio ──► Multimodal LLM ──► Response

    Removing one model load and one intermediate representation conversion is a real experience improvement for simple on-device agent tasks such as voice commands and voice question answering. Of course, long audio transcription and complex acoustic scenarios still require dedicated models, and the integrated approach is currently better suited to short audio interactions.

    6. Selection and Deployment Recommendations

    Based on the analysis above, practical recommendations for developers are as follows:

    1. Choose specifications by hardware: For phone or Raspberry Pi level devices, prioritize small quantized models; for home workstations, consider dense large specifications as a local knowledge base or agent base.
    2. Validate long-context performance first: Do not rely only on short question-answering benchmarks. Build long-text test sets from real business documents and focus on accuracy in long-distance information retrieval.
    3. Use dense models for fine-tuning and MoE for distillation: For scenarios requiring customized capabilities, use dense bases for full-parameter or LoRA fine-tuning; for online services pursuing throughput, evaluate MoE specifications.
    4. Redesign the audio pipeline: Teams that already have a two-stage ASR plus LLM architecture can evaluate the feasibility of replacing the front-end ASR with an integrated model.
    5. Cloud-edge collaboration: Run privacy-sensitive and low-latency tasks on-device, and route complex reasoning to cloud LLMs (for example, cloud capabilities built on services such as Baidu AI Cloud Qianfan where available), forming a tiered inference system.

    7. Conclusion

    Competition in on-device LLMs has moved from “whether it can run” to “whether the architecture is designed for on-device use.” The long-context stability of dual RoPE, the conditional embedding pathway of PLE, native multimodal and audio input, and the differentiated positioning of dense and MoE models all point to one goal: deliver usable intelligence under the constraints of a few GB of memory and watt-level power consumption. For developers, understanding these technical tradeoffs has more long-term value than chasing specific benchmark numbers.