Local LLM Inference Speed: Benchmarks and Optimization Guide
This article explains why tokens/s alone cannot describe local LLM performance, then breaks down the practical limits set by VRAM capacity, memory bandwidth, and sustained power across consumer GPUs, professional cards, dual-GPU setups, and integrated graphics with unified memory. It covers KV Cache growth as the real memory bottleneck at long context, quantization trade-offs measured by Top-1 token agreement, and decoding strategies such as speculative decoding and reasoning budget control, with a neutral llama-server launch example. It closes with a reproducible benchmarking method and deployment recommendations for budget, quality-sensitive, and edge or offline scenarios.
1. Why “tokens/s” Alone Is Not a Meaningful Metric
When deploying large models locally, the first question is almost always how many tokens/s the setup produces. But without specifying hardware, quantization level, context length, and decoding strategy, those numbers are not comparable. Decode is a memory-bound workload: every token requires a full read of the weights and the KV Cache, so VRAM bandwidth usually becomes the bottleneck before compute does. Prefill is the opposite, leaning on compute, which is what determines time-to-first-token for long prompts. Understanding this split is the prerequisite for every optimization that follows.
2. Hardware Tiers: Bandwidth Sets the Ceiling, Capacity Sets Feasibility
The same GPU die is often reused across cards with different positioning, and the differences come down to VRAM capacity, power limits, and product class. Three parameters actually matter for local inference: VRAM capacity, VRAM bandwidth, and sustainable power.
- 16GB VRAM, roughly 640GB/s bandwidth, 220W-class consumer card: runs 3-bit to 4-bit quantized versions of a 27B-class model smoothly, with measured decode speeds above 50 tokens/s.
- 32GB VRAM, same bandwidth, 300W-class professional card: bandwidth is unchanged, so the speed gain is limited, but doubled capacity buys “context freedom” and the option of higher quantization. Expect 50+ tokens/s at 4-bit and around 40 tokens/s at 6-bit.
- Dual-card setup: runs a near-lossless 8-bit version and still has headroom with context pushed to 256K.
- Integrated graphics with unified memory on a thin-and-light laptop: memory bandwidth is typically a fraction of a discrete GPU’s, and the same 4-bit model runs at about 10 tokens/s. Fine for offline Q&A and reading code, not suitable as a primary production environment.
Integrated-graphics results can be used to roughly extrapolate the range for mobile and desktop processors in the same bandwidth class, but treat that as an order-of-magnitude reference rather than a precise promise.
3. KV Cache: Context Is the Real VRAM Killer
For a 27B-class model, the KV Cache for 16K of context takes about 1GB of VRAM, while 256K of context balloons to roughly 16GB. Quantizing the KV to 8-bit brings those down to about 0.5GB and 8GB respectively. In long-context scenarios, then, KV Cache overhead exceeds the weights themselves and becomes the main constraint in memory planning.
Practical recommendations:
- Size context to real business needs instead of maxing it out by default.
- Enable KV Cache quantization first; the quality cost is minimal and the capacity gain is multiplicative.
- Disable memory mapping and offload all layers to the GPU to avoid repeated transfers between host and device.
- Continuously collect VRAM usage and throughput curves with monitoring and logging so capacity planning has data behind it.
4. Quantization: Trading Quality for Speed
Top-1 token agreement rate is a direct way to gauge quantization loss: about 99% at 8-bit, which is close to lossless; about 98% at 6-bit; about 96% at 4-bit, the balance point between speed and quality; and about 92% at 3-bit, which is “barely usable” and more prone to format drift and broken logic on long-chain reasoning, structured output, and code generation. If a task is accuracy-sensitive, keep the bit width and give up context length instead.
5. Decoding Strategy: Speculative Decoding and Reasoning Budget
Speculative decoding uses a small draft model or the model’s own multi-token prediction head to propose several candidates at once, which the main model then verifies in parallel. With a high acceptance rate, this significantly reduces per-token latency. The tuning point is to keep the candidate count small, usually 2 to 3; going longer adds overhead when verification fails. Paired with this is reasoning budget control: setting inference depth to a light tier yields a faster first token and shorter total output, which is very cost-effective for code comprehension and log attribution.
Illustrative launch parameters (neutralized):
./llama-server \--model ./models/27B-UD-Q3_K_XL.gguf \--n-gpu-layers all \--ctx-size 16384 \--batch-size 512 \--flash-attn on \--reasoning on \--chat-template-kwargs '{"reasoning_effort":"low"}' \--no-mmap \--threads 2 \--parallel 1 \--spec-type draft-mtp \--spec-draft-n-max 2
Flash attention reduces VRAM and bandwidth pressure during attention, batch size affects prefill throughput, thread count only handles a small amount of finishing work under full GPU offload, and the parallel count determines the trade-off between concurrent sessions, VRAM, and throughput.
6. A Reproducible Benchmarking Method
- Fix the prompt and output length, and record time-to-first-token and steady-state decode speed separately.
- Measure at both short and long context to observe the decay introduced by KV Cache.
- Cross-compare different quantization levels of the same model and sample outputs for correctness.
- Record power draw and temperature to determine whether power-limit throttling is occurring.
- Store results as a baseline and use monitoring alerts to catch performance regressions.
7. Deployment Recommendations
On a limited budget, a single large-VRAM card running a 4-bit version is a safe starting point. For quality-sensitive work, move to 6-bit or 8-bit on two cards. For edge and offline scenarios, an integrated-graphics unified-memory setup is viable if you accept speeds around 10 tokens/s. If you need elasticity and unified operations, containerize the model service and deploy it on a container platform, distributing weights through object storage, smoothing spikes with a message queue, and observing everything through logging and monitoring, which makes it possible to build an inference service that scales smoothly in a cloud environment such as Baidu AI Cloud.
