llama-server Split Buffers & KV Cache Crash
Fix llama.cpp / llama-server device cuda0 does not support split buffers, failed to allocate buffer for kv cache, and mixed-GPU startup crashes.
When llama-server fails at startup with device cuda0 does not support split buffers or failed to allocate buffer for kv cache on a mixed-GPU workstation, hide secondary or integrated GPUs with CUDA_VISIBLE_DEVICES=0, pass --split-mode none if running on one GPU, and lower context size (-c) or offloaded layers (-ngl) so the KV buffer fits remaining VRAM.
- Symptom
llama_model_load: error loading model: device cuda0 does not support split buffers- Root cause
- The runtime attempted to split tensors across an incompatible GPU configuration or requested more KV-cache VRAM than remains after loading model weights.
- Recommended fix
CUDA_VISIBLE_DEVICES=0- How Denpex helps
- Denpex investigates llama-server Split Buffers & KV Cache Crash using the evidence you provide or your connected workload collects. Earlier rank, host or application evidence is needed to distinguish an initiating failure from a downstream report.
What this failure is
A llama.cpp / llama-server initialization failure when device memory allocation or multi-GPU buffer splitting exceeds hardware or backend limits.
Is this what broke your run? Paste your log.
You're reading about llama-server Split Buffers & KV Cache Crash. Paste your own traceback and relevant evidence for an investigation of your workload, with a next action or a specific missing fact. A reference entry does not establish your cause. No account or card for the free diagnosis. Review data handling before submitting sensitive logs.
Before uploading, review cloud data handling and local options.
Upload your log file. Large files are processed in your browser. Only selected evidence is submitted when you run diagnosis.
Why it happens (the mechanism)
Workstations with heterogeneous GPUs (or an integrated GPU alongside a discrete NVIDIA card) expose devices with incompatible capabilities or insufficient free VRAM for the requested context length and KV cache.
What you'll observe
- llama-server aborts before serving requests with split-buffer or KV-cache buffer allocation errors.
- Both vision and text startup attempts crash immediately when an unsupported secondary GPU is visible.
Common symptoms and what they mean
Check possible explanations against the incident evidence. A matching symptom alone does not establish its cause.
| Symptom | Possible explanation |
|---|---|
| llama_model_load: error loading model: device cuda0 does not support split buffers | The runtime attempted to split tensors across an incompatible GPU configuration or requested more KV-cache VRAM than remains after loading model weights. |
| failed to initialize the context: failed to allocate buffer for kv cache | The runtime attempted to split tensors across an incompatible GPU configuration or requested more KV-cache VRAM than remains after loading model weights. |
| llama-server crashed at startup on mixed-GPU hosts | The runtime attempted to split tensors across an incompatible GPU configuration or requested more KV-cache VRAM than remains after loading model weights. |
Which systems are affected
- llama.cpp llama-server and embedded wrappers such as Unsloth Studio
- Multi-GPU or hybrid iGPU + dGPU Linux and Windows workstations
How to confirm this is the problem
Use this checklist to test the hypothesis against a small reproduction. No single line proves the root cause, so preserve the preceding events and compare one variable at a time.
- ✓Test launching llama-server with CUDA_VISIBLE_DEVICES=0 and --split-mode none on a small -c 2048 context.
- ✓Observe free VRAM reported by nvidia-smi immediately before context allocation.
Root cause
- The runtime attempted to split tensors across an incompatible GPU configuration or requested more KV-cache VRAM than remains after loading model weights.
The fix and how to prevent it
How to fix it
- Run nvidia-smi -L to inspect all enumerated GPUs and hide unsupported secondary GPUs by exporting CUDA_VISIBLE_DEVICES=0 before launching llama-server.
- On single-GPU deployments, pass --split-mode none (or -sm none) so llama.cpp does not attempt split-buffer allocation.
- Reduce -c (context size), enable KV cache quantization (-ctk q8_0 -ctv q8_0) where supported, or decrease -ngl when KV buffer allocation fails.
- Verify the NVIDIA driver and CUDA build of llama-server match the compute capability of the selected GPU.
Step-by-step remediation
- 1Run nvidia-smi -L and identify the primary target GPU index or UUID.
- 2Launch with CUDA_VISIBLE_DEVICES=0 and --split-mode none.
- 3Lower -c or enable quantized KV cache if failed to allocate buffer for kv cache persists.
How to prevent it
- Pin CUDA_VISIBLE_DEVICES explicitly in systemd units or launcher scripts on multi-GPU workstations.
- Size -c context limits against model weights plus KV cache headroom before startup.
Save this diagnosis and catch the next crash automatically
All root cause, fix, and prevention steps above are free to read. Create a free account with any email or GitHub to keep your saved diagnosis history across the encyclopedia and run cloud checks, or use a work email below for the 30-day Team evaluation. No card required.
Or start a 30-day free Team trial (work email)
Verified work email unlocks all 14 fleet diagnostic tools, Slack alerts, and team history for 30 days. No card and no automatic charge.
Searchable error signature
llama_model_load: error loading model: device cuda0 does not support split buffers
llama_init_from_model: failed to initialize the context: failed to allocate buffer for kv cacheUse this text as a lookup key in logs and upstream issue trackers. It is not presented as a captured customer log. Confirm the cause from your own preceding events, versions, configuration and the cited references.
Diagnose your own log automatically
The root cause and fix steps above stay free. Create a free account to analyze full job logs, attribute the first failed rank, and keep saved incident history.
Sign up free. Analyze your cluster logsNo credit card. Daily allowance follows verified trust tier. Instant access.
Why the recommended fix works
Isolating a single supported CUDA device and bounding the KV cache context window eliminates incompatible multi-GPU buffer splits and VRAM oversubscription.
Code examples
nvidia-smi -L
CUDA_VISIBLE_DEVICES=0 llama-server -m model.gguf --split-mode none -ngl 99 -c 8192This snippet illustrates the entry-specific check. Verify the installed versions, permissions, target and workload context before using it. A command or API example is not proof of recovery.
Best practices by model family
| Model / Stack | Recommendation | Notes |
|---|---|---|
| Split buffers error | Set CUDA_VISIBLE_DEVICES and --split-mode none | Prevents splitting buffers onto an incompatible secondary GPU or Vulkan/iGPU device. |
| KV cache buffer failed | Lower -c or use q8_0 KV cache | Long default context windows (32k to 128k) rapidly exhaust leftover VRAM. |
With the fix vs without the fix
| Dimension | With the fix | Without the fix |
|---|---|---|
| Device selection | Explicit CUDA_VISIBLE_DEVICES=0 | Exposing all mixed GPUs to llama-server |
| KV buffer sizing | Bounded -c matching free VRAM | Defaulting to full model max context |
Diagnostic note
“Derived from upstream llama.cpp server flags and CUDA backend memory allocation behavior.”
Visual fingerprint
startup crash -> split buffers error? -> CUDA_VISIBLE_DEVICES=0 + --split-mode none | kv cache failed? -> lower -c or -ngl
Diagnose this failure in VS Code
Select the traceback or open the failed terminal, then run Denpex locally to inspect matched failure patterns, supporting evidence and next checks without uploading the log. Verify recommendations against your workload before changing production.
Install the free VS Code extensionCUDA errors in context
CUDA errors can surface asynchronously at a later operation. The hub connects documented errors with evidence checks for locating the initiating failure.
Compare related cuda errorsFrequently asked questions
Questions engineers and on-call staff commonly ask about this failure.
Why does device cuda0 say it does not support split buffers?
How do I fix failed to allocate buffer for kv cache in llama.cpp?
Don't just read the fix, diagnose your run
The encyclopedia explains documented failure patterns. Denpex investigates your logs, configuration and stack, shows the supporting evidence, and asks for missing details when needed.