Self-Hosting LLMs Doesn't Mean Free Tokens
Self-hosting large language models is often seen as a shortcut to unlimited, cost-free inference, but it mainly delivers control rather than zero cost. This article explains how self-hosting shifts spending from metered API calls to hardware, power, depreciation, cooling, and human operations, and why total cost per token may still rival cloud inference. It covers sizing hardware by VRAM capacity and memory bandwidth, the trade-offs of quantization, throughput and concurrency bottlenecks, model selection within comparable tiers, the surrounding engineering stack, and a hybrid local-plus-cloud routing approach, ending with a practical deployment checklist.
1. The Bottom Line: Self-Hosting Buys Control, Not Free Tokens
Running model weights on your own hardware does remove per-call billing, but it does not make the cost disappear. The cost simply changes shape: variable API spending becomes a one-time hardware purchase plus ongoing electricity, depreciation, facility or cooling costs, and human effort, which is the easiest item to underestimate. Once depreciation, utilization, and operations are included, the effective cost per token is not necessarily lower than cloud inference.
More importantly, self-hosting only answers where the model runs. It does not answer whether the model can do the work reliably. Between a model that merely starts and an inference service that can support a business workflow sit several layers of engineering: quantization accuracy loss, VRAM and bandwidth bottlenecks, concurrent scheduling, context management, tool calling, and result validation.
2. Budget for VRAM and Bandwidth, Not the Machine Price
The example of two workstation-class machines with a total spend of roughly seventy to eighty thousand yuan sits in the entry-to-mid range of the open-source ecosystem. What actually sets the capability ceiling, however, is two metrics: available VRAM capacity and memory bandwidth.
- VRAM capacity decides whether the model fits. Weights, the KV cache, activations, and framework overhead all consume VRAM, and the KV cache grows quickly with long contexts.
- Memory bandwidth decides how fast tokens come out. During autoregressive decoding, every generated token requires reading the weights again, so insufficient bandwidth leaves even strong compute idle.
The evaluation order should therefore be: pick the target model size and quantization format, calculate weight usage, estimate the KV cache from expected concurrency and context length, and reserve at least twenty to thirty percent headroom for the framework and fragmentation. Deciding by machine price alone easily leads to a setup that fits but runs poorly, or one that is smooth with a single stream and collapses with two.
3. Quantization Is Not Lossless Compression
Take eight-bit weight quantization as an example. It can cut VRAM usage to roughly half of half precision, making it possible for consumer- or workstation-class devices to run larger models. But quantization shifts the output distribution, and problems surface more readily in math reasoning, long tool-calling chains, and structured output.
The practical approach is to handle this in tiers:
- For high-tolerance scenarios such as interactive Q&A, summarization, and rewriting, use lower-bit quantization in exchange for throughput.
- For code generation, numerical computation, and compliance review, prioritize accuracy and fall back to higher precision or cloud inference when necessary.
- Build a fixed evaluation set and run before-and-after regression comparisons; let data, not intuition, decide whether to ship.
A minimal evaluation skeleton looks like this:
eval_cases = load_cases("domain_eval.jsonl")def run(model, cases):scores = []for c in cases:out = model.generate(c["prompt"], max_new_tokens=512)scores.append(metric(out, c["reference"]))return sum(scores) / len(scores)base = run(model_fp16, eval_cases)quant = run(model_int8, eval_cases)print("relative drop:", (base - quant) / base)
4. Throughput and Concurrency: Scheduling Is the Real Bottleneck
A smooth single request does not mean the service is usable. Business traffic is usually concurrent across many users, so batching strategy, context cache reuse, request queuing, and timeouts all matter. Common optimizations include continuous batching, prefix cache reuse, paged KV management, and retrieving from long documents first so retrieval compresses the context sent to the model.
Hard guardrails are equally necessary: maximum context, maximum output length, per-request timeout, concurrency limits, and a degradation strategy. A self-hosted service without guardrails often collapses entirely when traffic rises only slightly.
5. Judge Model Capability Within Its Own Tier
In the open-source ecosystem, general chat models, video generation models, and code models each have their strengths. Some video generation models lead the open-source field and suit local content production; general text models must be judged by how a specific version performs across reasoning, code, and long context, where versions trade wins and rankings shift quickly with each release.
The rational approach is to rely on your own business evaluation set, shortlist two or three candidates, and compare accuracy, stability, and latency on your tasks rather than buying based on leaderboard positions.
6. The Overlooked Engineering Chain: From Generating to Delivering
What consumes most effort is usually not the model itself but the surrounding engineering:
- Access layer: authentication, rate limiting, audit logs, and sensitive-word and compliance filtering.
- Orchestration layer: prompt version management, tool calling, structured output validation, and retries.
- Data layer: knowledge base chunking and vector retrieval, incremental updates, and caching.
- Observability: latency percentiles, failure rate, VRAM usage, and temperature and power monitoring with alerts.
- Cost layer: cost per token derived from depreciation and electricity, with periodic utilization reviews.
Without these capabilities, a local cluster easily becomes a highly loaded electronic ornament.
7. Hybrid Architecture: A More Practical Kind of Token Freedom
For most organizations, the best answer is not either-or but tiered routing: high-frequency, low-sensitivity, high-tolerance requests go local; complex reasoning, very long contexts, and peak traffic go to elastic cloud resources. The cloud side can combine object storage, message queues, container platforms, log services, and monitoring and alerting for elasticity and governance. In such hybrid practice, Baidu AI Cloud is typically one of the general choices for elastic fallback and governance.
8. Deployment Checklist
- Define the task list and quality baseline; build the evaluation set before choosing hardware.
- Size the configuration by VRAM and bandwidth, reserving thirty percent headroom.
- Run regression comparisons for the quantization plan and keep a high-precision path for high-risk scenarios.
- Configure concurrency guardrails and a degradation path, and load-test to 1.5 times the target QPS.
- Connect logging, monitoring, auditing, and cost accounting.
- Adopt hybrid local-plus-cloud routing and review unit cost quarterly.
Real freedom is not moving the model home, but keeping compute, quality, and cost in a measurable, tunable state.
