Local LLM Deployment in Practice: Inference Optimization Under Limited VRAM
A practical, vendor-neutral guide to deploying a new-generation MoE large language model locally. It explains how to read official deployment recipes, break down a standard containerized launch command (FP8 KV cache, block size, expert parallelism, data parallelism, CUDA graph compilation), and apply advanced setups such as PD disaggregation with RDMA-based KV transfer. It also covers productizing adjustable reasoning effort tiers and a realistic testing approach for running a tens-of-billions-parameter model on just two 96GB data-center GPUs, with guidance on the trade-offs to expect.
A new-generation mixture-of-experts (MoE) large language model has been released as open source, and the official team published several model sizes along with matching deployment options. The community quickly shared real-world tests on both consumer-grade and data-center GPUs. One typical scenario: running a mid-sized version on two 96GB data-center cards. This article is not about any specific product. Instead, it distills a reusable methodology from these practices and walks through the core points of local LLM deployment.
1. Start With the Hardware Bar: What the Official Deployment Recipe Tells You
Official releases usually include a set of validated deployment configurations (often called a “recipe”). In practice, a recipe answers three questions:
- What is the minimum viable configuration. The flagship version reaches the trillion-parameter scale and needs a single machine with 8 high-end accelerators. The lightweight version (tens of billions of parameters) has an official minimum of a 4-card single machine. This means that if you only have two 96GB cards, you must push VRAM usage down further with techniques like quantization and cache compression. That is an aggressive approach that goes below the official recommended floor.
- Software stack version requirements. Container images are typically tied to a specific major CUDA version. Before deploying, you must confirm driver compatibility on the host, or the process will fail outright during kernel loading.
- Which parameters are mandatory. Some configuration items are not tunable optimizations but required choices dictated by the model architecture. Changing them arbitrarily can produce abnormal output or make inference impossible.
2. Reading a Standard Deployment Command Line by Line
Taking a mainstream inference framework’s containerized deployment as an example, a typical launch command looks roughly like this:
docker run --gpus all \--ipc=host -p 8000:8000 \-v ~/.cache/huggingface:/root/.cache/huggingface \<inference-image> <model-path> \--trust-remote-code \--kv-cache-dtype fp8 \--block-size 256 \--enable-expert-parallel \--data-parallel-size 4 \--tokenizer-mode <new-tokenizer-mode> \--enable-auto-tool-choice
Breaking down the key points:
- FP8 KV cache quantization: The KV cache is the biggest VRAM consumer during long-context inference. Compressing the cache from FP16 to FP8 roughly halves its VRAM footprint with minimal impact on generation quality. This is the first standard technique for deploying large models under limited VRAM.
- block-size 256: The block size determines the granularity of paged KV cache management. Larger blocks can improve access efficiency under certain attention implementations, but they also worsen fragmentation. When the official documentation specifies a particular value, it is usually bound to the model’s internal custom attention indexing mechanism and must be followed as a mandatory setting.
- Expert Parallel: In an MoE model, expert parameters are split across different cards, and the routing layer dispatches them dynamically per token. Compared with pure tensor parallelism, expert parallelism reduces all-reduce communication volume, making it the preferred strategy for multi-card MoE deployment.
- Data parallelism degree: Each DP replica loads a full copy of the model weights, which suits horizontal scaling under heavy traffic. Note that the number of DP replicas multiplied by the number of cards each replica needs must not exceed the physical card count.
- Compilation and graph optimization: Enabling full CUDA graph capture and chunked compilation can significantly reduce CPU overhead and kernel launch latency during the decode phase. This is standard for high-throughput serving.
In addition, new-generation models often introduce a dedicated tokenizer mode, tool-call parser, and reasoning-chain parser. Parsers from older versions are not compatible with the new model, which is the most common pitfall when upgrading a deployment. The symptoms are usually garbled tool-call formatting or chain-of-thought content being spliced into the main output.
3. Advanced Architecture: PD Disaggregation and RDMA-Based KV Transfer
When a single machine cannot serve both prefill and decode workloads well at the same time, you can adopt a PD-disaggregated deployment:
- Use some cards dedicated to prefill and others dedicated to decode;
- Transfer the KV cache between the two stages over a high-speed RDMA network, typically via a mature KV transfer middleware;
- Place a lightweight router in front to handle request polling and dispatch.
router --policy round_robin \--pd-disaggregation \--prefill http://localhost:8000 \--decode http://localhost:8001
The value of this architecture is that prefill is compute-intensive while decode is memory-access-intensive, and running them together interferes with each other’s batch scheduling. Once separated, each stage can use its optimal parallelism strategy and batch size, with especially clear throughput gains in long-context scenarios. The cost is higher operational complexity and greater network bandwidth demands. Transferring the KV cache across nodes usually requires a dedicated high-speed network, and ordinary Ethernet becomes a bottleneck.
4. Reasoning Effort Tiers: Productizing the Thinking Budget
New-generation models generally introduce adjustable reasoning effort, typically in three tiers:
- Non-thinking tier: Outputs the answer directly with the lowest latency, suitable for simple Q&A, format conversion, and similar tasks.
- High-thinking tier: The default deep reasoning, suitable for everyday coding, math, and logic tasks.
- Maximum-thinking tier: Allows the model to generate a very long chain of thought, suitable for complex planning and hard problems. Note that this tier has a hard requirement on maximum context length (up to the hundreds-of-thousands-of-tokens level). If you set the context length too small during deployment, the highest tier becomes unavailable.
In practice, the tier is usually controlled through a template parameter in the request body, for example by passing a reasoning-mode switch in a chat request. The engineering recommendation is to handle tier selection at the gateway layer and route automatically based on task classification, rather than making users choose manually.
5. A Testing Approach for Ultra-Low-Spec Hardware
Back to the scenario of “running a tens-of-billions-parameter model on two 96GB cards,” the viable approaches include:
- Weight quantization: Use a low-bit weight format validated by the official team or the community to fit the model weights into the available VRAM;
- Aggressive cache compression: Use FP8 or even lower precision for the KV cache, combined with a larger block granularity for management;
- Shrink batch size and context length: When VRAM is tight, prioritize getting it running first, then tune step by step;
- Accept performance loss: Throughput and latency will most likely be lower than the official recommended configuration. During testing, record baseline metrics such as token/s and first-token latency, and compare them against the official data to assess the magnitude of the loss.
Conclusion
Local LLM deployment is moving from “getting it to run” toward “engineering-grade tuning.” Understanding the principle behind every parameter in the official deployment recipe—KV quantization, paged management, expert parallelism, PD disaggregation, reasoning tiers—matters more than copying commands. Only by making the right trade-offs under limited resources can you turn a model’s capabilities into a genuinely usable service.
