Open-Source LLM Selection Guide: From Architecture to On-Device Deployment

    A practical guide to choosing open-source large language models: how to compare Dense and MoE architectures, interpret "effective parameter" claims, evaluate models across quality, throughput, token cost, and hardware constraints, estimate VRAM for weights and KV cache, and follow a deployment checklist for server and on-device scenarios.

    Open-Source LLM Selection Guide: From Architecture to On-Device Deployment

    1. Define Your Constraints Before Comparing Specs

    Discussions about open-source LLMs often revolve around leaderboard rankings. But leaderboard scores are influenced by the evaluation dataset, prompt templates, quantization method, and model version, so the same model can rank very differently across benchmarks. A more reliable approach is to first list your hardware constraints, latency requirements, and budget, then validate candidate models on your own business data.

    2. Dense vs. MoE: Two Architectural Trade-offs

    In a Dense model, all parameters participate in every inference pass. The benefit is stable behavior and a higher quality ceiling at a given parameter count. The cost is that compute and VRAM usage grow linearly with parameter count. For complex reasoning, long-document analysis, and high-quality code generation, Dense models are generally more consistent.

    MoE (Mixture of Experts) models split the feed-forward network into multiple groups of expert sub-networks, with a router selecting a small number of experts for each token. As a result, the total parameter count determines knowledge capacity, while the activated parameter count determines the compute cost per token.

    One easily overlooked point about MoE: the weights of all experts must be loaded into memory or VRAM. The router reduces compute, not storage. For example, an MoE model with 26B total parameters and 4B activated per token still requires VRAM close to that of a 26B-parameter model, while its per-step compute is closer to a 4B model. This makes MoE a better fit for server-side scenarios with sufficient VRAM but limited compute or throughput.

    MoE throughput gains also depend on the inference framework. Load imbalance across experts, low expert utilization at small batch sizes, and the overhead of the routing layer can all push actual throughput below theoretical values. Benchmark on your target framework before deciding, rather than relying on the spec sheet.

    3. Understanding “Effective Parameters”

    Some smaller models include labels such as “Effective” in their names. This means part of the parameters exist as lookup tables, such as Per-Layer Embedding (PLE). These embedding tables can be large, but during inference values are only fetched by index rather than participating in dense matrix multiplication. As a result, the actual compute per token is far smaller than the nominal parameter count suggests.

    When comparing models, distinguish at least three numbers:

    • Nominal total parameters: all weights plus embedding tables;
    • Effective compute parameters: the parameters that actually participate in matrix operations for each token;
    • Additional storage: the size of lookup-style parameters such as embedding tables.

    Different sources may report only one of these numbers for the same model. Mixing them in a comparison easily leads to wrong conclusions.

    For on-device deployment, this design has clear advantages. Phones and edge devices are typically bottlenecked by compute and memory bandwidth. Shrinking the frequently computed parameters and moving large, infrequently accessed tables into lookup structures reduces data movement per step. However, embedding tables still consume storage and memory, and they must be included in the memory budget.

    4. Evaluate Candidates Across Four Dimensions

    Model selection can be organized around four dimensions:

    1. Quality: accuracy on your own tasks, format compliance of structured outputs, and refusal rate.
    2. Throughput and latency: time to first token, tokens per second (TPS), and stability under concurrency.
    3. Token cost: the number of input and output tokens consumed per task.
    4. Hardware constraints: VRAM, memory bandwidth, power consumption, thermal limits, and offline requirements.

    Token cost is the most easily overlooked. Output tokens determine generation duration and directly drive API billing or local compute consumption. If two models have similar accuracy but one produces 20% longer outputs for the same task, the long-term cost difference is significant.

    You can calculate the cost per successful task with the following formulas:

    Cost per successful task = Average token cost per task ÷ Task success rate

    Average token cost per task = Average input tokens × Input price + Average output tokens × Output price

    Example: on the same batch of 100 tasks, Model A consumes 1.5 million output tokens and Model B consumes 1.2 million. With identical pricing and a 90% success rate for both, B’s token cost per task is 20% lower. These numbers only illustrate the calculation method—draw real conclusions from your own task set.

    5. Estimating VRAM with Formulas

    Estimating VRAM before deployment avoids repeated trial and error after startup failures.

    Weight memory ≈ Parameter count × Bytes per parameter

    • BF16 or FP16: 2 bytes per parameter;
    • INT8: 1 byte per parameter;
    • 4-bit quantization: roughly 0.5 bytes per parameter, plus metadata such as scaling factors, so actual usage is usually slightly higher.

    For example, a 30B-parameter model requires about 60GB for weights in BF16, or roughly 15GB with 4-bit quantization. That covers only the weights.

    Inference also requires a KV cache, which can be estimated as:

    KV cache bytes ≈ 2 × Number of layers × Number of KV heads × Head dimension × Context length × Concurrent requests × Bytes per element

    The factor of 2 accounts for separate Key and Value caches. Very long contexts and high concurrency make the KV cache grow rapidly, sometimes exceeding the weights themselves. A model advertising ultra-long context support does not mean a single GPU can simultaneously max out both context length and concurrency under default settings. Read the layer count, KV head count, and similar parameters from the model’s configuration file.

    6. Deployment Checklist

    1. Verify the license and model version, and record the version number or hash of the weight files.
    2. Estimate weights and KV cache as described in Section 5, leaving headroom for activations and runtime overhead.
    3. Choose an inference framework and confirm it supports the target architecture, the required quantization format, and—for MoE—expert routing.
    4. Launch the model with the chat template matching its training, run a handful of samples (no more than ten), and check that outputs are complete and correctly formatted.
    5. Run regression tests on your own dataset, comparing accuracy, structured-output compliance, and latency before and after quantization.
    6. Stress-test concurrency and record time to first token, TPS, and peak VRAM.
    7. Save launch parameters, framework version, and model version for rollback.

    7. Additional Considerations for On-Device Deployment

    Power consumption and thermal limits constrain sustained performance on edge devices. As device temperature rises, the chip may throttle