A slow local model is usually not one problem. It is a chain of stages: loading the model into memory, processing the prompt, and generating tokens. The fastest way to troubleshoot is to measure those stages separately before changing hardware or settings. This checklist is for technically curious beginners and intermediate practitioners running models with Ollama, llama.cpp, LM Studio, Jan, vLLM, or similar local runtimes.
The core diagnostic is simple: compare a cold first request with a warm second request of similar length, then reduce the input to a short prompt in a fresh conversation. That tells you whether the delay is loading, prompt processing, or generation. From there, inspect where the model is running, how much context and memory it is using, and whether the runtime reports errors.
Step 1: Separate loading, prompt processing, and token generation
The local model troubleshooting guide recommends separating model loading, prompt processing, and slow generation, then checking the runtime before changing hardware. Use the same short prompt for each retry.
Procedure:
- Send a short prompt. Keep the model open.
- Send a second prompt of similar length.
- Record the delay before text appears and the time until the answer is finished separately.
Interpretation: if only the first request after opening the model is slow, model loading may dominate. That observation does not establish slow token generation. A repeated warm request should start sooner. If both warm and cold requests stay slow, move on to generation or prompt processing checks.
For Ollama, commands apply to Ollama. In Jan or LM Studio, inspect the runtime’s equivalent load, context, and GPU-offload information. The distinction matters because a slow first response and a slow answer are different symptoms.
Step 2: Reduce the input to isolate prompt processing
Long histories, attached documents, and reasoning can delay the visible answer. A fast short prompt helps isolate the workload.
Procedure:
- Open a fresh conversation with no files or retrieved documents.
- Ask for a brief answer, using the same model and runtime settings.
- Compare that run with the original task. Record context and reasoning mode when supported.
If the short request is fast, add history or documents back one at a time. If it is still slow, inspect where the model is running. This controlled retry keeps the model and runtime settings constant, so the input length is the main variable.
Step 3: Check whether the model is running on CPU or GPU
CPU inference is expected to be 10–50x slower than GPU for the same model. Use a smaller model or get GPU offload working. Local Inference performance guidance notes that if the whole model does not fit in VRAM, you can offload only some transformer layers to GPU and leave the rest on CPU.
In llama.cpp, this is the -ngl option. More layers on GPU means faster, until you run out of VRAM. The local model troubleshooting guide also recommends checking the memory budget before buying a GPU, because a CPU/GPU split means part of the model is on CPU.
Memory budgeting should account for context and KV cache and runtime overhead, not only model weights. Every doubling of context roughly doubles KV cache size at a given batch size.
Useful checks:
- Confirm the runtime is actually using the GPU and how many layers are offloaded.
- Inspect the runtime’s load, context, and GPU-offload information.
- For CUDA systems, check
nvidia-smifirst when a runtime will not start or reports memory pressure.
Step 4: Reduce context length and memory pressure
Do not request a bigger context window than you need. Context length versus memory is a direct tradeoff: every doubling of context roughly doubles KV cache size at a given batch size.
If you see CUDA out of memory, drop to a smaller quantization, reduce --max-model-len or -c context size, or offload fewer layers to GPU.
Quantization level is another lever. Drop from Q5 or Q6 to Q4_K_M if memory constrained. The quality loss is usually smaller than expected, especially for straightforward tasks.
For Ollama model loading problems, run ollama list to confirm the exact tag. Tags are case-sensitive and versioned.
Reducing context can improve speed and memory use, but it may truncate long tasks. If the task genuinely needs a long context, consider a smaller model or quantization, more memory, or a different runtime rather than forcing a context window that does not fit.
Step 5: Check the runtime, driver, and server settings
If vLLM will not start, it is almost always a CUDA or driver version mismatch or insufficient --gpu-memory-utilization headroom. Check nvidia-smi first.
Batch size and concurrent requests are irrelevant for single-user chat but critical for a server. This is the whole reason vLLM exists over naive serving. If you are running a local server for one user, do not tune batch size first; tune the model, context, and offload.
Model output that looks garbled or repetitive may indicate the wrong prompt template for that model. Chat models expect a specific format wrapping user and assistant turns. In transformers, this is often tokenizer.apply_chat_template; Ollama and llama-server may handle it automatically when using the right GGUF. This is not a speed fix, but it prevents you from misdiagnosing a broken output as a performance problem.
Step 6: Consider advanced acceleration only after the basics
Speculative decoding is an advanced technique supported by llama.cpp and vLLM. A small draft model proposes several tokens and the large model verifies them in one pass, often 1.5–2x faster with no quality loss.
Use it after you have confirmed the model fits, the GPU offload is working, and context length is appropriate. Otherwise you may add complexity without fixing the bottleneck.
A reproducible troubleshooting record
If the cause cannot be determined from these checks, collect the missing diagnostic information before asking for help. A useful record includes:
- Exact model file, tag, and quantization.
- Runtime and version: Ollama, llama.cpp, LM Studio, Jan, vLLM, or other.
- Operating system and hardware, including GPU and VRAM.
- Context length, GPU-offload layers, and batch or concurrency settings.
- Whether the slow request was cold or warm.
- Prompt length, attached documents, and reasoning mode.
- Exact error messages, with secrets masked.
Change one variable at a time. Re-run the warm-request comparison after each change. A fix is verified when the same short prompt returns quickly on a warm request and the original workload improves without new memory errors.
Quick checklist
- Compare cold versus warm request with the same short prompt.
- Use a fresh conversation with no files or retrieved documents.
- Check whether the model is on CPU or GPU and how many layers are offloaded.
- Reduce context length; remember KV cache grows with context.
- Drop quantization if memory constrained.
- Check runtime tags, CUDA or driver compatibility, and
nvidia-smi. - Only then try speculative decoding or server-level batching.
If you are stuck, share your goal, environment, measurements, and exact error in the Ai-Forum community. The most useful posts include the cold and warm timings and the runtime settings that changed the result.
FAQ
Why is the first request slow but later requests fast?
Model loading may dominate the first request. Compare a cold first request with a warm second request of similar length. If only the first request is slow, keep loading time separate from generation time.
Does a larger context window always slow down a local model?
Every doubling of context roughly doubles KV cache size at a given batch size, so a larger context increases memory pressure. Request only the context window you need.
Should I buy a GPU before changing settings?
Check the memory budget first. Confirm whether the model is split between CPU and GPU, how many layers are offloaded, and whether a smaller quantization or context size removes the bottleneck.
What should I include in a troubleshooting post?
Include the exact model, tag, quantization, runtime and version, OS and hardware, context length, GPU-offload layers, cold and warm timings, prompt length, and the exact error with secrets masked.
Is CPU inference always unusable?
CPU inference is expected to be 10–50x slower than GPU for the same model. A smaller model or GPU offload may make it practical, but the tradeoff depends on your workload.