Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run Scan×
Skip to content
World desk6 min

How to Fix Slow Inference and Out-of-Memory Errors in Local LLMs

Separate model loading, prompt processing, and token generation to find the cause of local LLM slowness. Then check GPU offload, context and KV-cache use, model fit, CPU threads, and runtime-specific settings.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Diagnose a local LLM by identifying which phase is slow, confirming where computation is running, and checking which memory pool is full. Separate model loading, prompt processing, and token generation before changing settings; then adjust context, cache, model size, placement, or CPU threads according to the evidence. Ollama, llama.cpp, and vLLM use different controls, so verify options against the installed runtime version.

First identify which part is slow

“Slow inference” can mean three different things: waiting for the model to load, waiting for the first generated token while the prompt is processed, or slow generation after output begins. Record which delay you see before tuning; a change aimed at the wrong phase can waste time or make another phase worse.

As an Amazon Associate I earn from qualifying purchases.

Slow model loading

For vLLM, model downloads depend on network conditions, and large models can take time to load. Slow shared or network filesystems and host-memory pressure that triggers operating-system swapping can also delay loading. The vLLM v0.18.2 troubleshooting guide suggests using a local model path and local disk, monitoring CPU memory, and testing with --load-format dummy to isolate loading behavior. That dummy format is a diagnostic, not a model-loading fix.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Slow prompt processing or generation

With llama.cpp server, distinguish prompt throughput from generation throughput. Its reference exposes llamacpp:prompt_tokens_seconds and llamacpp:predicted_tokens_seconds, as well as request and context counters. Use the metric that matches the delay rather than treating both as a single speed figure. See the llama.cpp server README and CLI reference.

#1 Best Overall
ASUS Dual Radeon RX 9060 XT 16GB GDDR6 Gaming Graphics Card | PCIe 5.0, HDMI 2.1b, DisplayPort 2.1a, 2.5-slot design, Axial-tech Fans, 0dB Technology
  • Axial-tech fans now feature a smaller fan hub that facilitates longer blades and a barrier ring that increases downward air pressure
  • 2.5-slot design allows for greater build compatibility while maintaining cooling performance
  • 0dB technology lets you enjoy light gaming in relative silence
  • Dual BIOS switch lets you toggle between Quiet and Performance BIOS profiles
  • Dual ball fan bearings last up to twice as long as sleeve bearing designs

Verify that the GPU is doing inference work

A detected GPU does not prove that the model is using it. For llama.cpp CUDA runs, inspect startup output for the number of layers offloaded to the GPU and total VRAM use. The llama.cpp performance guide identifies these diagnostics as evidence of GPU use.

The -ngl option asks llama.cpp to offload layers to the GPU; requesting many layers does not guarantee that every layer fits. The server CLI reference lists --gpu-layers (with -ngl as an alias) and --fit, which is on by default in the documented reference and adjusts unset arguments to fit device memory. Multi-GPU options include layer split (the documented default), row split, and experimental tensor split; these differ in placement and parallelization. Check the CLI help for your installed build before using a flag, since options and defaults can change.

Rank #2
GIGABYTE GeForce RTX 5070 Ti Gaming OC 16G Graphics Card, 16GB 256-bit GDDR7, PCIe 5.0, WINDFORCE Cooling System, GV-N507TGAMING OC-16GD Video Card
  • Powered by the NVIDIA Blackwell architecture and DLSS 4
  • Powered by GeForce RTX 5070 Ti
  • Integrated with 16GB GDDR7 256bit memory interface
  • PCIe 5.0
  • WINDFORCE cooling system

GPU acceleration depends on a build and backend that support your device, actual layer offload, and how much work remains on the CPU. A GPU flag by itself is not proof of acceleration.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Reduce context and KV-cache memory carefully

Longer context consumes memory, including memory for the key/value (KV) cache. If your task does not need the configured context length, lower it to the capacity the task actually requires before changing model or hardware. This can reduce memory pressure, but it also limits how much prompt and conversation history the model can use.

Rank #3
GIGABYTE GeForce RTX 5060 WINDFORCE OC 8G Graphics Card, Cooling System, 8GB 128-bit GDDR7, PCIe 5.0, Manufactured by NVIDIA, DisplayPort & HDMI - Video Output Interface, GV-N5060WF2OC-8GD Video Card
  • Powered by the NVIDIA Blackwell architecture and DLSS 4
  • Powered by GeForce RTX 5060
  • Integrated with 8GB GDDR7 128bit memory interface
  • PCIe 5.0
  • WINDFORCE cooling system

Ollama Flash Attention and cache types

