llama.cpp (Vulkan): vk::Device::allocateMemory: ErrorOutOfDeviceMemory (graphics memory block too large or VRAM full)
With the Vulkan backend (often on AMD and Intel graphics), llama.cpp can’t allocate a memory block on the graphics card when loading and aborts. One variant reads: “Requested buffer size exceeds device memory allocation limit: ErrorOutOfDeviceMemory”.
The message
ggml_vulkan: Device memory allocation of size 4257734656 failed.
ggml_vulkan: vk::Device::allocateMemory: ErrorOutOfDeviceMemory
llama_model_load: error loading model: vk::Device::allocateMemory: ErrorOutOfDeviceMemory
Affects: llama.cpp
Why is this happening?
Either the VRAM is truly full because too many layers are being sent to the graphics card, or a single block is larger than the driver allows at once. According to the llama.cpp developers, this limit is 2 GB per block with AMDVLK and the official AMD drivers, and 4 GB with RADV (Linux). In that case, the error appears even if there is enough free VRAM overall.
How to fix it
- Check the output: If it says “Requested buffer size exceeds device memory allocation limit”, a single block is too large. If it only says “Device memory allocation of size … failed”, the VRAM is usually full.
- Put fewer layers on the graphics card, for example
-ngl 23instead of all layers. The model will then run partly on the CPU and more slowly, but it will load. - Use a smaller quantization, for example Q4_K or Q5_K instead of BF16 or Q8. Large unquantized models have especially large individual blocks.
- On Linux with an AMD card: Try the RADV driver instead of AMDVLK. In the reported case, the same model loaded without problems with RADV.
- On older cards, some users found that the environment variable
GGML_VK_FORCE_MAX_ALLOCATION_SIZE=2147483646(2 GB) helped. If that doesn’t work, the developer says to try 1 GB; otherwise the driver may be broken.
Better not: Don’t set GGML_VK_FORCE_MAX_ALLOCATION_SIZE higher than your driver allows (for example 3000000000 with a 2 GB limit): According to the llama.cpp developers, that is invalid use of the Vulkan API and will very likely not work properly.
Set up from scratch again
If it still doesn’t work after that, a fresh setup step by step often helps:
- LM Studio: Your First Local Chat
Install LM Studio on Windows, load a suitable language model, and chat offline, even with your own documents. - VRAM explained: why it decides everything
How much VRAM does local AI need? Rule of thumb, quantization (Q4, Q8, fp8), context, image and video models, offloading, and which card si…
Terms for this
Similar errors
Sources
- https://github.com/ggerganov/llama.cpp/issues/5441
- https://github.com/ggml-org/llama.cpp/issues/15054
Checked on Oct 28, 2026. Didn't help? Ask in the forum and name the graphics card, program, and the full message.