LLM Inference Model Selection and Deployment: A Practical Guide

    This guide explains how to choose and deploy large language models for real production workloads. It introduces a four-dimension evaluation framework covering quality, latency, throughput, and cost, shows how to classify tasks before comparing models, and outlines a four-step process for building reproducible evaluation baselines. It also covers inference service design, cost modeling, and common selection mistakes to avoid.

    1. Background: Why Model Selection Became an Engineering Problem

    In real projects, teams often run into an awkward situation: a model performs well on brainstorming and open-ended ideation, but once the work moves into actual execution—code generation, structured document output, or long-chain reasoning—two problems appear. First, output quality is unstable, requiring repeated retries and manual review. Second, response latency is high, making it hard to fit into interactive workflows.

    Meanwhile, other models reach a similar level of intelligence on the same tasks but run nearly an order of magnitude faster. As a result, scenarios where one specific model is truly irreplaceable are becoming rare.

    This shows that model selection has evolved from “checking benchmark scores” into a multi-dimensional engineering problem. Comparing general capability rankings alone cannot answer “which model should I use in my business, how do I deploy it, and how do I control cost?” Below is a practical approach for evaluation and deployment.

    2. A Four-Dimension Evaluation Framework: Quality, Latency, Throughput, Cost

    1. Quality: Use Business Metrics Instead of General Leaderboards

    General leaderboards are only useful for initial screening. A more effective approach is to break business tasks into a testable evaluation set, for example:

    • Structured output compliance rate (complete fields, valid format, ready for direct ingestion);
    • Factual consistency (citations are verifiable, nothing fabricated);
    • Long-context utilization (whether recall of key information degrades as length grows);
    • Multi-turn task completion rate (whether human takeover is required).

    It is recommended to define an automated validation script for each sample, turning “feels good” into regression-testable numbers.

    2. Latency: Separate Time to First Token from Total Completion Time

    Interactive applications care about time to first token, while batch processing cares about total completion time. Both are affected jointly by input length, output length, and concurrency, so a single number cannot summarize them. In practice, fix the input and output length distributions and record P50/P95/P99 rather than averages.

    3. Throughput: Stability Under Concurrency

    A fast single request does not mean stability under high concurrency. You need to observe, at the target concurrency level, whether throughput scales linearly, whether queuing latency stays under control, and whether the error rate rises.

    4. Cost: Cost per Unit of Effective Output

    Cost should be calculated per “thousand successful tasks” or per “ten thousand effective tokens,” including retries, validation, and human fallback—not just the unit price.

    3. Scenario Breakdown: First Decide Which Category the Task Belongs To

    Task Type Key Requirement Selection Preference
    Ideation, brainstorming Diversity, associative ability Higher latency acceptable
    Code and structured generation Correctness, format compliance Quality first, with validation
    High-concurrency online interaction Time to first token, stability Throughput and cost efficiency first
    Long-document understanding and summarization Long-context recall Balance quality and latency

    Once the task type is clear, most debates resolve themselves: the question is not “which model is stronger” but “which category is more suitable.”

    4. Evaluation Process: Build a Reproducible Baseline in Four Steps

    1. Build a small gold-standard set (100–300 items) covering typical and boundary samples;
    2. Fix inference parameters (temperature, max output length, timeout) to ensure comparability;
    3. Run automated validation plus manual spot checks, producing quality and stability reports;
    4. Load-test at the target concurrency, recording latency distribution and resource usage.

    Example validation logic:

    1. def evaluate(sample, response):
    2. checks = {
    3. "schema_ok": validate_schema(response, sample.schema),
    4. "citation_ok": all(c in sample.source for c in extract_citations(response)),
    5. "length_ok": len(response) <= sample.max_tokens,
    6. }
    7. return sum(checks.values()) / len(checks)

    5. Building Inference Services: Make Performance Predictable

    • Deployment: Prefer container platforms that support elastic scaling, with automatic scale-out and scale-in based on concurrency;
    • Traffic management: Use message queues to smooth peaks and fill valleys, preventing traffic bursts from overwhelming the backend;
    • Observability: Integrate logging services and monitoring alerts, setting thresholds for latency, error rate, and queue length;
    • Model tiering: Route high-value requests through a quality-first path and massive simple requests through a cost-efficient path;
    • Caching and reuse: Cache results for high-frequency repeated requests to significantly reduce wasted compute.

    In general-purpose compute environments, multi-GPU single-machine setups, tensor parallelism, and batch scheduling are common optimization techniques; actual gains should be based on your own load tests rather than copying external data.

    6. Cost Modeling: Do the Math

    A suggested formula for budgeting:

    1. Monthly cost ≈ (request volume × average tokens × unit price) + retry overhead + human fallback cost + idle resource cost

    Retry overhead is often underestimated: unstable quality triggers cascading retries, and the final cost may exceed that of a lower-unit-price option. Only by using “effective output” as the denominator can you make the right trade-off.

    7. Common Mistakes

    • Making decisions directly from general leaderboards while ignoring differences in business distribution;
    • Looking only at average latency while ignoring the long tail;
    • Comparing only unit price rather than cost per unit of effective output;
    • Lacking automated validation, making quality impossible to regression-test;
    • Skipping concurrency load tests before launch, leading to inaccurate capacity planning.

    8. Conclusion

    The essence of model selection is finding the balance point among quality, latency, throughput, and cost that matches the business. Teams are advised to establish a standard process of “scenario breakdown → metric baseline → load-test validation → cost modeling,” and to leverage general capabilities such as container platforms, message queues, logging services, and monitoring alerts from Baidu AI Cloud to turn inference services into measurable, rollback-capable, and scalable engineering assets rather than one-off subjective judgments.