Local Deployment of Open-Source LLMs: Trading Controllable Cost for Cost-Effective Inference
As open-source large language models close the capability gap, engineering teams face a practical decision: keep paying for cloud APIs or run inference on their own hardware. This article breaks down the cost structure on both sides, walks through a typical deployment path from GPU selection and quantization to serving, and explains the tradeoffs in accuracy, throughput, and latency. It closes with a decision framework showing which teams benefit from self-hosting, which are better off on cloud APIs, and why a hybrid setup often wins.
1. Why Consider Local Deployment
Open-source LLM capabilities are improving fast, which puts a practical question in front of technical teams: once the model is good enough, should you keep depending on cloud APIs or move inference into your own server room?
The answer is straightforward. If a one-time investment of roughly RMB 100,000–200,000 buys you an effectively unlimited token budget, the long-run math beats pay-per-token cloud APIs, and you also drop the dependency on a third-party service. Three motivations drive this:
- Controllable cost. Under high call volume, per-token API pricing grows linearly with business volume. Self-hosted cost is dominated by hardware depreciation — a one-time outlay with a marginal cost per call approaching zero.
- Data security. Inference requests involving code, contracts, or internal documents carry compliance risk the moment they leave your network. Local deployment keeps data inside the intranet end to end.
- Service autonomy. Third-party APIs come with rate limits, service fluctuations, and pricing changes you don’t control. Own compute means you own the calling policy.
Local deployment is not a universal fix, and the sections below cover its boundaries.
2. Cost Structure: Upfront Spend vs. Ongoing Fees
Run the numbers on both sides before deciding.
Cloud API cost is simple: unit price × token volume. For a mid-sized team processing millions of tokens per day, the annual bill can reach hundreds of thousands of RMB and keeps climbing with growth.
Self-hosting costs break down as:
- Hardware. The anchor is the GPU. Inference workloads care more about VRAM capacity than peak compute, so multi-card consumer GPUs or a single high-VRAM professional card are the common choices. A whole machine in the RMB 100,000 range can typically serve a quantized model in the tens-of-billions parameter range at high concurrency.
- Power and rack space. GPUs running at sustained high load draw real power, which belongs in operating cost.
- Personnel. Environment setup, model quantization, service orchestration, and troubleshooting all need dedicated engineers. This is the most underestimated line item.
- Iteration. Models are replaced quickly, so hardware must be evaluated against the next generation. Plan on a two-to-three-year depreciation cycle.
A rough rule of thumb: if average monthly API spend exceeds a threshold (typically around RMB 10,000–20,000, a few thousand USD), self-hosting pays back the hardware within one to two years and enters a near-free phase afterward. Below that volume, cloud services are the cheaper option.
3. Implementation Path: From Hardware to Live Service
Hardware Selection
The core metric is VRAM. Taking a model in the tens of billions of parameters:
- FP16 deployment needs roughly twice the parameter count in VRAM (weights + KV cache + activations).
- INT4/INT8 quantized deployment cuts weight footprint to one quarter or one half, fitting a tens-of-billions model onto a single high-VRAM card or a two-card setup.
KV cache grows linearly with concurrency, so always leave headroom when sizing VRAM or you will hit OOM under load.
Inference Framework and Deployment
Mainstream open-source inference frameworks — general-purpose parallel scheduling engines such as the vLLM family, and lightweight options such as llama.cpp — support quantized model loading, continuous batching, and OpenAI-compatible endpoints. A vLLM-style launch looks like this:
python -m vllm.entrypoints.openai.api_server \--model ./models/your-model \--quantization awq \--tensor-parallel-size 2 \--max-model-len 32768 \--gpu-memory-utilization 0.9
Key parameters:
quantization: selects the quantization scheme. AWQ/GPTQ-style weight quantization cuts VRAM use substantially with manageable accuracy loss.tensor-parallel-size: number of shards for multi-GPU parallelism; must match the actual card count.max-model-len: maximum context length, which directly drives KV cache usage. Set it to what the workload needs rather than maxing it out.gpu-memory-utilization: fraction of VRAM to reserve. In production, keep about 10% free to avoid fragmentation-driven OOM.
Service Layer
Production usually adds a gateway on top:
- Unified authentication and metering (cost allocation by department or project).
- Request queuing plus timeout and circuit breaking, so long-context inference doesn’t stall the queue.
- Streaming output (SSE) forwarding for better interaction.
- Log collection and call-chain tracing to locate slow requests.
4. Performance and Quality Tradeoffs
Two tradeoffs are unavoidable with local deployment.
- Quantization accuracy loss. INT4 has little impact on most generation tasks, but on accuracy-sensitive work such as mathematical reasoning and code generation the degradation can be noticeable. Run a comparison on a real business evaluation set instead of relying on public leaderboards.
- Throughput vs. latency. Larger batch sizes raise total throughput and dilute per-token cost but increase time to first token. Interactive scenarios such as coding assistants should favor low latency; batch scenarios such as document summarization should favor throughput. Separate instances can split the two.
On the operations side, establish monitoring baselines. GPU utilization, VRAM watermark, tokens per second, and request queue time are the four core metrics. When you hit a capacity bottleneck, add VRAM or reduce context length first.
5. Fit Assessment: Which Teams Should Self-Host
Weighing cost, technical, and operational factors, here is a decision framework.
Signals that local deployment fits:
- High and stable call volume with a steadily rising API bill.
- Sensitive data where compliance requires inference to stay on the intranet.
- Basic GPU operations capability and tolerance for roughly two person-days of engineering effort.
- Low pressure to track model releases; a version lag of six months to a year is acceptable.
Signals to stay on cloud APIs:
- Low or highly volatile call volume.
- A need to switch to the newest, strongest model frequently.
- No GPU operations experience, where personnel cost can exceed hardware cost.
- Spiky peak traffic, since capacity sized for the peak sits idle most of the time.
The hybrid approach is also worth noting: route sensitive data and high-frequency routine tasks locally, and long-tail, low-frequency complex tasks to cloud APIs. It balances cost against capability ceiling, and it is what many teams end up choosing.
6. Summary
Maturing open-source model capability has turned “a six-figure outlay for long-term low-cost inference” from a slogan into an executable engineering plan. But self-hosting is essentially a financial decision to swap operating expense for capital expense, layered on top of a continuing operations project — and the boundaries of fit are clear on both sides. Before committing, teams should calculate the break-even point using real business traffic and validate model accuracy through quantization testing, then decide whether to bring the compute back in-house.
