LLM Inference Model Selection Guide for High Concurrency
This guide explains why "fast" LLM variants are hard to compare directly and offers a practical framework for choosing inference models under high concurrency. It covers a weighted scoring model for the cost-quality-latency triangle, a load-testing approach based on replay and shadow traffic, typical profiles of three model categories, engineering optimizations, hybrid routing, on-premises deployment considerations, and ongoing governance after launch.
1. Why “Flash-Style” Models Are Hard to Compare Directly
In real engineering work, a model labeled as a “fast version” is not necessarily fast in your own workload. There are three reasons:
- Compute quotas are dynamic. To support a particular high-speed version, a platform may shift compute resources toward it. A model that is nominally fast can be “precisely slowed down,” and its measured throughput can fall well below the advertised figure.
- Latency has multiple components. Time to first token (TTFT) and per-token output speed (TPS) are two different things. One model may return the first token quickly but generate slowly, while another may be slow to start but produce output at a steady rate.
- The “small steps” effect. Models that produce fine-grained output, call tools frequently, and advance only a little at a time can significantly degrade the interactive coding experience, even when average throughput looks acceptable.
So selection should not rely on marketing figures. It should rely on reproducible metrics measured under your own traffic profile.
2. A Unified Evaluation Framework: Turning the Triangle into a Computable Objective Function
The industry’s well-known “cost-quality-latency” triangle can be formalized as a weighted score:
# Illustrative only: expresses the evaluation idea, not any specific product APIscore = w_q * quality_norm \+ w_c * (1 - cost_norm) \+ w_l * (1 - latency_norm)# Constraints: hard SLA thresholdsassert p95_ttft_ms <= TTFT_BUDGETassert p95_tps >= TPS_FLOOR
Key points:
- Normalize first, then apply weights. Otherwise the units will dominate the conclusion.
- Look at latency by percentile. A good p50 with a collapsing p95/p99 is the most common pitfall.
- Measure quality on your own business dataset. General leaderboards have limited relevance to your prompts, tool chains, and structured-output requirements.
3. A Practical Load-Testing Plan
A two-step approach of “replay plus shadow traffic” is recommended:
- Offline replay: Replay desensitized production logs and collect TTFT, TPS, error rate, and retry rate.
- Shadow comparison: The new model receives only mirrored traffic and does not return responses to users. Compare output consistency against the same prompts.
- Fix randomness: Keep temperature fixed and fix the seed (if supported) to reduce noise.
A minimal load-test loop example:
# Pseudocode: concurrent replay, output percentile metricsrun_bench --rps 20 --duration 10m \--metrics ttft,tps,error_rate \--replay prod_sample.jsonl
Suggested criteria for interpreting results:
- Interactive coding: prioritize TTFT p95, then TPS.
- Batch extraction or scheduled jobs: prioritize throughput and unit price; latency can be relaxed.
- High-concurrency online serving: error rate and retry rate must be included, because the long tail amplifies cost.
4. Positioning the Triangle: Typical Profiles of Three Model Categories
Abstracting away specific model names, the market commonly has three positioning categories:
- Speed-first: Low latency, medium quality, higher unit price. Suitable for real-time interaction, code completion, and first responses in dialogue.
- Quality-first: High quality, medium unit price, slow output. Suitable as a “near-flagship” for complex refactoring and difficult defect localization.
- Cost-first: Low unit price, medium quality, higher latency. Suitable for scheduled batch processing, offline cleaning, and non-real-time summarization.
The original experience-based judgment still holds after abstraction: there is no all-around champion, only combinations that match the scenario. When you have only a few models available, using the quality-first model as the “main brain” and the cost-first model for “heavy lifting” is a common and reliable approach.
5. Engineering-Side Optimization: Cut Unnecessary Time First
Before switching models, do these nearly zero-risk optimizations first:
- Prompt and skill constraints: Specify the output format clearly, reduce ineffective pleasantries, and limit the number of tool-call rounds. This can significantly improve the “small steps” problem.
- Prefix caching: Put stable system prompts and codebase context in the prefix. A cache hit can substantially reduce TTFT and cost.
- Batching and asynchrony: Merge requests for non-real-time tasks to increase throughput and dilute unit price.
- Streaming output plus skeleton-first: Return the structural skeleton first and then fill it in, improving perceived latency.
- Timeouts and fallback: Set budgets for long-tail requests and automatically fall back to the cost-first model on timeout.
6. Hybrid Routing: Turning the Triangle into a Strategy
In production, “routing plus fallback” is more recommended:
request -> classifier (simple/complex)|- simple -> cost-first|- complex -> quality-first`- timeout/failure -> speed-first fallback
Routing signals can be simple: input length, whether multiple files are involved, whether strict structured output is required, and the number of historical retries. This controls cost while preserving the long-tail experience.
7. Local and On-Premises Deployment Considerations
If data compliance requires local deployment, the selection logic changes:
- VRAM and concurrency are hard constraints. For the same model, different quantization levels, context lengths, and concurrency settings can produce huge throughput differences.
- Look at “effective throughput,” not peak values. Use the stable TPS under your business concurrency as the baseline.
- Count operational cost. The inference framework, batch scheduling, monitoring and alerting, and logging services all belong to total cost.
- A small model plus good constraints is often more cost-effective. For well-defined tasks, a smaller-parameter model combined with a strict schema often delivers better value.
8. Continuous Governance After Launch
- Build a quality regression set and run it on every change to prevent “optimization that shrinks quality.”
- Monitor percentile latency and retry rate, not just averages.
- Attribute cost by scenario to identify the long tail that truly burns money.
- Keep an abstraction layer for multiple providers and multiple deployments to avoid being locked into a single form.
9. Conclusion
There is no definitive answer to “which fast version is better”; it depends on your trade-off within the quality, cost, and latency triangle. The executable path is: first define SLAs and budget, then use replay load testing to obtain percentile metrics, then use prompts, caching, and batching to cut unnecessary overhead, and finally use hybrid routing to combine the three model categories into one pipeline. If you need general cloud capabilities such as managed inference, object storage, container platforms, and monitoring and alerting to carry this system, Baidu AI Cloud offers corresponding general product categories for evaluation.
