Open-Source LLM Selection Guide: Model Size Tiers, Dense vs. MoE Architectures, and Agent Deployment

    A practical guide to choosing open-source large language models by scenario. It breaks down the typical four-tier model family lineup (from ~2B on-device models to ~100B-class dense models), explains the real differences between dense and mixture-of-experts (MoE) inference, and covers the capabilities that determine production readiness: function calling, structured JSON output, multimodal and multilingual support, long-context trade-offs, license compliance, and cloud deployment planning. You get a reusable five-step selection framework plus engineering guidance on constrained decoding, defensive parsing, idempotency, RAG-based context trimming, and evaluation loops.

    1. Why “Multiple Model Sizes” Has Become the Standard Shape of Open-Source LLMs

    Over the past year, open-source LLMs have shifted away from a single flagship model toward model families that cover a full compute gradient. The reasoning is straightforward: deployment scenarios are inherently layered. Terminal devices such as phones, edge boxes, and laptops have limited compute and tight memory budgets, and simply cannot host a 10-billion-plus parameter model. Cloud inference, code generation, and complex agent orchestration, by contrast, care much more about reasoning quality and long-context capability. Trying to cover every scenario with a single product line is essentially a compromise between performance and deployability.

    As a result, current open-source model families are deliberately tiered: a lightweight, efficient variant for on-device use, a mid-size mixture-of-experts (MoE) variant that balances quality and throughput, and a larger dense variant that pushes the capability ceiling. Understanding this tiering logic is the prerequisite for good selection. It is not about “bigger is always better” — it is about “the right match for the scenario.”

    2. The Compute Gradient: Positioning and Trade-offs Across Four Tiers

    A typical open-source model family contains four tiers:

    • Lightweight / efficient (roughly 2B parameters): built for mobile and edge inference, with low latency and a small memory footprint. It can run on-device or even in the browser, which suits real-time completion and offline assistants.
    • Lightweight / enhanced (roughly 4B parameters): further capability gains while remaining deployable on-device, making it a good middle layer in device-cloud collaboration.
    • Mixture of experts (tens of billions of total parameters, sparsely activated): activating only a subset of expert networks per request delivers near-flagship inference quality while controlling per-token compute. This is the balance point between quality and cost.
    • Dense (tens of billions of parameters, fully activated): aimed at the capability ceiling and strongest on reasoning, code, and complex planning tasks. Typically deployed in the cloud or on high-performance workstations.

    One point deserves emphasis: parameter count is not the same as capability. Architecture design, training data mixture, and post-training quality (alignment and instruction tuning) often matter more than raw parameter count when a model is evaluated on real tasks.

    3. Dense vs. Mixture-of-Experts: The Core Difference

    The most common source of confusion during selection is the difference between dense and MoE models. Their inference-time behavior differs significantly:

    • Dense models: every token passes through all parameters, so the number of activated parameters equals the total parameter count. The advantages are an intuitive memory/compute relationship, stable inference behavior, and mature fine-tuning support. The cost is that inference cost rises linearly as capability increases.
    • MoE models: the network is split into multiple expert subnetworks, and each token is routed to only a few experts. Total parameters can be very large while per-inference activated parameters remain far smaller, which buys stronger expressive capacity under a comparable compute budget. The costs are higher memory consumption (all experts must be resident), additional routing complexity, and a higher bar for fine-tuning and inference framework support.

    The practical rule of thumb: choose dense when you value stability and operational simplicity, and choose MoE when you want a higher ceiling at the same latency — provided your team can handle its memory and framework complexity.

    4. From “Answering” to “Acting”: Reasoning and Agent Capabilities

    The competitiveness of modern open-source models has moved from “can it answer a single question correctly” to “can it complete a chain of tasks.” Multi-step planning, complex logical reasoning, and code generation are the three pillars of an agent workflow:

    1. Multi-step planning: the model decomposes a high-level goal into an ordered sequence of subtasks.
    2. Tool use: the model interacts with external systems through function calling — querying databases, running retrieval, invoking business APIs.
    3. Structured output: results are returned in strict JSON so downstream programs can parse them reliably.

    Only when these three combine does a model evolve from a conversational partner into an executor. This is also the technical foundation that makes agent applications viable in production.

    5. Implementing Function Calling and Structured Output

    Native support for function calling and structured JSON output is what determines whether a model can be integrated into a production system. Below is a vendor-neutral illustration of structured output, using a generic JSON Schema constraint:

    1. {
    2. "name": "submit_order",
    3. "description": "Submit an order",
    4. "parameters": {
    5. "type": "object",
    6. "properties": {
    7. "product_id": { "type": "string" },
    8. "quantity": { "type": "integer", "minimum": 1 },
    9. "coupon": { "type": "string" }
    10. },
    11. "required": ["product_id", "quantity"]
    12. }
    13. }

    Recommended engineering practices:

    • Constrained decoding: prefer the JSON-schema constraint capabilities offered by the model or inference framework to guarantee valid output at the decoding layer, rather than relying on a prompt that merely “asks” for JSON.
    • Defensive parsing: even with structured output enabled, validate and add fallbacks on the business side so malformed data never enters the core request path.
    • Idempotency and retries: tool calls often have side effects, so design idempotency keys and failure-retry mechanisms to prevent an agent from placing duplicate orders or charging twice during multi-step execution.

    6. Multimodal and Multilingual: Extending the Capability Boundary

    A newer generation of open-source models has moved from text-only to multimodal. A fairly common configuration is image and video understanding across the family, with the lightweight tier additionally supporting native audio input. For developers this means:

    • one model family can cover image-plus-text Q&A, video content understanding, and voice interaction, lowering the cost of maintaining multiple separate models;
    • audio support in the on-device lightweight tier makes real-time voice assistants and wearable devices in low-power scenarios feasible.

    On the multilingual side, training that covers a hundred-plus languages lets models serve cross-language products and global business. One caveat: actual quality for low-resource languages is often significantly lower than for high-resource languages, so run independent evaluations for your target languages before launch rather than assuming consistent performance across all of them.

    7. Long Context: Capability Gains and Cost Accounting

    Context window size is a key indicator of a model’s “memory and working space.” Two configurations are common among current open-source models: lightweight tiers around 128K context, while larger dense and MoE variants support up to 256K or more.

    The value of long context is obvious: an entire codebase, a long document, or many turns of history can be injected at once. But the cost has to be taken seriously — attention computation and memory usage typically grow superlinearly with sequence length. Engineering recommendations:

    • Prefer retrieval-augmented generation (RAG) to trim long context on demand instead of unconditionally filling the window.
    • For very long inputs, use chunked summarization or sliding windows to balance quality against overhead.
    • Define the context length the business actually needs during selection, and avoid paying inference costs for a long window you will never fill.

    8. Licensing and Commercialization: From “Usable” to “Safe to Ship”

    Open source does not mean unconstrained. Whether commercial use is permitted depends on the license. Permissive open-source licenses (Apache 2.0-style) impose relatively few restrictions on commercial use and allow modification and redistribution, typically requiring only that copyright and license notices be retained. Even so, a team should complete the following checks before adopting any open-source model:

    • Does the license permit the intended use (commercial deployment, closed-source distribution, further training)?
    • Are there additional terms of use or content policy restrictions attached?
    • Are the licenses of the model weights, the training data, and the inference framework consistent with each other?

    A proper license review prevents the awkward outcome of passing technical validation only to be sent back before launch over compliance.

    9. Cloud Deployment and a Selection Decision Framework

    Moving a model into production usually requires a full set of supporting infrastructure. Whichever cloud provider you choose, the following generic capability categories are a useful planning baseline:

    • Container platform: elastic scaling for inference services.
    • Object storage: holding model weights, datasets, and artifacts.
    • Message queue: decoupling multi-step agent tasks and asynchronous tool calls.
    • Logging, monitoring, and alerting: tracking latency, throughput, error rates, and invocation cost to catch quality regressions early.

    On Baidu AI Cloud, teams can combine these general cloud product categories to build a complete pipeline from model hosting to inference services to agent orchestration, using monitoring and alerting to continuously govern inference quality and resource cost.

    A reusable selection framework:

    1. Determine the deployment location: prefer the lightweight efficient tier on-device; prefer dense or MoE variants in the cloud.
    2. Set the capability baseline: do you need tool use, structured output, multimodality, long context?
    3. Account for the cost budget: factor in memory, latency, concurrency, and invocation fees together, rather than looking at single-GPU metrics alone.
    4. Verify compliance: confirm the license and terms of use before finalizing the technical selection.
    5. Build an evaluation loop: regress continuously on real business datasets to avoid the intuitive trap that “bigger parameters are always better.”

    Conclusion

    The value of multi-size open-source LLMs is that developers can draw compute precisely according to the scenario, instead of being forced into a single form factor. What determines whether a deployment succeeds is not a model’s rank on a leaderboard, but whether architectural trade-offs match the scenario, whether the agent pipeline is robust, whether cost accounting is clear, and whether compliance review is thorough. Work through these engineering fundamentals first, and the dividends of open-source LLMs can genuinely be converted into sustainable business capability.