Local & Offline
~8 min readUpdated: December 2026

Qwen4-35B-A3B GGUF Local Quantization & llama.cpp Deployment Guide

Qwen4-35B-A3B GGUF Local Quantization and llama.cpp Deployment in Smoke Monkey

Unsloth Dynamic v3.1 GGUF quantizations shrink Qwen4-35B-A3B (35B MoE with 3B active parameters, 20B n-gram Engram embeddings, and 2B MTP head) from 105.06 GiB BF16 down to 21.79 GiB (UD-IQ2_XXS) or 33.75 GiB (UD-Q4_K_XL). Combined with SSD n-gram offloading and llama.cpp serving, teams can run native 1M-context multimodal coding agents on local workstations.

Technical Review: Smoke Monkey Core Architecture Team
Tested on Node.js 18+ & BunTypeScript 5.x
Quick Answer & Executive Definition

Qwen4-35B-A3B GGUF Local Quantization & llama.cpp Deployment Guide: Unsloth Dynamic v3.1 GGUF quantizations shrink Qwen4-35B-A3B (35B MoE with 3B active parameters, 20B n-gram Engram embeddings, and 2B MTP head) from 105.06 GiB BF16 down to 21.79 GiB (UD-IQ2_XXS) or 33.75 GiB (UD-Q4_K_XL). Combined with SSD n-gram offloading and llama.cpp serving, teams can run native 1M-context multimodal coding agents on local workstations. Designed as a zero-dependency, open-source TypeScript architecture under the MIT License with native Model Context Protocol (MCP) support and deterministic phase state machines.

Key Architectural Takeaways
Quick Implementation Exampleqwen4-gguf-local-agent.ts
qwen4-gguf-local-agent.tstypescript
import { createAgent } from '@smoke-monkey/harness';
// Connect Smoke Monkey Harness to local llama.cpp serving Unsloth Qwen4-35B-A3B GGUF
const agent = createAgent({
agentId: 'qwen4-gguf-local-coder',
provider: 'openai-compatible',
baseUrl: 'http://127.0.0.1:8080/v1',
model: 'unsloth/Qwen4-35B-A3B-GGUF:UD-Q4_K_XL',
workspacePath: process.cwd(),
permissions: {
read_file: 'allow',
write_file: 'allow',
run_command: 'ask',
},
});
async function main() {
const result = await agent.run(
'Audit src/ for unhandled Promise rejections, patch error boundaries, and run npm test.'
);
console.log('Qwen4 GGUF Agent Result:', result.summary);
}
main().catch(console.error);
Video Guides

Watch: Related Video Guides

Qwen3 27B on Llama.cpp — 67 to 120 Tokens/sec with MTP + Ngram

Qwen3.8-27B GGUF: Run It Local with llama.cpp, Ollama & LM Studio

What Is Unsloth Dynamic v3.1 GGUF Quantization for Qwen4-35B-A3B?

Unsloth Qwen4-35B-A3B GGUF is a suite of mixed-precision GGUF quantizations for Alibaba's 56B-parameter (35B MoE with 3B active, 20B n-gram embedding, and 2B MTP) multimodal model. Unlike uniform 4-bit rounding, Dynamic v3.1 keeps sensitive Gated DeltaNet projections, attention router gates, and vision encoder weights (mmproj-BF16.gguf) at higher bit-widths.

Because Qwen4-35B-A3B allocates 20B parameters to a 10,000,000-entry bigram/trigram Engram table at layer 2 alongside 256 MoE experts (expert intermediate dimension 512), naively quantizing all tensors degrades tool-calling XML formatting (<tool_call><function=...>) and long-horizon reasoning. Selecting the exact GGUF shard tier lets developers match available VRAM, system RAM, and NVMe SSD bandwidth:

