LLM Inference Model Selection and Deployment: A Practical Guide for Production Architecture

    This guide explains how to choose and deploy large language models by task layer rather than picking a single model for everything. It covers workload classification, structured quality evaluation, throughput and cost estimation, deployment options, and an engineering checklist to balance quality, latency, and cost.

    1. Why Model Selection Is an Architecture Problem

    In real projects, teams usually run three very different types of workloads at the same time:

    • Requirements clarification and solution brainstorming, which are sensitive to divergence and expression quality.
    • Complex reasoning and long-chain tasks, such as mathematical derivation, code refactoring, and document writing, which are sensitive to accuracy and stability.
    • High-frequency, short-path execution tasks, such as format conversion, field extraction, and intent classification, which are extremely sensitive to latency and throughput.

    The early approach was often to use one model for everything. As business complexity grows, the drawbacks of this approach quickly become clear: high-capability models are used for simple tasks, which significantly inflates unit cost, while low-latency models are used for complex reasoning, which creates rework and manual fallback costs. Model selection should therefore not be a one-time decision, but an architectural layer that evolves continuously.

    2. Task Layering: Classify First, Then Select

    Divide business workloads into three layers and define clear acceptance metrics for each:

    • Divergence layer (brainstorming, copy candidate generation): focus on candidate diversity and readability. Some noise is acceptable, and acceptance is mainly based on human adoption rate.
    • Reasoning layer (complex logic, long documents, code and math tasks): focus on accuracy, reproducibility, and concise chain of thought. Acceptance is mainly based on pass rate and rework rate.
    • Execution layer (extraction, conversion, routing, batch processing): focus on time to first token, throughput per unit time, and retry cost on failure. Acceptance is mainly based on P95 latency and cost per 1,000 calls.

    After layering, model selection becomes an engineering question of “what capability tier and deployment form to use for each layer,” rather than a vague comparison of “which model is stronger.”

    3. Quality Evaluation: Turn Subjective Feelings into Measurable Metrics

    Many teams rely on personal experience during evaluation, making conclusions hard to reuse. A more reliable approach is to build a small but structured evaluation set:

    1. Sample real requests, stratified by task type, with no fewer than several hundred items per layer, covering long-tail inputs.
    2. Define automatic and human metrics for each layer. Automatic metrics can include accuracy, format compliance rate, and field completeness rate. Human metrics can include adoption rate, amount of modification, and whether the chain of thought is verbose.
    3. Introduce the hidden metric of “rework cost”: if one output requires multiple rounds of correction, its real cost is far higher than the price of a single call.

    An illustrative evaluation record structure is shown below (it only expresses the field design idea):

    1. {
    2. "task_layer": "reasoning",
    3. "sample_id": 1024,
    4. "auto_score": 0.82,
    5. "human_adopted": true,
    6. "rounds_to_pass": 2,
    7. "latency_ms_p95": 5400,
    8. "cost_per_1k_calls": 3.7
    9. }

    Once evaluation data reaches a certain scale, teams often observe a common pattern: in most routine scenarios, the gap between mid-tier and top-tier models is far smaller than the price gap; only on a few highly difficult tasks does the top-tier model’s advantage truly appear. This is the basis for layered model selection.

    4. Performance and Cost: Throughput Sets the Architecture Ceiling

    The key constraint for execution-layer workloads is not “smart enough,” but “fast enough.” Throughput is usually determined by parallelism, batching strategy, GPU memory, and interconnect bandwidth, so evaluation should focus on the following engineering methods:

    • Batching and continuous batch scheduling: merge multiple requests for inference to significantly increase completed work per unit time.
    • KV cache reuse: reuse cached shared prefixes (system prompts, templates, few-shot examples) to reduce repeated computation.
    • Quantization and parallelism strategies: use low-bit quantization within acceptable accuracy, combined with tensor parallelism and pipeline parallelism to scale single-machine and multi-machine capacity.
    • Elastic scaling and queue-based peak shaving: use a message queue to buffer burst traffic and automatically scale containers based on queue length.

    A simplified capacity estimation logic is as follows:

    1. Required instances ≈ peak QPS × average output tokens ÷ (output tokens per second per instance × target utilization)
    2. Cost per request ≈ instance hourly cost ÷ (output tokens per second × 3600 ÷ average output tokens)

    It must be emphasized that any throughput and cost conclusion must be based on measurements from your own evaluation set. Vendor-stated values often deviate from real business distributions.

    5. Deployment Form: Managed Services vs. Self-Hosted Inference

    • Managed services: fast integration and no operations burden, suitable for scenarios with large traffic fluctuations and teams lacking inference optimization experience; the cost is higher unit cost and limited customization.
    • Self-hosted inference: can lower unit cost through batching, cache reuse, quantization, and parallelism optimization, suitable for stable high-concurrency scenarios; the cost is the need to invest in operations, monitoring and alerting, and capacity planning.
    • Hybrid form: core paths use managed services to ensure stability, while batch and offline tasks run on self-hosted clusters, with a unified gateway handling routing and fallback.

    Regardless of the form, logging services and monitoring alerts should be in place, with baselines for latency, failure rate, and retry count, to avoid discovering capacity problems only on the business side.

    6. Engineering Implementation Checklist

    1. Build a unified model gateway that hides underlying differences and supports routing by task layer and canary switching.
    2. Set timeout, retry, and fallback policies for each layer to prevent single-point failures from spreading.
    3. Version-control prompts and templates to ensure evaluation results are reproducible.
    4. Cache results of high-frequency repeated requests, especially highly templated execution-layer tasks.
    5. Regularly run regression evaluations with new samples to prevent undetected “effect drift.”
    6. Break down the cost dashboard by business line to locate the truly high-consumption paths.

    7. Common Pitfalls

    • Selecting models only by leaderboard rankings: leaderboard tasks are inconsistent with business distributions, so their reference value is limited.
    • Ignoring chain-of-thought length: overly long reasoning amplifies latency and cost, and concise does not mean weak.
    • Treating speed problems as model problems: most latency bottlenecks are in batching, caching, and networking, not the model itself.
    • Making a one-time decision: model capabilities keep iterating, so selection should retain a switchable abstraction layer.

    8. Conclusion

    The essence of model selection is a structured trade-off among quality, latency, and cost. Layer first, evaluate next, then decide the deployment form, supported by a unified gateway and observability system, to achieve a sustainable balance between effectiveness and efficiency and let every capability upgrade land smoothly.