How to Self-Deploy Open-Weight LLMs and Industry Implications
This article provides a technical guide on self-deploying open-weight Large Language Models (LLMs). It compares self-deployment with API usage, details licensing checks, hardware capacity estimation, and inference framework selection, outlines essential post-deployment monitoring metrics, and analyzes the impact of open weights on the AI compute industry.
1. Differences Between Open Weights and API Calls
In the past, developers primarily relied on APIs provided by vendors to use large models, paying per call or token, with the model running on the vendor’s servers. With open weights, model files can be downloaded directly and run in a local environment, bringing three key changes:
First, data can remain within the internal network. Industries such as finance, government, and healthcare have strict data residency and cross-border transfer requirements. Self-deployment ensures raw data never passes through external services.
Second, the model can be modified. Based on the weights, developers can perform instruction tuning and domain adaptation. Models can also be compressed via quantization, pruning, and distillation to run on smaller devices.
Third, the cost structure changes. For low call frequencies, pay-as-you-go APIs are usually more convenient. For high and stable call volumes, the per-token cost of a self-built inference service can potentially drop below API prices, though this requires recalculating based on actual traffic and hardware depreciation.
2. Check Licensing Agreements Before Deployment
“Open weights” does not equal “open source.” While many models allow weight downloads, their licensing agreements restrict usage. Before deployment, review the following items point by point:
- Commercial Use: Whether it can be used in profit-making products, and if there are user scale or revenue thresholds.
- Derivative Models: Whether fine-tuned models can be redistributed, and what conditions must be met.
- Attribution & Notices: Whether the product must credit the model source and retain copyright notices.
- Output Usage: Whether there are prohibited use cases for generated content, such as using outputs to train other models.
- Patents & Liability: Whether the agreement includes patent grants and defines the provider’s scope of liability.
- Data Terms: If using the vendor’s cloud services simultaneously, who processes user data and how long it is stored.
Licensing terms may change with version updates. Before going live, legal or compliance personnel should review all clauses of the current version.
3. Estimating Hardware Capacity
VRAM requirements mainly consist of two parts: model weights and the KV Cache. The VRAM for weights can be estimated using the formula:
Weight VRAM ≈ Parameters (B) × Bytes per parameter
For FP16, each parameter takes 2 bytes; for INT8, 1 byte; for INT4, approximately 0.5 bytes.
The KV Cache grows with context length, concurrent requests, and model structure, and can be estimated using the formula:
KV Cache ≈ 2 × Layers × KV Heads × Head Dimension × Context Length × Concurrency × Bytes per element
Finally, reserve overhead for the framework runtime and activation values, typically estimated at 10% to 20% of the total. Exact figures require stress testing.
Here is a hypothetical example to illustrate the calculation. Assume a 30B parameter model uses INT4 quantization, with a structure of 60 layers, 8 KV heads, and a head dimension of 128. The service context length is 4096, concurrency is 8, and the KV Cache uses FP16 storage.
- Weights: 30 × 0.5 = 15GB.
- KV Cache: 2 × 60 × 8 × 128 × 4096 × 8 × 2 bytes, which is about 8GB.
- Total: 15GB + 8GB = 23GB. Adding a 10% overhead, the total requirement is about 25GB.
This means a single 24GB VRAM GPU cannot handle it, while a 48GB GPU provides sufficient headroom. This example only demonstrates the calculation method. The layers, KV heads, and precision of a real model should be based on official configuration files. In high-concurrency and long-context scenarios, the KV Cache footprint often exceeds the weights, easily triggering Out of Memory (OOM) errors during stress testing.
4. Selecting an Inference Framework
The table below outlines key considerations for four common frameworks. Framework versions and features update rapidly, so this information serves only as a starting point and should be verified against current documentation.
| Framework | Primary Use Case | Common Quantization Formats | Continuous Batching | Paged Memory Management | Hardware Scope |
|---|---|---|---|---|---|
| vLLM | Multi-concurrency GPU service deployment | GPTQ, AWQ, FP8, etc. | Supported | Supported (PagedAttention) | Primarily NVIDIA GPUs; some adaptation for other accelerators |
| SGLang | Multi-turn dialogue, scenarios with shared prefixes | Mainstream GPU quantization formats | Supported | Supported, with prefix caching reuse | Primarily GPUs |
| TensorRT-LLM | Pursuing ultimate performance on NVIDIA platforms | FP8, INT4 AWQ, etc. | Supported | Supports paged KV Cache | NVIDIA GPUs only, requires pre-compiled engines |
| llama.cpp | Single-machine deployment, edge devices, CPU or consumer GPUs | Various GGUF format quantizations | Limited support in server mode | No equivalent mechanism | Covers CPU and various GPU backends |
When selecting, monitor four metrics simultaneously: throughput, Time To First Token (TTFT), Time Per Output Token (TPOT) for a single request, and accuracy loss after quantization. Focusing only on throughput often leads to neglecting TTFT, which significantly degrades the response experience in conversational products.
Common mistakes in practice include:
- Focusing only on throughput while ignoring TTFT and tail latency.
- Deploying directly after quantization without accuracy evaluation, leading to degraded answer quality for specific tasks.
- Not limiting long-context requests, allowing a single request to exhaust VRAM and affect other users.
- Mismatches between framework versions, CUDA versions, and driver versions, causing startup failures or performance anomalies.
- Stress testing with default parameters instead of constructing test data based on actual business input/output lengths.
5. Key Metrics to Monitor Post-Deployment
For service deployment, the model service should be placed in a container platform, configured with autoscaling, and integrated with logging systems and monitoring alerts. Core metrics include: QPS, TTFT, TPOT, GPU utilization, VRAM usage, error rate, timeout rate, and queue duration.
Engineering teams also need to handle the following:
- Rate Limiting: Set request limits per user or tenant to prevent sudden traffic spikes from overwhelming the service.
- Canary Release: Route a small percentage of traffic to the new version first, compare quality and latency metrics, and only proceed to full rollout after confirming no issues.
- Rollback: Keep the previous version’s model files and configurations to quickly switch back if problems occur.
- Version Management: Perform hash checks on weight files and record version numbers with their corresponding inference configurations.
- Security: Verify that model file sources are trusted, enable authentication on interfaces, mask sensitive user input in logs, and store keys only in environment variables or key management services.
6. Impact on the AI Compute Industry
The availability of open weights lowers the barrier to using large models while potentially increasing compute demand on the inference side. The shift of inference loads from centralized training to large-scale distributed inference is the primary logic at the industry chain level. However, whether this logic translates into actual orders depends on several conditions.
Regarding AI compute chips, whether alternative hardware vendors can meet inference demands depends heavily on software stack adaptation. Inference frameworks, operator libraries, and compilation tools must support the target models, or hardware performance will be difficult to realize. Customer validation cycles are usually lengthy, taking several quarters from testing to bulk procurement.
On the edge and mature process side, whether terminal SoC demand will recover primarily depends on memory price trends, terminal shipments, and foundry capacity utilization. Claims that AI demand drives analog and power device sectors need to be verified against specific product orders and inventory data.
Regarding storage and semiconductor equipment, regional market dynamics and supply chains will require ongoing observation of specific product orders and inventory data.
