98 20 hours ago

Mixed-precision quant of Qwen4-35B-A3B: 8-bit attention, 4-bit experts.

vision tools thinking
ollama run MobiusDevelopment/Qwen4-35B-A3B-A8E4-128K

Details

20 hours ago

47eda30f2f1d · 44GB

qwen4exp
·
56.4B
·
Q8_0
clip
·
447M
·
Q8_0
Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR US
{ "min_p": 0, "num_batch": 512, "num_ctx": 131072, "num_gpu": 999, "temperature"

Readme

Qwen4-35B-A3B A8E4 (128K)

Mixed-precision quant of Qwen/Qwen4-35B-A3B: 8-bit attention, 4-bit experts. Tuned to run entirely on a single 24 GB GPU with a 128K context. Includes vision.

Why A8E4

Attention runs on every token, so its quantization error adds up. Each expert only sees a few tokens, so experts tolerate 4-bit well (see MoQE). A8E4 keeps attention, the linear-attention (SSM) layers, hyper-connections, shared experts and embeddings at Q80, and quantizes only the routed experts (ffn{gate,up,down}_exps, 256 experts, 8 active) to Q4_K.

The file is 40.5 GiB, but 20.3 GiB of that is Qwen4’s per-layer n-gram embedding table (per_layer_token_embd). It is a lookup table: each token reads only a few rows, so it stays in system RAM and costs no VRAM. The part on the GPU is about 20 GiB.

vs Q8_0, code corpus A8E4 Q4_K_M
Mean KL divergence 0.024 0.181
99th-percentile KL divergence 0.53 3.86
Perplexity change +1.8% +9.5%
Same top token 97.4% 93.2%

The file is larger than a standard Q4_K_M (40.5 vs 33.6 GiB), but mean KL divergence is about 7x lower.

Measured speed

RTX 3090 Ti 24 GB, Ollama 0.40.21, flash attention on, q8_0 KV cache, 128K context:

  • Generation: ~115 tok/s (60 tok/s at 125K depth)
  • Prompt processing: ~3,900 tok/s (8K-token prompt), 2,300 tok/s for a 125K-token prompt
  • VRAM: 23.9 GB with the vision projector, 100% GPU
  • Full-context recall: a 124,974-token prompt with codes at the start and end; both found

Requirements

  • 24 GB of VRAM. The model sets num_gpu 999 and num_ctx 131072 so it always loads fully on the GPU. On smaller cards it may fail to load: lower num_ctx or remove num_gpu.
  • About 21 GB of free system RAM for the per-layer embedding table.
  • Keep Ollama’s model folder on an SSD. The embedding table is read from the model file a few rows per token; from a hard drive, generation fell to 20 to 65 tok/s.
  • Ollama 0.40.21 or newer (qwen4exp architecture).
  • Close other GPU-heavy programs. If VRAM spills into shared memory, generation drops below 50 tok/s.
  • For the VRAM figure above, set these on the Ollama server:
OLLAMA_FLASH_ATTENTION=1
OLLAMA_KV_CACHE_TYPE=q8_0

Usage

ollama run MobiusDevelopment/Qwen4-35B-A3B-A8E4-128K

OpenAI-compatible endpoint: http://localhost:11434/v1, model MobiusDevelopment/Qwen4-35B-A3B-A8E4-128K.

Default sampling: temperature 0.6, top_p 0.95, top_k 20, min_p 0.

Tools: function calling works through Ollama’s qwen4 renderer and parser.

Thinking: the reasoning is returned separately from the answer, in the thinking field on /api/chat (streaming or not) and in the reasoning field on /v1/chat/completions.

Notes

  • Requantized from unsloth/Qwen4-35B-A3B-GGUF Q8_0 with llama-quantize (llama.cpp b12992) –tensor-type, no imatrix.
  • KL divergence and perplexity were measured against Q8_0 on ~12.8K tokens of C++ and Python source (25 chunks of 512). Q4_K_M was made from the same Q8_0 with llama-quantize.
  • num_batch is 512, not the usual 2048. At 2048 the compute buffer fills a 24 GB card and generation drops sharply.
  • Without the vision projector, 192K context also fits, with about 1 GB of VRAM left. 256K does not fit on 24 GB.
  • Vision uses the Q8_0 projector from ggml-org/Qwen4-35B-A3B-GGUF (586 MB, vs 858 MB for F16). It leaves about 700 MB of VRAM free at 128K, so close other GPU programs.
  • The single MTP (nextn) layer is kept. Speculative decoding with it was not tested.

License

Apache 2.0, inherited from Qwen4-35B-A3B.