Skip to content

Eval bug: Metal fails mixed quantized KV on Apple Silicon when Flash Attention is unavailable, while q4_0/q4_0 and f16/f16 work #21450

Description

@bostdiek

Name and Version

/opt/homebrew/bin/llama-server
version: 8660 (d00685831)
built with AppleClang 17.0.0.17000604 for Darwin arm64

Installed from Homebrew ggml 0.9.11.

Operating systems

Mac

GGML backends

Metal

Hardware

Apple M1 Pro with 32 GB unified memory

Models

  • unsloth/gpt-oss-20b-GGUF:F16
  • unsloth/Qwen3-Coder-30B-A3B-Instruct-GGUF:Q4_K_XL
  • LiquidAI/LFM2.5-1.2B-Instruct-GGUF:Q4_K_M
  • LiquidAI/LFM2.5-VL-1.6B-GGUF:Q4_0

Problem description and steps to reproduce

I am seeing a reproducible Metal backend failure pattern with quantized V cache.

Observed behavior:

  • q4_0/q4_0 KV works
  • f16/f16 KV works
  • q8_0/q4_0 fails
  • the failure is reproducible even when context is reduced
  • this does not appear to be simple memory exhaustion, because the same model and large context work with f16/f16 KV

The failure appears tied to Flash Attention availability on Metal. When the failing configuration is used, startup or request handling reports that quantized V cache requires Flash Attention.

Reproduction 1

Model:
gpt-oss-20b

Known working configuration:

llama-server \
  -m /path/to/model.gguf \
  --ctx-size 131072 \
  --cache-type-k q4_0 \
  --cache-type-v q4_0 \
  --flash-attn on

This loads and serves requests.

Also working:

llama-server \
  -m /path/to/model.gguf \
  --ctx-size 131072 \
  --cache-type-k f16 \
  --cache-type-v f16 \
  --flash-attn on

This also loads and serves requests.

Failing configuration:

llama-server \
  -m /path/to/model.gguf \
  --ctx-size 32768 \
  --cache-type-k q8_0 \
  --cache-type-v q4_0 \
  --flash-attn on

This fails with the quantized V cache / Flash Attention error.

The same mixed configuration also failed for me at larger contexts.

Reproduction 2

Model:
Qwen3-Coder-30B-A3B-Instruct

Working configuration:

llama-server \
  -m /path/to/model.gguf \
  --ctx-size 32768 \
  --cache-type-k q4_0 \
  --cache-type-v q4_0 \
  --flash-attn on

This loads and serves requests.

Failing configuration:

llama-server \
  -m /path/to/model.gguf \
  --ctx-size 32768 \
  --cache-type-k q8_0 \
  --cache-type-v q4_0 \
  --flash-attn on

This fails with the same quantized V cache / Flash Attention error.

Reproduction 3

Models:

  • LFM2.5-1.2B-Instruct
  • LFM2.5-VL-1.6B

For both models:

  • mixed q8_0/q4_0 KV failed
  • the failure message was the same quantized V cache / Flash Attention requirement
  • reverting to the prior working KV layout resolved the issue

Relevant log output

For the failing mixed KV path, I consistently hit:

quantized V cache was requested, but this requires Flash Attention

In one larger gpt-oss-20b run, Flash Attention dropped out during reserve and the process then attempted a very large Metal allocation before crashing.

Expected behavior

If q8_0/q4_0 is unsupported on this Metal path, I would expect a clear early rejection without partial initialization or crash behavior.

If it is intended to work, then I would expect it to behave consistently with the working q4_0/q4_0 and f16/f16 cases.

Actual behavior

On Apple Silicon / Metal:

  • q4_0/q4_0 works
  • f16/f16 works
  • q8_0/q4_0 fails
  • failure is reproducible across multiple models
  • reducing context did not make the mixed q8_0/q4_0 configuration work in my tests

Why this seems backend-specific rather than memory-only

For gpt-oss-20b, f16/f16 KV worked at the same 131072 context where q8_0/q4_0 failed. That suggests the main issue is backend support or Flash Attention path selection, not just available memory.

Possibly related

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions