Stable MTP first release!

#3
by danielhanchen - opened
Unsloth AI org
edited May 13

MTP GGUFs are still experimental, but for now they function ok

MTP speculative decoding for ~1.5-2x faster generation — build llama.cpp from the MTP PR branch

Thanks for waiting - all quants should work well now - but remember these are still EXPERIMENTAL until the MTP branch is merged

apt-get install pciutils build-essential cmake curl libcurl4-openssl-dev -y
git clone -b mtp-clean https://github.com/am17an/llama.cpp.git
cmake llama.cpp -B llama.cpp/build -DBUILD_SHARED_LIBS=OFF -DGGML_CUDA=ON
cmake --build llama.cpp/build --config Release -j --clean-first --target llama-cli llama-server
cp llama.cpp/build/bin/llama-* llama.cpp
export LLAMA_CACHE="unsloth/Qwen3.6-35B-A3B-MTP-GGUF"
./llama.cpp/llama-server \
    -hf unsloth/Qwen3.6-35B-A3B-MTP-GGUF:UD-Q4_K_XL \
    -ngl 99 -c 8192 -fa on -np 1 \
    --spec-type mtp --spec-draft-n-max 2

Set -DGGML_CUDA=OFF for CPU/Metal. -np > 1 and --mmproj are not yet supported with MTP.

danielhanchen pinned discussion
This comment has been hidden (marked as Resolved)

I have 2t/s on this model and 25t/s on stable llama.cpp without MTP. I don't know why. I compiled with -DGGML_CUDA=OFF. Both models are MXFP4_MOE. Mac M1 Pro 32GB.
My command:

./llama-server --host 127.0.0.1 --port 5678 --flash-attn on --jinja -c 4096 -ngl all --fit on -np 1 -ctk q8_0 -ctv q8_0 --spec-type mtp --spec-draft-n-max 3 -m ~/LLM/models/unsloth/Qwen3.6/Qwen3.6-35B-A3B-MXFP4_MOE-2.gguf

Anyone has the same issue? Did i missed some flag?

slot update_slots: id  0 | task 0 | prompt processing done, n_tokens = 12, batch.n_tokens = 4
~llama_io_write_device: allocated 'MTL0' buffer 62.812 MiB
ggml_metal_synchronize: error: command buffer 1 failed with status 5
error: Insufficient Memory (00000008:kIOGPUCommandBufferCallbackErrorOutOfMemory)
ggml_metal_synchronize: error: command buffer 1 failed with status 5
error: Insufficient Memory (00000008:kIOGPUCommandBufferCallbackErrorOutOfMemory)
ggml_metal_synchronize: error: command buffer 1 failed with status 5
error: Insufficient Memory (00000008:kIOGPUCommandBufferCallbackErrorOutOfMemory)
ggml_metal_synchronize: error: command buffer 1 failed with status 5
error: Insufficient Memory (00000008:kIOGPUCommandBufferCallbackErrorOutOfMemory)
ggml_metal_synchronize: error: command buffer 1 failed with status 5
error: Insufficient Memory (00000008:kIOGPUCommandBufferCallbackErrorOutOfMemory)
ggml_metal_synchronize: error: command buffer 1 failed with status 5
error: Insufficient Memory (00000008:kIOGPUCommandBufferCallbackErrorOutOfMemory)
ggml_metal_synchronize: error: command buffer 1 failed with status 5
error: Insufficient Memory (00000008:kIOGPUCommandBufferCallbackErrorOutOfMemory)
ggml_metal_synchronize: error: command buffer 1 failed with status 5

Is MTP uses much more memory?

I have 2t/s on this model and 25t/s on stable llama.cpp without MTP. I don't know why. I compiled with -DGGML_CUDA=OFF. Both models are MXFP4_MOE. Mac M1 Pro 32GB.
My command:

./llama-server --host 127.0.0.1 --port 5678 --flash-attn on --jinja -c 4096 -ngl all --fit on -np 1 -ctk q8_0 -ctv q8_0 --spec-type mtp --spec-draft-n-max 3 -m ~/LLM/models/unsloth/Qwen3.6/Qwen3.6-35B-A3B-MXFP4_MOE-2.gguf

Anyone has the same issue? Did i missed some flag?

