Open-Source LLM Deployment Guide: Model Selection, Deployment, and RAG in Practice

    This guide covers how to choose, deploy, and evaluate open-source large language models. It explains how the total and activated parameter counts of Mixture-of-Experts models affect memory and latency, compares open-source and closed-source models from an engineering standpoint, and offers a selection checklist. It also describes private deployment design on Kubernetes, a RAG pipeline with evaluation metrics, monitoring and autoscaling thresholds, and integration code with streaming and retry handling.

    Open-source large language models have improved noticeably over the past year. Some public benchmarks show that the top open-source models now score close to leading closed-source models. However, similar scores do not mean every business task can switch over directly. Model selection, deployment, and evaluation still need to be done separately for each use case. The sections below cover parameters and cost, capability comparison, selection, deployment, RAG, monitoring, and integration.

    1. Parameter Scale and Inference Cost

    It was once common to assume that model capability scales with parameter count, but larger models also cost more to run. Most mainstream open-source large language models now use a Mixture-of-Experts (MoE) architecture. These models split their parameters into multiple expert networks, and each token activates only a subset of them. For example, the publicly released DeepSeek-V3 has about 671 billion total parameters, and about 37 billion of them are activated for each token.

    This distinction affects deployment directly. The total parameter count sets the lower bound on GPU memory, because the weights of all experts must stay resident in memory. The activated parameter count determines the compute required per inference step and the resulting latency. As a result, a model with a very large total parameter count is not necessarily much slower than a smaller dense model, but it will always require more memory.

    Quantization reduces memory usage. After INT8 or INT4 quantization, the weights shrink noticeably, but accuracy may drop, so you should re-test on your own business data. PagedAttention and KV cache quantization can increase concurrency. However, actual throughput depends on context length and batch size, so it can only be determined through load testing. Overall, a mid-sized enterprise GPU cluster can run large MoE models, provided that quantization and memory optimization are applied and the concurrency limit is defined clearly.

    2. Understanding the Gap Between Open-Source and Closed-Source Models

    On general benchmarks such as MMLU and GSM8K, the gap between leading open-source and closed-source models is narrowing. However, benchmark results depend heavily on model version, evaluation protocol, prompt format, and the number of few-shot examples. The same model can score quite differently under different settings. When you cite public leaderboards, state the model version and the evaluation conditions.

    For most routine tasks, such as text summarization, sentiment analysis, and basic question answering, open-source models are usually capable enough. In some Chinese-language business scenarios, open-source models may perform better because their training data is closer to the local context. These conclusions still need to be validated on your own test set.

    The trade-off between the two model types is mainly an engineering decision. Closed-source APIs offer no infrastructure to maintain, high availability, and built-in multimodal capabilities. Open-source models keep data inside your own environment, support private deployment, and allow fine-tuning on business data. The costs of an open-source approach include GPU purchase or rental, operations staffing, and the effort of upgrading models.

    3. Selection Checklist

    When choosing a model, score it on at least the following six dimensions, and test each one with your own samples.

    Dimension Question to answer How to assess
    Data sensitivity Can the data be sent to an external service? Compliance review and data classification
    Latency What are the upper limits for time to first token and total response time? Load testing with realistic concurrency
    Context length How many tokens do typical documents and conversations contain? Analysis of business samples
    Tool calling Is function calling required, and what is the success rate? Testing with a fixed set of cases
    Private deployment cost What are the monthly costs of GPUs, data center space, and operations staff? Convert to total cost of ownership per month
    SLA What availability commitment and recovery time are required? Check the provider’s terms or your own internal targets

    If data sensitivity is high, prioritize a privately deployed open-source model. If the team is small and lacks operations capacity, a managed API may be more cost-effective. Cloud providers such as Baidu AI Cloud offer managed GPUs and object storage, which suit teams that do not want to build their own data centers. Before using these services, confirm pricing, quotas, and data residency regions, and assess whether public cloud deployment is permitted for your use case.

    4. Key Design Points for Private Deployment

    In Kubernetes, the device plugin exposes GPU resources to the scheduler, which enables basic GPU scheduling. However, the device plugin itself cannot split the memory of one GPU into multiple slices. Fine-grained partitioning requires other mechanisms. Three common approaches are:

    • MIG (Multi-Instance GPU): supported only on some data-center GPUs, and provides h