Evaluating Open-Source LLMs: Scale, Efficiency, and On-Device Deployment

    This article presents a practical framework for selecting open-source large language models. It explains why leaderboards are only a starting point, clarifies total, active, and effective parameters, compares dense and mixture-of-experts architectures, and shows how to estimate memory use. It then covers deployment constraints, capability validation for multimodal input, long context, function calling, multilingual tasks, and code generation; how to interpret benchmark scores statistically; and how to build a repeatable evaluation pipeline. It closes with scenario-based selection guidance, common pitfalls, and a checklist for final review.

    1. Why Leaderboards Alone Are Not Enough for Model Selection

    When an open-source model is released, leaderboard rankings are often the first thing people look at. Rankings do reflect a model’s relative performance on specific test sets, but they have three limitations.

    First, leaderboard scores are produced under fixed tasks, prompt templates, and inference settings. In real business scenarios, the input distribution, context length, and output format often differ from those in the test set. A high score does not guarantee strong performance on your workload.

    Second, adjacent models may differ by only a few tenths of a percentage point. On most test sets, this gap falls within statistical error, so it cannot be used to determine which model is stronger.

    Third, leaderboards usually reflect effectiveness but not cost. For the same score, memory footprint, response time per request, and compute cost per call can vary significantly.

    A sound approach is therefore to use leaderboards to shortlist candidates, then make the final decision with your own business data and deployment conditions.

    2. Understanding Different Expressions of Model Scale

    Model descriptions often include several kinds of “parameter count” metrics. They mean different things and should not be mixed.

    Total Parameters: The number of all weights in the model. This number determines the lower bound of storage occupancy.

    Active Parameters: The number of parameters that actually participate in computation during a single forward pass. In a mixture-of-experts architecture, total parameters are much larger than active parameters.

    Effective Parameters: Some small models use techniques such as per-layer embedding tables. These tables are large but are used only for fast lookup and do not participate in large matrix computations. As a result, compute is close to that of a smaller model, while storage remains close to the level implied by total parameters.

    Dense vs. Mixture-of-Experts Architectures:

    Dimension Dense Architecture Mixture-of-Experts Architecture
    Parameters per computation All parameters participate Only routed experts participate
    Inference speed Slower at the same scale Lower compute per pass and lower latency
    Memory footprint Proportional to parameter count All experts must be loaded, so footprint is higher
    Output quality Usually more stable at the same active compute Depends on routing quality and training method
    Best for Quality-focused and offline tasks Throughput-focused and high-concurrency serving

    When selecting a model, consider both “whether it fits” and “whether it runs fast enough.” A mixture-of-experts model has more total parameters and may have a higher loading threshold, but each request requires less computation, so throughput may be better.

    Memory Estimation: Weight memory can be roughly estimated with the following formula.

    1. Weight memory ≈ parameter count × bytes per parameter

    Take a 31B model as an example: with FP16 at 2 bytes per parameter, weights are about 62 GB; with INT8 at 1 byte per parameter, about 31 GB; with INT4 at about 0.5 bytes per parameter, about 15.5 GB. Actual runtime also requires KV cache, activations, and framework overhead. In long-context scenarios, KV cache may become the main consumer. Planning should therefore reserve at least 20% headroom and rely on measured results.

    3. Deployment Form Factors Define the Constraints

    Different deployment environments impose very different constraints. Selection should start by clarifying the environment, then evaluating models.

    Data centers or high-end workstations: Memory is usually tens of GB or more, suitable for large dense models or medium-to-large mixture-of-experts models. The focus is throughput, concurrency, and batching efficiency.

    Ordinary workstations or consumer GPUs: Memory is limited, and quantization is usually required. The focus is accuracy loss after quantization and single-user response speed.

    Mobile devices, embedded systems, and edge gateways: Memory, power, and thermal limits apply, so only small models or deeply compressed versions can run. The focus is first-token latency, power consumption, and offline availability.

    Deployment evaluation should record at least four types of metrics:

    1. First-token latency: the time from a user request to the first visible token, which directly affects interaction experience.
    2. Generation speed: usually measured in output tokens per second.
    3. Peak memory usage: determines whether the model can run stably.
    4. Cost per request: including compute resources and energy consumption.

    4. Validating Capabilities One by One

    Open-source model feature lists are often long, but each capability should be validated with your own samples rather than accepted directly from promotional descriptions.

    4.1 Multimodal Input

    Some models support image, video, or even audio input. The supported range may differ by model scale, and the official documentation should be the reference. Test cases can include:

    • Chart understanding: provide charts with axes and values, and check the accuracy of extracted numbers.
    • Receipt or form recognition: check the completeness of key field recognition.
    • Speech input: test recognition accuracy under target accents and noise conditions.

    4.2 Long Context

    A long context window does not equal effective utilization. As input length increases, the model may ignore information in the middle. Design targeted retrieval tests: insert key facts at different positions in long text and observe recall at different positions and lengths.

    4.3 Function Calling and Structured Output

    Agent-like applications depend on models outputting call parameters in an agreed format. Evaluation should check two things: whether the output passes format validation, and whether parameter values are correct.

    The following example shows a common validation approach:

    1. schema = {
    2. "name": "get_weather",
    3. "required": ["city", "date"],
    4. "properties": {
    5. "city": {"type": "string"},
    6. "date": {"type": "string", "format": "YYYY-MM-DD"}
    7. }
    8. }
    9. def validate_call(output_json, schema):
    10. # 1. Parse whether it is valid JSON
    11. # 2. Check whether required fields are present
    12. # 3. Check field types and formats
    13. # 4. Return an error list; pass if empty
    14. ...

    In real projects, classify failed samples separately and count failure types, such as format errors, missing fields, and wrong parameter values. Then optimize prompts or decoding constraints accordingly.

    4.4 Multilingual Capability

    Multilingual capability should be evaluated separately for each target language, not only by overall average score. Each language should have a test set built from real business corpora, and proper nouns, numbers, and dates should be checked for correct handling.

    4.5 Code Generation

    For code capability, unit test pass rate is recommended as the main metric. Given a function description and test cases, let the model generate an implementation, run the tests, and count the pass ratio. Also record readability and security issues in the generated code, such as injection risks or resource leaks.

    5. Interpreting Benchmark Scores Correctly

    Benchmark scores are useful references, but interpretation requires attention to the following points.

    Whether test settings are consistent. Whether inference mode is enabled, sampling temperature, prompt template, context length, and answer extraction method all affect scores. When comparing models, confirm that settings are identical.

    Whether score differences are significant. Test sets have limited sample sizes, so scores contain sampling error. Take 200 questions as an example. When accuracy is 85%, the standard error is approximately:

    1. Standard error = sqrt(p × (1 - p) / n) = sqrt(0.85 × 0.15 / 200) ≈ 0.036
    2. 95% confidence interval ≈ ±1.96 × 0.036 ≈ ±7 percentage points

    In this case, two models that differ by less than 1 percentage point cannot be reliably ranked.

    Whether output length is counted in cost. At the same score, fewer output tokens usually mean lower generation time and call cost. Record both score and average output length, and calculate cost per correct answer.

    Whether the test set is close to the business. Academic test sets may differ greatly from real business in question types, difficulty, and language distribution. Reliable conclusions come from tests on your own data.

    6. Building a Reusable Evaluation Process

    It is advisable to make model evaluation a fixed process that can be repeated whenever a new model or version appears.

    1. Define business metrics: For example, ticket classification accuracy, human ratings for document summaries, or code task pass rate. Metrics should be directly related to business value.
    2. Build a test set: Samples should cover the real request distribution, including common questions, edge cases, and known failure cases. A size of at least several hundred samples is recommended.
    3. Fix evaluation configuration: Set temperature to 0 or use a fixed random seed, use a unified prompt template, and record model version and inference parameters.
    4. Record performance data: Collect latency, throughput, memory, and output length at the same time.
    5. Validate with small traffic: Run a canary deployment in the real environment and compare online metrics.
    6. Run periodic regression: After model upgrades, prompt changes, or data updates, rerun the full test suite.

    An illustrative evaluation loop is shown below:

    1. def evaluate(model, dataset, metric_fn, config):
    2. records = []
    3. for case in dataset:
    4. start = now()
    5. output = model.generate(case.prompt, **config)
    6. latency = now() - start
    7. score = metric_fn(output, case.expected)
    8. records.append({"score": score, "latency": latency,
    9. "tokens": count_tokens(output)})
    10. return aggregate(records)

    7. Scenario-Based Selection Guidance

    There is no single answer for model selection. The following approaches for typical scenarios are for reference.

    Local code assistance and offline document processing: Quality requirements are high, while latency requirements are relatively relaxed. Prioritize larger models, use quantization to reduce memory usage, and retain sufficient context length.

    High-concurrency online services: Throughput and cost are key. Mixture-of-experts architectures are usually worth evaluating first because they require less computation per pass and can handle more requests on the same hardware. Focus on latency stability under batching.

    Mobile and edge devices: Hardware resources are limited, so the model must be small enough. Choose small-scale versions designed for on-device use and apply quantization and memory optimization. Functionality can be limited to simple Q&A, intent recognition, and local information extraction.

    Applications requiring multimodal or audio capabilities: First confirm whether models at the target scale support the required modalities, then evaluate recognition or understanding accuracy.

    8. Common Pitfalls

    • Looking only at parameter count: More parameters do not necessarily mean better results. Training data quality, post-training methods, and architecture design matter equally.
    • Relying on a single leaderboard: Different leaderboards emphasize different capabilities. Combine multiple benchmarks and prioritize business data.
    • Ignoring quantization loss: Quantization can significantly reduce resource usage, but it may cause noticeable degradation in mathematical reasoning, long-text, and code tasks. Measure it in practice.
    • Ignoring system cost: Memory, bandwidth, concurrency, and operational complexity all affect total cost. Looking only at model scores is not enough.
    • Ignoring safety and compliance: License terms, output moderation mechanisms, and data privacy requirements for open-source models should be confirmed during selection.

    9. Model Selection Checklist

    Before making a final decision, confirm each item:

    • Are the memory, RAM, and power limits of the deployment environment clearly defined?
    • Is there an in-house test set for the target task, and do samples cover the real distribution?
    • Have candidate models been compared under identical settings?
    • Do score differences exceed the range of statistical error?
    • Have latency, throughput, and cost per request been measured?
    • Have key capabilities such as target languages, multimodality, and function calling been validated?
    • Have license terms and compliance requirements been reviewed?

    Following this process makes selection conclusions more reliable and makes subsequent migration and maintenance costs easier to control.