Free | No tracking | Every fact with a source|German and English

Error / Memory

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

  1. 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.
  2. Put fewer layers on the graphics card, for example -ngl 23 instead of all layers. The model will then run partly on the CPU and more slowly, but it will load.
  3. Use a smaller quantization, for example Q4_K or Q5_K instead of BF16 or Q8. Large unquantized models have especially large individual blocks.
  4. 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.
  5. 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:

Terms for this

Similar errors

Sources

Checked on Oct 28, 2026. Didn't help? Ask in the forum and name the graphics card, program, and the full message.