SysArt
Book a briefing
SysArt

On-premises AI

How to Overcome Local (On-Premises) LLM Performance Problems

How to diagnose slow on-premises LLMs, then fix latency, throughput and memory limits with the right engine, batching settings, quantisation and scaling.

Last reviewed by SysArt AI Architecture Team6 min readHow we review

In short

Most on-premises LLM performance problems have a few causes: an engine without continuous batching, too little GPU memory for the KV cache, prompts longer than they need to be, or too few replicas for peak load. Measure time to first token, inter-token latency, queueing and cache usage first, then change one setting at a time and measure again.

Key takeaways

  • Measure before tuning: time to first token, inter-token latency, throughput, queue length and KV cache usage show where the time goes.
  • Use an engine built for concurrent serving. vLLM combines PagedAttention, continuous batching, chunked prefill and prefix caching; llama.cpp suits CPUs, Apple silicon and smaller setups.
  • Quantised weights free GPU memory for more concurrent requests, but check answer quality on your own evaluation set.
  • Scale replicas on queue length and latency targets, not on GPU utilisation, which only reports whether a kernel was running.
Two colleagues with a laptop talking next to server racks in a data centre

Why do local LLMs run slowly?

Local LLMs usually run slowly because generating text is limited by GPU memory and memory bandwidth, and because many serving setups do not share the GPU efficiently between users. Control over infrastructure brings data and privacy benefits, but nobody else tunes the stack for you.

LLM inference has two phases. In the prompt phase, the model processes all prompt tokens in parallel, which uses the GPU efficiently. In the generation phase, it produces one token at a time, reading its weights and the cached keys and values of earlier tokens for each step. The PagedAttention paper describes this phase as memory-bound and responsible for most of a single request’s latency. Each request also holds a key-value (KV) cache in GPU memory for as long as it runs, so memory limits how many requests can be served together.

The symptoms point to the cause:

  • Long wait before the first word usually means queueing or very long prompts.
  • Slow streaming once an answer starts points to memory bandwidth, too many concurrent sequences or a model too large for the hardware.
  • Errors or timeouts under load suggest memory exhaustion or a missing queue limit.
  • Throughput that does not grow with more users suggests that requests are not being batched.

How do you find the bottleneck?

Measure where each request spends its time before you change anything. Use realistic prompts, output lengths and concurrency on the target hardware, because a single short test prompt hides most problems.

Track these signals:

  • Time to first token (TTFT): queueing plus prompt processing.
  • Inter-token latency: how fast tokens arrive once streaming starts.
  • Throughput: tokens per second across all users at your latency target.
  • Waiting and running requests: whether requests queue for capacity.
  • KV cache usage and preemptions: whether memory, rather than compute, limits concurrency.

Be careful with GPU utilisation. nvidia-smi defines it as the percentage of time in which one or more kernels were executing on the GPU, so a GPU can report high utilisation while doing little useful work, or low utilisation while requests wait in a queue elsewhere. Our post on observability for on-premises AI lists the metrics that serving engines expose.

Which inference engine should you use?

Choose an engine designed for the way the model will be used: many concurrent users on data-centre GPUs, or a single user, a CPU server or an edge device.

Infographic contrasting llama.cpp (CPU-friendly, portable, quantisation, edge) with vLLM (GPU-accelerated, high throughput, tensor parallelism, GPU cluster)

The infographic simplifies the split. In practice:

  • vLLM is a library for LLM inference and serving. It manages KV cache memory with PagedAttention and offers continuous batching of incoming requests, chunked prefill, prefix caching, quantisation, speculative decoding, tensor and pipeline parallelism and an OpenAI-compatible API server. It runs on NVIDIA and AMD GPUs and on x86, ARM and PowerPC CPUs. It fits multi-user services.
  • llama.cpp is a plain C/C++ implementation without dependencies. It treats Apple silicon as a first-class platform, supports 1.5-bit to 8-bit integer quantisation, has backends for NVIDIA and AMD GPUs, and can split a model between CPU and GPU when the model is larger than GPU memory. It fits single users, edge devices and CPU-only servers.

Our comparison of vLLM, Ollama, llama.cpp and SGLang covers the choice in more depth, and our explainer on LLM inference serving explains batching and latency trade-offs.

How do batching and scheduling affect speed?

Batching lets one pass over the weights serve many requests, so it is the biggest single lever for throughput. Modern engines batch continuously: they add new requests to the running batch as others finish, instead of waiting for a whole batch to complete. The PagedAttention paper reports 2 to 4 times the throughput of earlier serving systems at the same level of latency, largely because better memory management lets more requests run together.

In vLLM, the key scheduling settings are:

  • Chunked prefill. In vLLM V1 it is enabled by default where possible, and the scheduler then prioritises decode requests, so long prompts do not stall users who are already receiving tokens.
  • max_num_batched_tokens. The token budget per scheduling step. vLLM’s tuning guide says smaller values, such as 2048, give better inter-token latency, while higher values give better time to first token.
  • max_num_seqs. The maximum number of sequences processed together. Lowering it puts fewer requests in each batch, so they need less KV cache space and are preempted less often.

Interactive assistants and overnight document jobs need different settings, so give them separate deployments or queues.

How do you reduce memory pressure?

