Local LLMs on Your Own Server: Hardware Choice and Economics
How to calculate the economics of running local language models on your own server, choose VRAM, engines, and factor in token costs.

Running local large language models (LLMs) on your own server or workstation often seems like an easy way to save on cloud APIs. However, in practice, the economics of local inference are fundamentally different from cloud subscriptions: fixed capital expenditures on hardware dominate here, while variable costs per request approach zero. Between cloud APIs and a home server lies a break-even point that can be calculated based on real task flow and generated token volume.
- Local models shift the cost structure from variable to fixed, requiring high request volume to achieve profitability.
- Token generation speed relies heavily on video memory bandwidth rather than raw teraflops.
- Total memory usage consists of model weights, KV cache for context, and CUDA buffers.
- Choosing the right architecture (such as MoE instead of dense models) provides high speed and quality with lower memory consumption.
Memory Anatomy: Why Bandwidth Matters and How to Calculate KV Cache
Generating each new token by a neural network depends almost entirely on video memory (VRAM) bandwidth, because the GPU must re-read all active model weights at every step. Therefore, models require a balance between memory capacity and speed. Beyond the weights, it is critical to account for the KV cache, whose size depends directly on context length, number of layers, attention heads, and batch size. For instance, a 32B dense model with a 32k context can require around 8 GB of memory for the cache alone.
To fit within available hardware without quality loss, engineers use weight quantization (from Q8 down to Q4) and cache optimization to FP8. An alternative and extremely efficient solution is Mixture of Experts (MoE) architecture models. In such models, all experts must reside in memory, but only a small active part is read per token, delivering high generation speed while maintaining the quality of thirty-parameter models on constrained consumer cards.
Read alsoHeretic LLM jailbreak tool creator Philipp Weidmann passes away at 41Model Families Overview and Specifics of Working with Russian and Other Languages
The modern open-weight market offers a wide choice of families for various tasks and licenses. Qwen models have become a universal workhorse with adequate language support and an Apache 2.0 license. DeepSeek solutions are strong in reasoning and coding, while GLM is well-suited for agent scenarios. When processing text, tokenization specifics must be considered: words consume multiple tokens, increasing the actual context footprint and the total cost of processing large text arrays.
Choosing Inference Engines and Business Value for Infrastructure
For initial deployment and experimentation, Ollama is widely used due to its simple setup and GGUF support. However, for production workloads requiring efficient batching, dynamic memory management, and high throughput under multiple concurrent requests, specialized engines like llama.cpp, vLLM, or TensorRT-LLM are utilized. For businesses, transitioning to local infrastructure is justified under a stable and high request flow when cloud API expenses begin to exceed the maintenance cost of a dedicated high-performance server.
Source: Все публикации подряд на Хабре



