LLM Selection Guide: Evaluating Capability, Speed, Cost, and Compliance
This guide outlines a practical framework for selecting large language models (LLMs) by balancing capability, speed, cost, and compliance. It covers how to build custom evaluation sets, measure latency and throughput, calculate token-based costs, understand the Mixture of Experts (MoE) architecture, estimate VRAM for open-source models, and review licensing requirements.
1. Selection Framework and Decision Process
Once a large language model (LLM) is integrated into a business system, teams typically face three types of issues: unstable answer quality, response times exceeding acceptable user limits, and rapidly increasing API costs as traffic grows. These three problems are interconnected. Using a larger model usually improves quality but extends latency and drives up costs. Conversely, opting for a smaller model has the opposite effect.
Therefore, model selection should compare four dimensions—capability, speed, cost, and compliance—within a unified table, following this decision process:
- Use a custom evaluation set to filter out candidate models that fail to meet capability requirements.
- Measure Time To First Token (TTFT) and throughput under production-like loads.
- Calculate per-call and daily average costs based on token usage.
- Review data destinations and open-source licenses.
- Among the compliant candidates, select the model that best balances cost and quality, while keeping a backup model on standby.
Note: All numbers in this article are computational examples and do not represent the actual metrics of any specific product.
2. Using Custom Evaluation Sets Over General Benchmarks
Public benchmarks cover scenarios like math, coding, and knowledge QA, reflecting a model’s general proficiency. However, benchmark questions may have already appeared in the training data, and the question types might not align with your business needs. Only a custom evaluation set can answer whether a model performs well in your specific context.
You can build an evaluation set using the following template:
- Sample Source: Extract 200 to 500 requests from real logs, maintaining a certain ratio between high-frequency and edge cases. Edge cases include excessively long inputs, ambiguous questions, sensitive topics, and requests with strict formatting requirements.
- Scoring Rubric: Define the pass conditions for each sample. For example, “Amounts and dates match the source text,” “Output is valid JSON,” or “No unauthorized personal information is included.” Prioritize automated rule-based checks where possible; for cases that cannot be checked by rules, clearly define the boundaries for manual judgment.
- Batch Invocation: Call all candidate models using the same prompt, temperature parameters, and maximum output length limits, recording the results for each sample.
- Dual Review: Two annotators score independently. Disputed samples are adjudicated by a third person, and the adjudication rationale is written back into the rubric to prevent recurring disputes over similar issues.
- Update Cycle: Monthly or after any business changes, add newly emerging request types and discard samples that are no longer representative.
After the evaluation, summarize the results in the following table:
| Candidate Model | Pass Rate | TTFT P95 | Throughput | Per-Call Cost | Compliance Conclusion | Recommendation |
|---|---|---|---|---|---|---|
| Model A | TBD | TBD | TBD | TBD | TBD | TBD |
| Model B | TBD | TBD | TBD | TBD | TBD | TBD |
3. Speed: Measuring TTFT and Throughput
Speed should be broken down into at least two metrics:
- Time To First Token (TTFT): The time from sending a request to receiving the first output fragment. It determines the user’s perception of whether the system is “stuck.”
- Generation Throughput (tokens per second): The rate at which the model continuously outputs tokens. It determines the completion time for long answers.
Interactive scenarios should prioritize TTFT. Batch processing tasks should focus more on throughput and the number of requests processed per unit of time.
These two metrics can only be compared under the same measurement criteria. When testing, record the following conditions:
- Concurrency: Test under concurrency levels of 1, 8, 32, etc., and document the results for each tier. Single-concurrency data cannot reflect peak load performance.
- Streaming Toggle: TTFT can only be measured with streaming output. Non-streaming interfaces only yield total elapsed time.
- Statistical Percentiles: Report P50 and P95, not just averages. Tail latency directly impacts user experience.
- Input/Output Length: Fix input and output lengths, or sample based on the real distribution, and clearly state the distribution.
- Network and Warmup: The test machine should have a network path similar to the production environment. The first few calls often include connection setup and cache warmup, so these initial results should be discarded.
4. Cost: Calculating by Token
Most pay-as-you-go services price based on the number of input and output tokens, with output typically priced higher than input. The estimation formula for per-call cost is:
Per-Call Cost = Input Token Count × Input Price + Output Token Count × Output Price
Assuming an input price of $1 per million tokens and an output price of $2 per million tokens. A request containing 2,000 input tokens and 500 output tokens would cost:
Per-Call Cost = 2000 × 1 / 1e6 + 500 × 2 / 1e6 = $0.003
Assuming 100,000 daily requests, the daily cost would be approximately $300. These prices are solely for demonstrating the calculation method; actual prices are subject to the service provider’s official documentation.
Beyond unit price and request volume, the following factors significantly alter the actual cost and should be verified individually during estimation:
- Input/Output Ratio: If your business primarily involves summarizing long texts, input tokens will dominate, making the input price the primary cost factor. If it primarily generates content, the output price has a larger impact.
- Cache Hits: Some services offer cached pricing for repeated prompt prefixes. You need to verify the billing rules, hit conditions, and validity period for the cache, then estimate the discount based on the hit rate.
- Retries: Timeouts or rate-limiting-induced retries will result in duplicate charges. Incorporate the retry rate into your cost model and set a retry limit.
- Long Contexts: The longer the context, the more input tokens per request. If the system attaches the full chat history every time, costs will scale with the number of dialogue turns. Periodically truncate or summarize historical content.
- Reasoning Outputs: Some models generate lengthy internal reasoning content first. This content may count toward output tokens and needs to be tracked separately during evaluation.
5. Mixture of Experts (MoE): Principles and Applicable Boundaries
The Mixture of Experts (MoE) architecture is a design that allows a model to have “many parameters, but less computation per token.” Understanding how it works helps determine if it suits your scenario.
An MoE layer typically replaces the Feed-Forward Network (FFN) module in a Transformer and consists of the following parts:
- Expert Layer: Composed of N structurally identical small FFNs, where each expert has independent parameters.
- Router (Gate): A small linear layer. For each token, it computes a set of scores for all experts.
- Top-k Selection: The router selects only the top k experts with the highest scores (e.g., k=2) and computes a weighted sum of the outputs of these k experts based on normalized weights.
This design brings sparse activation. Each token only passes through k experts, so the computation for a single forward pass is determined by the activated parameters, not the total parameters. Assuming a model has N=8 experts and k=2, the expert parameters actually used per token account for about one-fourth of the total FFN parameters. This is just a structural estimate; actual computation also depends on the attention layers and other modules.
There are several boundaries to note with MoE:
- Load Balancing: If the router constantly assigns tokens to a few experts, the remaining experts are barely trained. Auxiliary losses or bias terms are usually added during training to balance the load. When selecting a model, you can check the model card for mentions of this, but you cannot directly verify the training effectiveness.
- Communication Overhead: When experts are distributed across multiple GPUs, tokens must be sent to the devices hosting the corresponding experts via all-to-all communication, and the results must be retrieved. Network bandwidth and latency can become bottlenecks, especially during small-batch inference.
- VRAM Boundary: The parameters of all experts must be accessible. Unless a specialized offloading scheme is used, VRAM requirements are dictated by total parameters, not activated parameters.
- Small Batch Utilization: At very small batch sizes, only a few tokens enter the router, leaving most experts idle and resulting in low GPU utilization. MoE’s throughput advantage is primarily evident in high-concurrency scenarios.
Therefore, MoE is better suited for high-concurrency, throughput-prioritized services. If your business involves single-GPU deployment, low concurrency, and extreme latency sensitivity, a dense model might be easier to deploy and tune. The final decision should still be based on the results of your custom evaluation set, not on parameter scale or architecture names.
6. VRAM Estimation for Open-Source Models
Before deploying an open-source model, you need to estimate whether your VRAM is sufficient. The estimation is divided into four parts.
1. Model Weights
Weight Usage = Parameter Count × Bytes per Parameter
Assuming a 70B parameter dense model:
- FP16 or BF16 (2 bytes per parameter): ~140 GB
- INT8 (1 byte per parameter): ~70 GB
- INT4 (~0.5 bytes per parameter): ~35 GB (quantization metadata must also be accounted for in practice)
For MoE models, weight usage is calculated based on total parameters. Assuming an MoE model with 200B total parameters and 20B activated parameters, storing in FP16 requires about 400 GB for weights, not 40 GB.
2. KV Cache
The KV Cache grows linearly with sequence length and concurrent request count. The estimation formula is:
KV Cache = 2 × Number of Layers × Number of KV Heads × Dimension per Head × Sequence Length × Batch Size × Bytes per Element
Assuming a model has 80 layers, 8 KV heads, a head dimension of 128, using FP16, and a sequence length of 4096:
- At batch size 1: 2 × 80 × 8 × 128 × 4096 × 1 × 2 ≈ 1.34 GB
- At batch size 32: ~43 GB
This shows that concurrency often has a greater impact on VRAM than model weights.
3. Parallel Partitioning
When using Tensor Parallelism or Pipeline Parallelism, weights are distributed across multiple GPUs. The per-GPU weight usage is approximately total weights divided by the number of parallel GPUs. KV Cache is also typically partitioned by head or layer, but the partitioning method depends on the inference framework.
4. Reserved Space
VRAM needs reserved space for activations, framework overhead, memory fragmentation, and burst requests. There is no fixed ratio for this. As a starting assumption: reserve 15% to 20%. The actual value should be verified through testing on the target framework.
Checklist:
- Weights calculated based on target precision and parallelism; per-GPU usage confirmed
- KV Cache calculated based on maximum sequence length and target concurrency
- Reserved space is at least 15%, verified through stress testing
- Confirmed that the inference framework supports the model’s architecture and quantization format
- Completed a full stress test under maximum sequence length and maximum concurrency
7. Licensing and Compliance Review
A compliance review needs to answer two sets of questions.
The first set concerns data destinations:
- Will the service provider use requests or outputs for model retraining? Can this be turned off via settings?
- In which region is data stored? How long is it retained? Is there a deletion API?
- Are there sub-processors? In which regions are they located?
- Does it meet industry regulatory requirements, such as personal information protection, cross-border data transfer, or record-keeping requirements for specific industries?
The second set concerns open-source licenses. License terms are often overlooked, but they directly determine whether a deployment plan is viable and should be verified item by item:
- Commercial Use: Is it allowed for use in commercial products or services?
- Modification: Is fine-tuning, quantization, or rewriting the model permitted?
- Redistribution: Is it allowed to provide the model or its derivatives to third parties?
- Attribution: Must the original author be credited or copyright notices retained when used?
- Usage Restrictions: Does the license prohibit certain uses, such as in specific industries or regions? Usage restrictions may come with enforcement conditions.
- Patent Provisions: Does the license include patent grants or patent retaliation clauses?
- Liability Limitations: Does the license state that the model is provided without any warranties, and that the liability is borne by the user?