Every gigabyte you free in GPU memory can hold more concurrent requests. Four measures help, in roughly this order:

  1. Cap context and output length for each use case. Send retrieval results that are short and relevant rather than whole documents.
  2. Enable prefix caching where many requests share a long system prompt or the same few-shot examples, so the shared part is computed once.
  3. Quantise the weights. vLLM supports formats including FP8, INT8, INT4, GPTQ, AWQ and GGUF. Validate answer quality on your own evaluation set before switching.
  4. Store the KV cache at lower precision where the engine supports it, again with an evaluation run.

Our post on GPU memory and KV cache optimisation shows how to calculate the cache and when to split a model across GPUs.

Which fix matches which symptom?

SymptomLikely causeFirst fix to try
Long time to first token at peak onlyQueueing for capacityAdd replicas, or separate batch traffic from interactive traffic
Long time to first token for every requestLong prompts or a slow prompt phaseShorten prompts, enable prefix caching, raise the per-step token budget
Slow streamingMemory bandwidth or too many concurrent sequencesLower max_num_seqs, use a smaller or quantised model
Timeouts and preemptions under loadKV cache exhaustedCap context length, quantise, add GPU memory
Throughput flat as users growNo continuous batchingMove to a serving engine with continuous batching

How should you scale for peak load?

Scale the number of replicas on the signals users feel: queue length and latency against your targets. GPU utilisation, as defined above, is a poor scaling signal on its own.

  • Keep a minimum number of warm replicas. Loading large weights onto GPUs takes time, so a replica started at the moment of a spike arrives late. Our post on cold-start optimisation covers ways to shorten it.
  • Scale up on sustained queue growth and scale down slowly, so that capacity does not oscillate.
  • Route through a gateway that spreads requests across replicas, applies per-team quotas and fails over when a replica is unavailable.
  • Plan headroom in hardware, because on-premises you cannot add GPUs on demand. The LLM GPU sizing calculator estimates memory per replica.

What does a minimal vLLM deployment look like?

After installing vLLM for your hardware, one command starts an OpenAI-compatible server, by default at http://localhost:8000. The model in this example is the one used in vLLM’s quickstart.

# Set VLLM_API_KEY first: the server then requires that key on every request.
vllm serve Qwen/Qwen2.5-1.5B-Instruct

Any OpenAI-compatible client can then call it:

from openai import OpenAI

client = OpenAI(base_url="http://localhost:8000/v1", api_key="<value of VLLM_API_KEY>")
response = client.chat.completions.create(
    model="Qwen/Qwen2.5-1.5B-Instruct",
    messages=[{"role": "user", "content": "Summarise our travel policy in three bullet points."}],
)
print(response.choices[0].message.content)

In production, put the engine behind an AI gateway with single sign-on, quotas and logging rather than exposing it directly. The on-premises AI reference architecture shows where each component sits.

What should you check before going live?

  • Benchmark latency and throughput with realistic prompts, outputs and concurrency on the target hardware.
  • Agree time-to-first-token and inter-token latency targets with the service owner for each use case.
  • Cap context and output length per use case, and enable prefix caching for shared prompts.
  • Validate every quantisation choice on your evaluation set.
  • Export engine metrics and alert on queue growth, cache saturation and preemptions.
  • Keep enough warm replicas for peak load, and test what happens when one fails.
  • Record engine versions and settings with each release, so you can compare and roll back.

Frequently asked questions

Why is my local LLM slow even though the GPU looks idle?

GPU utilisation in nvidia-smi is the share of time in which at least one kernel was running, so it says little about how much work the GPU is doing. Slow responses with apparently spare GPU time usually point to queueing, an engine that processes requests one at a time, or long prompts. Check the queue, time to first token and KV cache usage instead.

Should I use vLLM or llama.cpp for on-premises inference?

Use vLLM, or a comparable serving engine, for multi-user services on data-centre GPUs: it is built around PagedAttention and continuous batching and offers an OpenAI-compatible server. Use llama.cpp for CPUs, Apple silicon, edge devices and models larger than GPU memory, where its CPU and GPU hybrid inference and wide range of quantisation levels help. Benchmark both on your workload.

Does quantisation make an LLM faster?

Often, because the model needs less memory and less memory traffic per token, which leaves more room for the KV cache and more concurrent requests. vLLM supports formats including FP8, INT8, INT4, GPTQ, AWQ and GGUF. Quality can change, sometimes only on specific tasks, so compare the quantised and original models on your own evaluation set before switching.

What is chunked prefill and should I enable it?

Chunked prefill splits the processing of long prompts into pieces, so that generating tokens for other users does not stall behind a large prompt. In vLLM V1 it is enabled by default where possible, and the scheduler then prioritises decode requests. A smaller token budget per step improves inter-token latency; a larger one improves time to first token.

When should I add GPUs instead of tuning?

When measurements show the KV cache is full at your target concurrency even with sensible context limits, quantisation and prefix caching, or when queues grow at peak although each request is served efficiently. Then add replicas, or split a model that no longer fits across GPUs. The GPU sizing calculator estimates the memory you need.

Related insights

Plan your private AI with people who build it

Book a briefing. We look at your use case, data and constraints, and you leave with the deployment options and governance steps that fit.