Ollama documents Flash Attention as a way to significantly reduce memory use as context grows when the selected backend and devices support it. To force it, set OLLAMA_FLASH_ATTENTION=1; set it to 0 to disable it. Check the Ollama FAQ for current support and configuration details.

With Flash Attention enabled, Ollama documents the OLLAMA_KV_CACHE_TYPE setting. Its FAQ describes f16 as the default, q8_0 as using approximately half the memory of f16 with very small loss, and q4_0 as using approximately one quarter with a small-to-medium loss that may be more noticeable at higher context sizes. These are Ollama’s approximate comparisons, not guaranteed measurements for every model or runtime. The FAQ also notes that quality effects depend on model and task, and that models with high GQA count may be more affected by reduced precision. Validate cache changes using representative prompts; lower precision is not lossless and is not universally best.

Rank #4
Sale
GIGABYTE Radeon RX 9070 XT Gaming OC 16G Graphics Card, PCIe 5.0, 16GB GDDR6, GV-R9070XTGAMING OC-16GD Video Card
  • Powered by Radeon RX 9070 XT
  • WINDFORCE Cooling System
  • Hawk Fan
  • Server-grade Thermal Conductive Gel
  • RGB Lighting

Work through an out-of-memory error

OOM can result from model weights, KV cache, concurrency, or another runtime allocation. Check runtime logs and resource use rather than diagnosing from the error text alone. vLLM states: “If the model is too large to fit in a single GPU, you will get an out-of-memory (OOM) error.” Its troubleshooting guide points to memory-reduction options, but there is no universal VRAM threshold that predicts fit across different models and runtimes.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Reduce unnecessary context and concurrency. Lower context to the task’s real requirement, and avoid running more simultaneous requests than needed. This targets cache and concurrent-work pressure; confirm whether memory use falls.
  2. Choose a smaller or lower-memory model representation. A smaller model or a suitable quantized model can reduce the weight footprint, if supported by the runtime. Model changes can affect output quality, so compare results on the tasks you care about.
  3. Reduce cache use where the runtime supports it. In Ollama, consider the documented Flash Attention and KV-cache options above, then check both memory use and answer quality.
  4. Adjust placement or split across devices if supported. For llama.cpp, use supported GPU-layer or multi-GPU split controls and verify actual placement in startup diagnostics. Consult the installed build’s CLI because controls are runtime-specific.
  5. Add capacity only after confirming the bottleneck. More GPU memory may help when weights or the chosen context do not fit, but the needed capacity depends on the model and runtime allocation. The available documentation does not establish a universal sizing rule or a specific card recommendation.

Tune CPU threads without oversaturating the processor

If llama.cpp is using the CPU, or CPU work remains after GPU offload, too many threads can oversaturate the processor. The llama.cpp performance guide recommends starting with one -t or --threads thread and doubling until a bottleneck appears, then scaling back. It also advises using the number of physical CPU cores as an explicit setting if the one-thread test helps. Treat this as a troubleshooting heuristic, not a guaranteed optimum; compare generation throughput on your own system.

Best Value
Sale
ASUS Prime Radeon RX 9070 XT 16GB GDDR6 OC Edition Gaming Graphics Card | PCIe 5.0, HDMI/DP 2.1, 2.5-slot, Axial-tech Fans, Dual-ball Fan Bearings, dual BIOS, ASUS GPU Guard
  • Axial-tech fans now feature a smaller fan hub that facilitates longer blades and a barrier ring that increases downward air pressure
  • Phase-change GPU thermal pad helps ensure optimal heat transfer, lowering GPU temperatures for enhanced performance and reliability
  • 2.5-slot design allows for greater build compatibility while maintaining cooling performance
  • Dual-ball fan bearings last up to twice as long as standard conventional sleeve bearings designs
  • 0dB technology lets you enjoy light gaming in relative silence

The guide reports a configuration-specific benchmark of 9.1 tokens/s for a 30B-parameter Q4_0 GGML model on an NVIDIA A6000 with 48GB VRAM, a CPU with seven physical cores, and 32GB RAM, using -t 4 with its stated large GPU-layer setting. The same table reports 8.7 tokens/s with -t 7 and that GPU-layer setting. The project page does not state a publication year, and these results should not be generalized to other hardware, model formats, or current workloads.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Turn off temporary debugging instrumentation

After diagnosing a vLLM issue, remove debugging environment variables that are no longer needed. The vLLM troubleshooting guide specifically warns that VLLM_TRACE_FUNCTION=1 slows token generation by over 100x and says not to use it unless absolutely needed. A tracing setting left enabled can look like an inference-performance problem.

Choose fixes by the resource they affect

