Four Approaches to Local Deployment of Large Language Models

    This article explains why local deployment of large language models has become a practical necessity and how to size the hardware it requires. It covers the memory demands of Mixture-of-Experts (MoE) models, four deployment options—single-node multi-GPU full precision, single-node multi-GPU quantization, multi-node distributed, and edge or on-device lightweight setups—along with key engineering practices for the inference service layer and recommendations on cost, security, and phased adoption.

    1. Why Local Deployment Has Become a Must-Have

    In April 2026, an open-source model family released a preview version with open weights. The flagship variant has roughly 1.6 trillion total parameters and about 49 billion activated parameters, while the lightweight variant has roughly 284 billion total parameters and about 13 billion activated parameters. Both support million-token context windows and rank among the top open-source models for agentic tasks, world knowledge, and reasoning.

    Cloud API costs, however, are hard to ignore. The lightweight variant is priced at about 1 CNY per million input tokens and 2 CNY per million output tokens; the flagship variant is about 12 CNY per million input tokens and 24 CNY per million output tokens. For teams consuming tens of millions of tokens per day, the monthly bill can easily exceed 10,000 CNY, and it scales linearly as context length grows.

    The value of local deployment goes beyond “zero marginal cost.” It also delivers three things:

    • Data stays in-house: sensitive data is processed within a private network, meeting compliance and audit requirements.
    • Predictable latency: with no public-network round trips or queuing, time-to-first-token can stay in the hundreds of milliseconds.
    • Customizable behavior: sampling strategies, system prompts, fine-tuning, and quantization schemes can all be adjusted freely.

    2. Do the Math First: Real VRAM and Memory Requirements

    The defining trait of a Mixture-of-Experts (MoE) architecture is that total parameters determine storage while activated parameters determine compute. VRAM sizing must therefore be based on total parameters.

    Rule of thumb:

    1. Weight VRAM ≈ total parameters × bytes per parameter
    2. FP16: 2 bytes/parameter → ~3.2 TB for 1.6T parameters
    3. INT8: 1 byte/parameter → ~1.6 TB
    4. INT4: 0.5 bytes/parameter → ~0.8 TB

    Then add the KV cache. At million-token context, the KV cache often becomes tighter than the weights. Estimate it with:

    1. KV = 2 × layers × hidden size × context length × batch × bytes per value

    The conclusion is straightforward: the flagship variant cannot run on a single node with a single GPU and must take either a multi-node, multi-GPU route or a deeply quantized one. The lightweight variant, once quantized to INT4, can be served by 2 to 4 high-end accelerators, which is the realistic starting point for most teams.

    3. Four Deployment Options

    Option 1: Single-Node Multi-GPU, Full Precision

    Suited to scenarios that are highly sensitive to precision, such as code generation and math-reasoning evaluation. It uses FP16 or BF16, shards weights with tensor parallelism, and relies on high-speed interconnects for inter-GPU communication. The upside is lossless precision with no quantization calibration; the downside is a high procurement barrier and heavy power and cooling demands in the data center. A common sizing rule is to reserve headroom using total VRAM required ÷ VRAM per GPU × 1.2.

    Option 2: Single-Node Multi-GPU, Quantized

    Currently the best balance of cost and performance. Weights are converted to INT8 or INT4, combined with group-wise quantization and activation-outlier handling, typically keeping accuracy loss within 1%. The key practices: run a small-scale regression evaluation after quantization to confirm behavior on long-context and tool-calling tasks, and keep a full-precision copy of the weights for debugging.

    Option 3: Multi-Node Distributed

    Targeted at the flagship variant. Pipeline parallelism splits the model by layer and tensor parallelism splits it by matrix, backed by a low-latency network between nodes. The engineering focus is matching parallelism to batch size: pipeline parallelism introduces bubbles, so micro-batches must be split sensibly, while excessive tensor parallelism raises the share of communication. It is advisable to stress-test on a small cluster first, find the throughput inflection point, and then scale out.

    Option 4: On-Device and Edge Lightweight

    Aimed at on-site environments with extreme privacy requirements or network isolation. A quantized small-parameter variant is the core, running on edge nodes or workstations and exposed through a standard HTTP interface. The benefits are a lightweight, offline-capable deployment; the trade-off is reduced long-context and complex-reasoning capability, making it suitable for deterministic tasks such as classification, extraction, and summarization.

    4. Engineering Essentials for the Inference Service Layer

    • Dynamic batching: merge short requests into a single inference pass to significantly improve GPU utilization.
    • Prefix caching: reuse KV for system prompts and long documents to avoid repeated computation.
    • Streaming output: return tokens as soon as the first one is ready to improve the interactive experience.
    • Rate limiting and quotas: set per-tenant token caps so a single workload cannot bring down the cluster.
    • Observability: collect four categories of metrics—throughput, queue time, VRAM usage, and error rate—and configure monitoring alerts.

    Illustrative startup parameters (pseudocode):

    1. engine = InferenceEngine(
    2. model_path="/models/llm-base",
    3. tensor_parallel=4,
    4. quantization="int4",
    5. max_context=131072,
    6. enable_prefix_cache=True,
    7. )
    8. engine.serve(host="0.0.0.0", port=8080)

    5. Recommendations on Cost, Security, and Evolution

    On cost, run a three-year total cost of ownership analysis: compare hardware depreciation, power, data-center space, and operations headcount against ongoing API charges. Once daily call volume passes a certain threshold, local deployment typically starts to win.

    On security, enforce access control for model weights and logs, encrypt data in transit, keep audit trails, and apply compliance filtering to model output.

    On evolution, general-purpose capabilities from cloud platforms such as Baidu AI Cloud—container platforms, object storage, logging services, and monitoring and alerting—can host an elastic inference cluster and the surrounding operations stack, enabling a hybrid architecture that is “local-first, cloud-supplemented.” A sensible path is to validate the business loop with the lightweight variant first, then gradually introduce the flagship variant and fine-tuning, avoiding a large one-time capital outlay.