Quantization VariantShardsTotal Disk SizePrimary Hardware TargetKey Trade-off
BF16 (Reference)3 shards105.06 GiBMulti-GPU 128 GB+ VRAMLossless baseline weights
Q8_02 shards55.87 GiB64 GB Mac Unified / Dual 32 GB GPUNear-lossless perplexity and tool syntax
UD-Q4_K_XL2 shards33.75 GiB48 GB VRAM or 48–64 GB Unified RAMDynamic mixed-bit protection on gates/attn
UD-Q4_K_M2 shards32.77 GiB40–48 GB VRAM / Apple SiliconBalanced speed and reasoning fidelity
UD-IQ4_XS2 shards29.84 GiB32–40 GB VRAM + RAM hybridCompact non-linear 4-bit quantization
UD-Q3_K_XL2 shards28.76 GiB32 GB GPU or 18 GB RAM + SSD EngramRuns with SSD n-gram offload
UD-Q2_K_XL2 shards25.78 GiB24 GB GPU + CPU offloadPreserves critical layers at higher precision
UD-IQ2_XXS2 shards21.79 GiBTight 24 GB single-GPU footprintMinimum footprint dynamic quant
MTP Head (Q8_0)1 shard1.87 GiBOptional add-on for all quantsEnables multi-step speculative token draft

Serving Qwen4-35B-A3B GGUF Locally with llama.cpp and Thinking Control

In production agent harnesses, Qwen4's chat template exposes two key runtime controls: reasoning_effort (xhigh, high, low, off) and preserve_thinking (default true). Unsloth recommends temperature=1.0, top_p=0.95, top_k=20 for thinking mode and temperature=0.7, top_p=0.80, presence_penalty=1.5 for non-thinking mode.

To avoid excessive retries on multi-turn tool calls, keep reasoning_effort="high" for code refactoring loops and run llama serve directly against the Hugging Face repo:

bash
# 1. Install llama.cpp (macOS / Linux) and launch Qwen4-35B-A3B Dynamic 4-bit server
brew install llama.cpp
llama serve -hf unsloth/Qwen4-35B-A3B-GGUF:UD-Q4_K_M --port 8080

# 2. Verify tool-capable chat completion with reasoning_effort=high
curl -s http://127.0.0.1:8080/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "unsloth/Qwen4-35B-A3B-GGUF:UD-Q4_K_M",
    "messages": [{"role": "user", "content": "Return a TypeScript binary search with strict types."}],
    "temperature": 1.0,
    "top_p": 0.95,
    "top_k": 20
  }'

Beware Lowering Reasoning Effort on Multi-Turn Agents

Per the Qwen4 model card, setting reasoning_effort to low or off can increase total task latency on agentic loops because shallow single-turn planning causes tool syntax errors and repeated retries.

Google Search Questions & Answers

Frequently Asked Questions

Q:How large is Qwen4-35B-A3B GGUF across different quantization levels?

On Hugging Face, unsloth/Qwen4-35B-A3B-GGUF spans from 105.06 GiB (BF16) and 55.87 GiB (Q8_0) down to 33.75 GiB (UD-Q4_K_XL), 32.77 GiB (UD-Q4_K_M), 28.76 GiB (UD-Q3_K_XL), and 21.79 GiB (UD-IQ2_XXS), plus a 1.87 GiB Q8_0 MTP shard.

Q:Can Qwen4-35B-A3B GGUF run on 18 GB RAM machines?

Yes. Because Qwen4 stores 20B parameters in a layer-2 n-gram Engram table, Unsloth Desktop can offload the Engram table to NVMe SSD, allowing 3-bit Dynamic GGUFs to run on 18 GB RAM systems.

Q:What attention and MoE layout does Qwen4-35B-A3B use?

It uses 40 layers arranged as 10 blocks of three Gated DeltaNet linear-attention MoE layers followed by one Qwen Sparse Attention MoE layer, activating 8 routed plus 1 shared expert out of 256 total experts.

Q:What sampling parameters prevent loops in Qwen4-35B-A3B GGUF?

Use temperature=1.0, top_p=0.95, top_k=20, and presence_penalty=0.0 in thinking mode, or temperature=0.7, top_p=0.80, top_k=20, and presence_penalty=1.5 in non-thinking mode.

Related Alternatives & Comparisons

Related Architecture Guides

View all guides

Build with Smoke Monkey Harness

Zero dependencies. 24 built-in tools. Human-in-the-loop safety. 100% open source under the MIT License.

npm install smoke-monkey-harness