Make one change at a time and measure the same phase and workload again. The useful comparison is not simply “faster or slower”: note which resource changed, whether output quality or usable context changed, and whether your runtime and hardware support the setting.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Change Main resource affected Trade-off to check
Lower context length KV cache and associated memory Less prompt and conversation history fits.
Use lower-precision KV cache KV-cache memory; documented options are Ollama-specific Precision can affect quality, depending on model, task, and context.
Use a smaller or quantized model Model-weight footprint Output quality may change; runtime support varies.
Change GPU layer placement or multi-GPU split Device placement and available GPU memory Controls and behavior are runtime/build-specific; verify actual offload.
Use a local model path and disk; check host memory Storage/loading and host-RAM pressure Addresses loading bottlenecks, not necessarily prompt or generation speed.
Adjust CPU threads CPU scheduling and throughput Too many threads may oversaturate the CPU; measure on the target workload.

Keep runtime and model details with your measurements: runtime and build version, model and quantization, context length, concurrency, CPU and GPU memory use, relevant logs, and phase-specific timings. Without those details, a particular OOM message or slow response cannot be reliably mapped to one setting.

Quick Recap

Bestseller No. 1
ASUS Dual Radeon RX 9060 XT 16GB GDDR6 Gaming Graphics Card | PCIe 5.0, HDMI 2.1b, DisplayPort 2.1a, 2.5-slot design, Axial-tech Fans, 0dB Technology
ASUS Dual Radeon RX 9060 XT 16GB GDDR6 Gaming Graphics Card | PCIe 5.0, HDMI 2.1b, DisplayPort 2.1a, 2.5-slot design, Axial-tech Fans, 0dB Technology
0dB technology lets you enjoy light gaming in relative silence; Dual BIOS switch lets you toggle between Quiet and Performance BIOS profiles
$529.00
Bestseller No. 2
GIGABYTE GeForce RTX 5070 Ti Gaming OC 16G Graphics Card, 16GB 256-bit GDDR7, PCIe 5.0, WINDFORCE Cooling System, GV-N507TGAMING OC-16GD Video Card
GIGABYTE GeForce RTX 5070 Ti Gaming OC 16G Graphics Card, 16GB 256-bit GDDR7, PCIe 5.0, WINDFORCE Cooling System, GV-N507TGAMING OC-16GD Video Card
Powered by the NVIDIA Blackwell architecture and DLSS 4; Powered by GeForce RTX 5070 Ti; Integrated with 16GB GDDR7 256bit memory interface
$1,249.99
Bestseller No. 3
GIGABYTE GeForce RTX 5060 WINDFORCE OC 8G Graphics Card, Cooling System, 8GB 128-bit GDDR7, PCIe 5.0, Manufactured by NVIDIA, DisplayPort & HDMI - Video Output Interface, GV-N5060WF2OC-8GD Video Card
GIGABYTE GeForce RTX 5060 WINDFORCE OC 8G Graphics Card, Cooling System, 8GB 128-bit GDDR7, PCIe 5.0, Manufactured by NVIDIA, DisplayPort & HDMI - Video Output Interface, GV-N5060WF2OC-8GD Video Card
Powered by the NVIDIA Blackwell architecture and DLSS 4; Powered by GeForce RTX 5060; Integrated with 8GB GDDR7 128bit memory interface
$495.99
SaleBestseller No. 4
GIGABYTE Radeon RX 9070 XT Gaming OC 16G Graphics Card, PCIe 5.0, 16GB GDDR6, GV-R9070XTGAMING OC-16GD Video Card
GIGABYTE Radeon RX 9070 XT Gaming OC 16G Graphics Card, PCIe 5.0, 16GB GDDR6, GV-R9070XTGAMING OC-16GD Video Card
Powered by Radeon RX 9070 XT; WINDFORCE Cooling System; Hawk Fan; Server-grade Thermal Conductive Gel
$814.28
SaleBestseller No. 5
ASUS Prime Radeon RX 9070 XT 16GB GDDR6 OC Edition Gaming Graphics Card | PCIe 5.0, HDMI/DP 2.1, 2.5-slot, Axial-tech Fans, Dual-ball Fan Bearings, dual BIOS, ASUS GPU Guard
ASUS Prime Radeon RX 9070 XT 16GB GDDR6 OC Edition Gaming Graphics Card | PCIe 5.0, HDMI/DP 2.1, 2.5-slot, Axial-tech Fans, Dual-ball Fan Bearings, dual BIOS, ASUS GPU Guard
0dB technology lets you enjoy light gaming in relative silence; Dual BIOS switch lets you toggle between Quiet and Performance BIOS profiles
$831.99

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.