Open-Source LLM Selection Guide: How to Choose Between MoE and Lightweight On-Device Models

    As the open-source LLM ecosystem matures, model selection has shifted from comparing parameter counts to a holistic evaluation of hardware, business scenarios, and inference architecture. This guide covers on-device lightweight models, MoE versus Dense trade-offs, the engineering costs of large Dense models, and a business-driven selection checklist, along with cloud deployment references. It emphasizes measuring memory, latency, throughput, cost per million tokens, and quality on your own evaluation sets rather than relying on any single benchmark number.

    Open-Source LLM Selection Guide: How to Choose Between MoE and Lightweight On-Device Models

    As the open-source LLM ecosystem grows rapidly, model selection has shifted from simply comparing parameter counts to making a comprehensive judgment based on hardware, business scenarios, and inference architecture. Licensing is also becoming more permissive—licenses like Apache 2.0 lower the barrier to commercial use. This article walks through four areas: on-device models, MoE, Dense models, and business-driven selection, explaining the decision criteria for each.

    1. Lightweight On-Device Models: Calculate Memory First, Then Talk About Speed

    Models in the 2B–4B parameter range are commonly used on on-device targets such as phones and edge boxes. Runtime memory depends on three factors: the quantization format (e.g., INT4 or INT8), the inference runtime, and the context length. Whether KV Cache is included also changes the result. The same model can differ several-fold in memory footprint under different quantization and context conditions, so you should not quote any single number directly.

    Before selecting a model, measure peak memory on the target device and record the device model, OS version, quantization method, and maximum context length.

    Structured output—such as JSON parsing—is a critical capability for on-device agents. Evaluate field-missing rate, format validity rate, and error-recovery ability, rather than just whether a single response reads fluently. End-to-end latency is affected by input length, the number of skill nodes, and device compute. Workflows involving multi-step calls should be load-tested with real request chains.

    Offline operation also requires considering battery consumption, device heat, model package size, and the model update mechanism. These factors are easily overlooked during prototyping but directly affect user experience.

    2. MoE vs. Dense: Parameter Count and Compute Are Not the Same Thing

    When evaluating MoE models, distinguish between total parameters and activated parameters. Activated parameters determine the compute per token and mainly affect generation speed. Total parameters determine the storage space for weights. Take an MoE model with 25B total parameters and roughly 4B activated per token: even though per-step compute is small, you still need to reserve memory for all experts, or use expert parallelism, CPU offload, and similar techniques.

    A rough memory estimate works as follows:

    Memory ≈ weight footprint + KV Cache + runtime overhead

    KV Cache grows with concurrency and context length. Estimate each of the three parts separately.

    In terms of quality, MoE and Dense models usually show small gaps on most public leaderboards, but the gap varies by task type. Differences on math, code, and scientific reasoning tasks may be more pronounced than on general QA. Compare models using your own business evaluation set, and record the model version, prompt template, and decoding parameters.

    In terms of speed, throughput and latency depend on hardware, batch size, context length, and the inference framework. MoE models often have a speed advantage at comparable quality, but routing overhead and unbalanced expert loads offset part of that gain. During load testing, fix all conditions and vary only the model—otherwise the results are not comparable.

    3. Engineering Costs and Risks of Large Dense Models

    Large Dense models compute all parameters for every token, so per-GPU concurrency is usually limited. KV Cache grows with context length, and in long-text scenarios memory pressure is far more significant than in short-text scenarios. These costs must be accounted for when designing service capacity.

    Hallucination should be treated carefully. Its sources include training data quality, alignment methods, prompt design, and the completeness of the input context. It cannot be attributed simply to one architecture—MoE models also make mistakes in long reasoning chains. Common risk-mitigation practices include: using retrieval-augmented generation (RAG) so answers have traceable sources, programmatically validating structured outputs, and manually spot-checking high-risk outputs.

    Return on investment should be calculated in terms of per-request cost, the magnitude of accuracy improvement, and business value. Higher inference costs are only worth bearing when the quality gain delivers clear benefits.

    4. Business-Driven Selection: Conditions Matter More Than Conclusions

    Selection criteria include concurrency, time to first token, service-level objectives (SLOs), memory budget, quality thresholds, and compliance requirements. Different conditions call for different models.

    • Edge and offline applications: prioritize evaluating 2B–4B models. If quality falls below the threshold, then evaluate whether a larger model can run on an edge server.
    • High-concurrency general QA: evaluate mid-size MoE models, and use load testing to compare cost per million tokens.
    • Complex code generation and deep reasoning: evaluate large Dense models, while constraining outputs with RAG, unit tests, and static checks.

    Use the following checklist to complete your assessment:

    1. Determine peak QPS and concurrency.
    2. Measure average input and output token counts.
    3. Calculate memory: the sum of weights, KV Cache, and runtime overhead.
    4. Load-test time to first token (TTFT), time per output token (TPOT), and overall throughput.
    5. Calculate cost per million tokens.
    6. Compute quality metrics for each model on your business evaluation set.
    7. Design a degradation plan, such as switching to a smaller model during peak hours.

    5. Cloud Deployment Reference

    Model weights can be stored in object storage for version management and rollback. This article uses Baidu AI Cloud Object Storage (BOS) as an example; object storage from other cloud providers works the same way. A CDN can be used for edge distribution. When deploying, follow the principle of least privilege, use time-limited signed URLs, and perform hash verification on weight files.

    The inference service can run on Kubernetes, with GPUs scheduled via the device plugin. Below is a sample template. Before actual use, fill in a verified image version and adjust the model pull method according to your inference framework’s requirements:

    1. apiVersion: apps/v1
    2. kind: Deployment
    3. metadata:
    4. name: llm-inference-moe
    5. spec:
    6. replicas: 3
    7. selector:
    8. matchLabels:
    9. app: moe-model
    10. template:
    11. metadata:
    12. labels:
    13. app: moe-model
    14. spec:
    15. containers:
    16. - name: inference-server
    17. image: custom-llm-runtime:1.0.0 # Replace with a verified pinned version
    18. resources:
    19. requests:
    20. nvidia.com/gpu: 1
    21. limits:
    22. nvidia.com/gpu: 1
    23. env:
    24. - name: MODEL_PATH
    25. value: "/models/moe-25b" # Pulled from object storage and verified by the inference service
    26. readinessProbe:
    27. httpGet:
    28. path: /health
    29. port: 8000
    30. initialDelaySeconds: 60

    Self-managed Kubernetes or other cloud providers’ solutions are equally viable. Which option to choose should depend on your existing infrastructure, compliance requirements, and team experience.

    Monitoring should cover request latency, error rate, token usage, and GPU memory utilization. This data provides the basis for future model replacement and scaling decisions.

    6. Conclusion

    Open-source LLM selection should move beyond looking only at parameter counts and toward scenario-based measurement. On-device models prioritize memory footprint and latency. MoE models offer an option that balances speed and quality. Large Dense models are better suited for evaluation in scenarios with high quality requirements and sufficient budgets. Whichever path you choose, base your decision on measured data, business evaluations, and cost calculations.