Local LLM Deployment: A Practical Framework for Model Selection and Production Rollout

    Deploying large language models locally is not simply a matter of downloading the most powerful model available. It is a systems engineering effort constrained by use case, hardware, licensing, data security, operations, and evaluation. This article presents a reusable framework for selecting and operationalizing local LLMs. It covers requirement definition, verifiable model acquisition, capability-based selection, memory and quantization planning, service architecture, benchmarking, compliance, and common pitfalls. Rather than recommending specific model versions, it focuses on methods that developers and enterprise teams can apply to evaluate candidates, control costs, and manage risk as models evolve.

    Local LLM deployment is not simply a matter of “finding the strongest model and downloading it.” It is a systems engineering effort constrained simultaneously by use case, hardware, licensing, data security, operations, and evaluation. Model versions iterate quickly, and fixed model leaderboards often become outdated soon. A more robust approach is to build a reusable framework for model selection and deployment: first clarify business goals and constraints, then shortlist candidates by capability category, and finally reach conclusions through offline evaluation, stress testing, and canary validation. This article does not provide specific model recommendations; instead, it offers a practical methodology for developers and enterprise teams.

    1. Define the Problem First: What Is Local Deployment Actually Solving?

    Before discussing “which model to recommend,” four questions should be answered first.

    First, what is the business scenario? Is it general Q&A, enterprise knowledge base retrieval-augmented generation, ticket summarization, code completion, document image understanding, or domain-specific Q&A with dense terminology? Different scenarios impose very different requirements on model capabilities. General conversation focuses more on instruction following and response quality; knowledge base Q&A focuses more on long context, citation accuracy, and refusal behavior; code scenarios focus more on context length, completion quality, and licensing; multimodal scenarios must additionally consider the GPU memory and latency overhead introduced by visual encoders.

    Second, where is the deployment boundary? Is it a single offline machine, a private data center, or a hybrid cloud? Is data allowed to leave the domain? Is full-link auditing required? These questions directly determine model size, quantization strategy, and serving architecture.

    Third, what is the hardware budget? Local deployment must account not only for model weight memory but also for inference runtime, KV cache, batching, image encoders, monitoring, and fault-tolerance overhead. Many teams underestimate the memory growth caused by long context and high concurrency, resulting in a system that works in the lab but not in production.

    Fourth, how do you prove “usable”? Model selection without an evaluation set easily degrades into subjective experience. Prepare a de-identified evaluation set derived from real business scenarios, covering normal questions, boundary cases, unanswerable questions, long-document questions, and security/compliance questions. Record metrics such as accuracy, citation correctness, hallucination rate, time to first token, throughput, and peak GPU memory.

    2. Model Acquisition: Shift from “Finding the Latest” to “Verifiably Obtaining Versions”

    Public model repositories, model organization release pages, cloud provider model catalogs, and internal enterprise artifact repositories are all common channels for model acquisition. The key is not chasing “the latest,” but establishing a version verification mechanism: confirm the model card, license scope, training data and safety notes, file checksums, dependency versions, and update records. For enterprise environments, it is advisable to place model packages into an internal artifact repository, recording source, hash, license, evaluation conclusions, and rollback versions. Avoid having production environments directly reference external addresses.

    If using private cloud or hybrid deployment, infrastructure services from cloud providers such as Baidu AI Cloud—container platforms, object storage, logging, and monitoring/alerting—can be included as general infrastructure categories, while keeping model serving decoupled from the infrastructure. The goal is to allow model versions, inference services, and business gateways to be upgraded independently, rather than binding the architecture to a single component.

    3. Select by Capability Category, Not by Fixed Model

    Common capability categories for local deployment can be summarized as follows. The table below presents general selection dimensions and does not point to any specific model.

    Capability category Suggested parameter range Typical deployment form Suitable scenarios Key checks
    Lightweight general chat/instruction model 1B–8B Single GPU, CPU quantization, or edge devices Customer service triage, text classification, summarization, edge Q&A License, context length, quality loss after quantization
    Chinese-enhanced general model 7B–14B Single 24GB GPU or dual GPU, INT8/INT4 Enterprise knowledge base Q&A, ticket summarization, policy Q&A Chinese evaluation, long-context stability, refusal capability
    Code-specialized model 6B–14B Single machine or small cluster on the R&D intranet Code completion, code review, unit test generation Commercial license, context length, integration approach
    Multimodal understanding model 7B–20B Large-memory single GPU or multiple GPUs Image-text document parsing, quality inspection, receipt understanding Visual resolution, GPU memory overhead, latency
    Embedding and reranking models 0.1B–1B CPU or small GPU Retrieval augmentation, semantic recall, result reranking Vector dimension, batching capability, recall evaluation
    Domain fine-tuning base model 1B–14B Adjusted according to domain data scale Terminology-dense scenarios such as healthcare, finance, and manufacturing Whether fine-tuning and redistribution are allowed, data isolation

    Lightweight general chat models are suitable for “first-layer filtering” and low-latency tasks. They may not solve complex reasoning, but they are cost-effective for classification, extraction, summarization, and intent recognition. Enterprises can use small models for high-frequency simple requests first, then route complex requests to larger models.

    Chinese-enhanced general models are often the mainstay for enterprise knowledge base Q&A. During selection, focus on citation accuracy under long context, refusal rate for irrelevant questions, and understanding of tables and clauses, rather than only general leaderboards. For retrieval-augmented architectures, embedding and reranking models should also be evaluated together, because recall quality often affects the final answer more than the size of the generative model.

    Code-specialized models are suitable for R&D intranets. In addition to completion quality, pay attention to whether the license allows commercial use, whether local fine-tuning is permitted, whether the context length is sufficient to cover cross-file snippets, and whether it can integrate with enterprise code retrieval systems.

    For multimodal understanding models, distinguish between “image description” and “document structure understanding.” Receipts, tables, and scanned documents impose higher requirements on resolution and layout understanding, and GPU memory and latency will increase noticeably. It is advisable to build a separate image-text evaluation set rather than substituting pure text evaluation.

    Embedding and reranking models usually have smaller parameter counts but greatly affect retrieval systems. Evaluate recall rate, ranking quality, and batching throughput on different business corpora, and keep replaceable interfaces to avoid tight coupling between the retrieval layer and the generation layer.

    4. Hardware and Quantization: Calculate GPU Memory First, Then Discuss Concurrency

    A general estimation formula is: weight memory is approximately the number of parameters multiplied by the number of bytes per parameter. FP16 is about 2 bytes per parameter, INT8 about 1 byte per parameter, and INT4 about 0.5 bytes per parameter. For example, a 7B-parameter model requires about 14GB for FP16 weights, about 7GB for INT8, and about 3.5GB for INT4. However, actual deployment must also add inference runtime, KV cache, batching buffers, and temporary tensors, so higher headroom is usually required.

    KV cache is related to the number of layers, attention heads, context length, and batch size. Long context and high concurrency significantly increase GPU memory usage. Therefore, during selection, do not only ask “can this model load?” but also “can it serve stably at the target context length and concurrency?”

    Quantization is an important technique for local deployment, but the quality loss after quantization must be evaluated. Keep FP16 or higher-precision baseline results, run the same evaluation set for INT8 and INT4 separately, and observe task accuracy, refusal rate, long-text consistency, and safety behavior. For sensitive tasks such as code, math, and table understanding, quantization loss may be more noticeable, so production rollout should be cautious.

    5. Serving Architecture: Turn the Model into an Operable Service

    Local deployment should not stop at “it runs from the command line.” A production-grade architecture is typically divided into several layers: the model artifact layer handles versions, licenses, checksums, and rollback; the inference service layer handles batching, streaming output, timeouts, rate limiting, and health checks; the gateway layer handles authentication, auditing, routing, and quotas; the data and retrieval layer handles object storage, vector retrieval, and permission filtering; the observability layer handles logs, metrics, tracing, and alerting.

    A neutral example service configuration is as follows:

    1. model_service:
    2. model_id: local-general-7b-int4
    3. precision: int4
    4. max_context_tokens: 8192
    5. max_batch_size: 4
    6. stream: true
    7. timeout_ms: 30000
    8. rate_limit_qps: 20
    9. health_check_path: /health

    The point of such configuration is to make model version, precision, context, batch size, timeout, and rate limiting explicit, which facilitates stress testing and rollback. For multi-model scenarios, routing can be done at the gateway layer: simple requests go to lightweight models, complex requests go to enhanced models, and retrieval tasks go to embedding and reranking models. Routing policies should be configurable, observable, and canary-ready.

    6. Evaluation and Stress Testing: Replace Subjective Judgment with Data

    Evaluation sets should come from real business scenarios and be de-identified and labeled. At a minimum, cover high-frequency questions, long-tail questions, boundary cases, unanswerable questions, long-document questions, and security/compliance questions. Metrics include task accuracy, citation correctness, refusal rate, hallucination rate, time to first token, output tokens per second, peak GPU memory, error rate, and timeout rate.

    Stress testing should be carried out in stages: first verify correctness with single requests, then verify stability with low concurrency, and finally gradually increase load to the target peak. During stress testing, record latency and GPU memory changes under different context lengths and batch sizes to identify capacity inflection points. Before launch, it is advisable to use shadow traffic or a small-percentage canary release to compare the online baseline with candidate models, and retain one-click rollback capability.

    7. Compliance, Security, and Supply Chain

    One important value of local deployment is data controllability, but it does not automatically mean compliance. Check whether the model license allows commercial use, fine-tuning, and redistribution; whether training data and output content meet the requirements of the industry in which the business operates; whether logs are de-identified; whether permissions are minimized; whether model packages have checksums and source records; and whether updates have undergone evaluation and approval.

    On the supply chain side, record model file hashes, dependency versions, license texts, and evaluation reports to form an internal software bill of materials. Isolate and scan external model packages before they enter the internal artifact repository. Production environments should pull models only from controlled repositories and avoid accessing untrusted addresses at runtime.

    Common pitfalls include: looking only at parameter count and not at the scenario; looking only at leaderboards and not at business evaluation; ignoring licenses; underestimating KV cache and long-context overhead; deploying FP16 directly to production; lacking canary release and rollback; treating retrieval augmentation as a universal solution; and ignoring logs, monitoring, and permissions.

    More pragmatic combinations are: for small teams or single-GPU environments, use a lightweight general chat model plus small embedding/reranking models, together with business rules and retrieval; for enterprise knowledge base scenarios, use a Chinese-enhanced general model plus embedding, reranking, permission filtering, and an evaluation set; for R&D intranet scenarios, use a code-specialized model plus a lightweight general model and code retrieval; for multimodal document scenarios, use a multimodal understanding model plus document parsing, object storage, and auditing; for deep domain scenarios, use a base model that permits fine-tuning plus parameter-efficient fine-tuning, human review, and continuous evaluation.

    In short, the “recommendation” for local LLM deployment should not be a fixed leaderboard, but a complete methodology spanning use case, hardware, licensing, evaluation, and operations. Start by validating a small set of candidates, then control costs through quantization and serving architecture, and finally use evaluation, stress testing, and canary releases to decide whether to expand deployment. This is how to maintain architectural stability, controllable costs, and manageable risk in an environment of rapid model iteration.