Choosing an LLM Deployment Model: Balancing Performance Ceiling and Deployment Cost

    A guide to choosing an open-source large language model for deployment. It covers how to weigh capability against cost, estimate GPU memory requirements, compare common inference optimizations such as quantization and continuous batching, and measure latency and throughput.

    Why Deployment Selection Has Become a Separate Topic

    Open-source large language models keep improving. In programming, mathematical reasoning, and multi-step task execution, they now approach the level of some closed-source models. As the capability ceiling rises, the question for teams becomes: under their own hardware, budget, and latency requirements, which model fits best?

    Capability metrics and deployment metrics often diverge. The model with the highest benchmark score may require several high-end accelerator cards to run, with high cost per request and long response times. Such a model may not suit online services serving large numbers of users. Deployment selection therefore needs to compare model capability, resource consumption, response speed, and operational complexity side by side.

    Differences Between the Two Model Positions

    Within the same model generation, providers typically offer two directions. The first targets the capability ceiling. These models have large parameter counts and perform more stably on complex reasoning and long-chain tasks, making them suitable for offline analysis, high-value decision support, and complex code generation. The second targets engineering efficiency. Lighter architectural designs and inference optimizations reduce GPU memory usage and computation, making them suitable for high-concurrency, low-latency, cost-sensitive workloads.

    The gap between the two is usually uneven. On simple tasks, such as text formatting, information extraction, and common Q&A, results may be very close. On difficult tasks, such as multi-round planning, long-context tracking, and complex Agent workflows that call multiple tools, the larger version has a more pronounced advantage. Selection should not focus on a single model. Instead, first break down the distribution of task difficulty in the business, then decide which model tier to use for each task type.

    Calculate GPU Memory Requirements Before Choosing a Model

    GPU memory is the first barrier to deployment. Weight memory can be estimated by multiplying the parameter count by the bytes per parameter. At common precisions, FP16 uses 2 bytes per parameter, INT8 uses 1 byte, and INT4 uses about 0.5 bytes. For a model with 100B total parameters, FP16 weights need about 200 GB, and INT4 weights need about 50 GB. Actual operation also requires KV cache, activations, and the overhead of the inference framework itself, so a memory margin above the weights is usually reserved.

    1. def estimate_memory_gb(params_billion: float,
    2. bytes_per_param: float,
    3. overhead_ratio: float = 0.2) -> float:
    4. """Estimate the GPU memory (in GB) needed for model weights plus runtime overhead.
    5. params_billion: parameter count in billions
    6. bytes_per_param: bytes per parameter; 2 for FP16, 1 for INT8, 0.5 for INT4
    7. overhead_ratio: extra runtime overhead ratio; calibrate by measuring under actual workloads
    8. """
    9. weights_gb = params_billion * bytes_per_param
    10. return weights_gb * (1 + overhead_ratio)
    11. # Example: estimated memory for a 100B-parameter model at different precisions
    12. for name, bpp in [("FP16", 2), ("INT8", 1), ("INT4", 0.5)]:
    13. print(name, round(estimate_memory_gb(100, bpp), 1), "GB")

    In Mixture-of-Experts (MoE) architectures, the total parameter count determines GPU memory usage, while the number of parameters activated in each forward pass determines the computation per step. These models may still require large GPU memory capacity, but they can outperform dense models with the same total parameter count in throughput. Evaluation should consider both the total and the activated parameter counts.

    The size of the KV cache grows with concurrency and context length. In long-context scenarios, the KV cache often fills GPU memory faster than the weights do. When validating a deployment plan, test with the combination of maximum concurrency and maximum context length. Confirming that the model loads is not enough.

    Common Inference Optimization Techniques

    • Quantization: Converts weights from high precision to low precision to reduce GPU memory usage and possibly improve memory access efficiency. Quantization causes some accuracy loss, so output quality must be verified on the target task.
    • Continuous batching: Dynamically merges computation across requests to raise accelerator utilization. It is a common way to improve throughput.
    • KV cache management: Manages the cache with paging and reuses computation results for shared prefixes, reducing redundant calculation. Scenarios with a fixed system prompt benefit noticeably.
    • Speculative decoding: A small model generates candidate tokens first, and the large model verifies them in parallel. The gain depends on the candidate hit rate, so the more regular the task, the better the results.
    • Tensor parallelism: Splits the model across multiple cards to handle models that do not fit on a single card. It introduces communication overhead between cards.

    These techniques affect one another. Memory freed by quantization can support larger batches, but under long contexts the KV cache can still become the bottleneck. Each optimization should be tested separately under real workloads before being combined.

    Evaluating Latency and Throughput

    When evaluating online inference services, focus on three metrics. Time to first token (TTFT) determines how long users wait before the first word appears, and it has the largest impact on interactive experience. Time per output token (TPOT) determines how smoothly the output streams. System throughput (tokens/s or requests/s) determines how many requests a unit of hardware can serve, which directly affects cost.

    Test inputs should resemble the real distribution, covering prompts of different lengths, different output lengths, and different concurrency levels.