Local LLM Deployment Guide: Four Schemes for Selection and Implementation
This guide explores the necessity of local large language model (LLM) deployment, focusing on data governance, cost control, and traceability. It details the selection criteria between lightweight and high-performance model versions using Qwen2.5 as an example, and provides practical hardware adaptation strategies, including VRAM calculation and GPU selection, to help developers and enterprises implement local LLM solutions effectively.
1. Why Local Deployment Remains a Necessity
As large language model (LLM) applications enter the scale-up phase, selection criteria are shifting from “the larger the parameters, the better” to “controllable costs, governable data, and traceable pipelines.” Industries with strict data boundary requirements, such as finance, government, and high-end manufacturing, find that private deployment simultaneously satisfies the demands for data security, permission isolation, audit trails, and explainable results.
In terms of cost, public cloud pay-as-you-go models suit workloads with high volatility. However, high-frequency calls, long-term online services, and batch inference generate continuous billing. In these scenarios, a one-time investment in local hardware for long-term reuse is more cost-effective. Yet, local deployment is not a simple “download and run” process. It involves version selection, VRAM estimation, choosing an inference engine, serving, concurrency stress testing, and compliance review. The following sections outline deployment paths along this pipeline, providing four actionable schemes.
2. Version Selection: Lightweight vs. High-Performance
This article uses two instruction-tuned versions of Alibaba’s Qwen2.5 series as examples. Both versions are dense models, meaning all parameters are activated during every inference. The selection primarily depends on the parameter scale.
| Dimension | Lightweight: Qwen2.5-7B-Instruct | High-Performance: Qwen2.5-32B-Instruct |
|---|---|---|
| Parameters | ~7.6 billion | ~32.5 billion |
| FP16 Weight Size | ~15GB | ~65GB |
| INT4 Quantized Weight Size | ~5GB | ~19GB |
| KV Cache Structure (Layers/KV Heads/Head Dim) | 28/4/128 | 64/8/128 |
| Typical Scenarios | Daily Q&A, summarization, classification, information extraction | Complex reasoning, long document analysis, professional Q&A |
| Minimum Recommended VRAM | Single 12GB card (INT4) | Single 48GB or dual 24GB cards |
Note: Model cards, licenses, and quantization versions may change with official updates. Always refer to the latest instructions in the official repository before deployment.
The recommended selection order is as follows: Individual developers and POC phases should prioritize the lightweight version to first verify prompts, Retrieval-Augmented Generation (RAG), tool calling, and service encapsulation. Once business metrics are clear, evaluate whether the high-performance version is necessary.
For enterprise scenarios, using a single model across the board is not recommended. High-frequency, low-complexity requests should be routed to the lightweight version, while complex reasoning and key decision requests should go to the high-performance version—this is known as tiered routing. Before going live, conduct offline evaluations using real business samples to compare accuracy, first-token latency, throughput, and peak VRAM usage. Do not rely solely on parameter scale.
3. Hardware Adaptation: Calculate VRAM First, Then Choose the GPU
VRAM usage consists mainly of four parts: model weights, KV cache, activations, and runtime overhead. The estimation formula is as follows:
Total VRAM Required ≈ Weight Size + KV Cache + Runtime Overhead (empirically 1–2GB)
Reserve a 10%–20% margin to avoid out-of-memory (OOM) errors during peak loads.
The weight size is approximately equal to the number of parameters multiplied by the number of bytes per parameter: 2 bytes for FP16, 1 byte for INT8, and about 0.5 bytes for INT4. Actual quantized files will be slightly larger due to unquantized layers.
The KV cache calculation formula is as follows:
KV Cache (bytes) = 2 × Layers × KV Heads × Head Dimension × Context Length × Concurrent Requests × Bytes per Element
Taking Qwen2.5-7B as an example, calculated in FP16: for a single request with an 8192 context length, the KV cache is approximately 2 × 28 × 4 × 128 × 8192 × 2 bytes, or about 0.47GB. With 8 concurrent requests, it is about 3.8GB.
Taking Qwen2.5-32B as an example, for a single request with an 8192 context length, the KV cache is about 2GB. If using INT4 weights (about 19GB), adding the KV cache and runtime overhead totals about 22–23GB. This leaves very little margin on a 24GB GPU; using a 48GB GPU or shortening the context length is recommended.
Based on the above estimations, we can outline four hardware tiers:
| Tier | Hardware Example | Runnable Models & Conditions |
|---|---|---|
| Entry-Level Validation | Single 12GB card, e.g., RTX 3060 12GB | 7B INT4 quantized version, context under 4096, 1 concurrent request |
| Development Debugging | Single 24GB card, e.g., RTX 3090 or |