slot update_slots: id  0 | task 0 | prompt processing done, n_tokens = 12, batch.n_tokens = 4
~llama_io_write_device: allocated 'MTL0' buffer 62.812 MiB
ggml_metal_synchronize: error: command buffer 1 failed with status 5
error: Insufficient Memory (00000008:kIOGPUCommandBufferCallbackErrorOutOfMemory)
ggml_metal_synchronize: error: command buffer 1 failed with status 5
error: Insufficient Memory (00000008:kIOGPUCommandBufferCallbackErrorOutOfMemory)
ggml_metal_synchronize: error: command buffer 1 failed with status 5
error: Insufficient Memory (00000008:kIOGPUCommandBufferCallbackErrorOutOfMemory)
ggml_metal_synchronize: error: command buffer 1 failed with status 5
error: Insufficient Memory (00000008:kIOGPUCommandBufferCallbackErrorOutOfMemory)
ggml_metal_synchronize: error: command buffer 1 failed with status 5
error: Insufficient Memory (00000008:kIOGPUCommandBufferCallbackErrorOutOfMemory)
ggml_metal_synchronize: error: command buffer 1 failed with status 5
error: Insufficient Memory (00000008:kIOGPUCommandBufferCallbackErrorOutOfMemory)
ggml_metal_synchronize: error: command buffer 1 failed with status 5
error: Insufficient Memory (00000008:kIOGPUCommandBufferCallbackErrorOutOfMemory)
ggml_metal_synchronize: error: command buffer 1 failed with status 5

Is MTP uses much more memory?

yes

Unsloth AI org

Try reducing --spec-draft-n-max 3 to --spec-draft-n-max 2

Try reducing --spec-draft-n-max 3 to --spec-draft-n-max 2

Still 2t/s and crashes. Are there are any recommendations how to calculate VRAM required to run this MTP models? E.g., if i previously was running MXFP4 with success, how many VRAM i needed now? x2? x3?

Try reducing --spec-draft-n-max 3 to --spec-draft-n-max 2

Still 2t/s and crashes. Are there are any recommendations how to calculate VRAM required to run this MTP models? E.g., if i previously was running MXFP4 with success, how many VRAM i needed now? x2? x3?

Try adding --fitt 2048. If it works, try reducing it. if possible.

I have 2t/s on this model and 25t/s on stable llama.cpp without MTP. I don't know why. I compiled with -DGGML_CUDA=OFF. Both models are MXFP4_MOE. Mac M1 Pro 32GB.
My command:

./llama-server --host 127.0.0.1 --port 5678 --flash-attn on --jinja -c 4096 -ngl all --fit on -np 1 -ctk q8_0 -ctv q8_0 --spec-type mtp --spec-draft-n-max 3 -m ~/LLM/models/unsloth/Qwen3.6/Qwen3.6-35B-A3B-MXFP4_MOE-2.gguf

Anyone has the same issue? Did i missed some flag?

slot update_slots: id  0 | task 0 | prompt processing done, n_tokens = 12, batch.n_tokens = 4
~llama_io_write_device: allocated 'MTL0' buffer 62.812 MiB
ggml_metal_synchronize: error: command buffer 1 failed with status 5
error: Insufficient Memory (00000008:kIOGPUCommandBufferCallbackErrorOutOfMemory)
ggml_metal_synchronize: error: command buffer 1 failed with status 5
error: Insufficient Memory (00000008:kIOGPUCommandBufferCallbackErrorOutOfMemory)
ggml_metal_synchronize: error: command buffer 1 failed with status 5
error: Insufficient Memory (00000008:kIOGPUCommandBufferCallbackErrorOutOfMemory)
ggml_metal_synchronize: error: command buffer 1 failed with status 5
error: Insufficient Memory (00000008:kIOGPUCommandBufferCallbackErrorOutOfMemory)
ggml_metal_synchronize: error: command buffer 1 failed with status 5
error: Insufficient Memory (00000008:kIOGPUCommandBufferCallbackErrorOutOfMemory)
ggml_metal_synchronize: error: command buffer 1 failed with status 5
error: Insufficient Memory (00000008:kIOGPUCommandBufferCallbackErrorOutOfMemory)
ggml_metal_synchronize: error: command buffer 1 failed with status 5
error: Insufficient Memory (00000008:kIOGPUCommandBufferCallbackErrorOutOfMemory)
ggml_metal_synchronize: error: command buffer 1 failed with status 5

Is MTP uses much more memory?

Same issue here: poor token per sec rate & same error messages. M1 Ultra w/ 64GB RAM, so memory is not the primary culprit here.

Tried the Qwen3.6 MTP GGUFs from the MTP branch's author and found they are working fine (although the performance increase seems to be more in the 20% range on Metal compared to 50+% with CUDA GGML backend.)

I guess there is an issue on Metal with Unsloth's GGUFs.

danielhanchen unpinned discussion

Sign up or log in to comment