Instructions to use AGofficial/Qwen4-9b-Preview with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use AGofficial/Qwen4-9b-Preview with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf AGofficial/Qwen4-9b-Preview # Run inference directly in the terminal: llama cli -hf AGofficial/Qwen4-9b-Preview
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf AGofficial/Qwen4-9b-Preview # Run inference directly in the terminal: llama cli -hf AGofficial/Qwen4-9b-Preview
Build from source code
git clone https://github.com/ggml-org/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-app # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama serve -hf AGofficial/Qwen4-9b-Preview # Run inference directly in the terminal: ./build/bin/llama cli -hf AGofficial/Qwen4-9b-Preview
Use Docker
docker model run hf.co/AGofficial/Qwen4-9b-Preview
- Llama new
- LM Studio
- Jan
- vLLM
How to use AGofficial/Qwen4-9b-Preview with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "AGofficial/Qwen4-9b-Preview" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "AGofficial/Qwen4-9b-Preview", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/AGofficial/Qwen4-9b-Preview
- Ollama
How to use AGofficial/Qwen4-9b-Preview with Ollama:
ollama run hf.co/AGofficial/Qwen4-9b-Preview
- Unsloth Desktop
- Pi
How to use AGofficial/Qwen4-9b-Preview with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf AGofficial/Qwen4-9b-Preview
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:9931/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "AGofficial/Qwen4-9b-Preview" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use AGofficial/Qwen4-9b-Preview with Docker Model Runner:
docker model run hf.co/AGofficial/Qwen4-9b-Preview
- Lemonade
How to use AGofficial/Qwen4-9b-Preview with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull AGofficial/Qwen4-9b-Preview
Run and chat with the model
lemonade run user.Qwen4-9b-Preview-{{QUANT_TAG}}List all available models
lemonade list
- Hermes Agent
How to use AGofficial/Qwen4-9b-Preview with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf AGofficial/Qwen4-9b-Preview
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:9931/v1 hermes config set model.default AGofficial/Qwen4-9b-Preview
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use AGofficial/Qwen4-9b-Preview with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf AGofficial/Qwen4-9b-Preview
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:9931/v1 \ --custom-model-id "AGofficial/Qwen4-9b-Preview" \ --custom-provider-id llama-cpp \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
Qwen4-9B-Preview
Qwen4-9B-Preview is an experimental, standalone 9B-parameter (8.9998B stored parameters, 3.27 GB GGUF) model created via zero-training weight surgery directly from Qwen/Qwen4-35B-A3B (retrieved December 3, 2026).
No gradient updates, no backpropagation, no distillation training, and no fine-tuning were used. Every retained weight tensor in this checkpoint is copied byte-for-byte from the released Qwen4-35B-A3B weights, reassembled into a compact standalone architecture that runs natively on consumer CPUs and edge hardware via llama.cpp.
Preview Notice: This is an early preview checkpoint released while full-family scaling (
9B,4B,2B,1B,0.5B) and expanded benchmarks are actively being completed.
Why This Matters
- Democratizing Frontier AI on Edge Hardware: Brings Qwen4's hybrid Gated DeltaNet + Qwen Sparse Attention +
<think>reasoning capabilities down to a 3.27 GB standalone file that runs smoothly on standard laptops and CPUs. - Native Speculative Decoding Draft Model: Shares the exact Qwen4 tokenizer, 40-layer residual stream, and representation geometry with
Qwen4-35B-A3B, making it a natural draft model to accelerateQwen4-35B-A3Binference via speculative decoding. - Zero-Training Neural Weight Transfer: Demonstrates that coherent English chat, factual recall, Python comprehension, and multi-step
<think>chain-of-thought reasoning can be transplanted from a 35B MoE + 20.5B PLE model into a 9B footprint purely through mathematical routing analysis and structural tensor surgery.
How It Was Built (Zero-Training Weight Surgery)
Using frontier models to guide structural analysis and tensor surgery on Qwen/Qwen4-35B-A3B:
- Full 40-Layer Depth Preservation: Skipping decoder layers breaks Qwen4's 4-branch hyper-connection residual stream. Keeping all 40 decoder layers (
d_model = 2048), all attention/DeltaNet blocks, hyper-connections, shared experts, embeddings, and LM head preserves coherent language and reasoning. - All-Position Teacher Routing Calibration: We ran read-only teacher forward passes over a diverse English chat, reasoning, math, fact, and code calibration corpus (recording router probabilities at every token position across all 40 layers, including layer 39) and retained the top 48 routed experts per layer (out of 256, keeping intact width-512
gate/up/downslices and matching router rows). - Frequency-Guided Compact PLE Reconstruction: Qwen4's 20.5B-parameter Per-Layer N-gram Embedding (PLE) table was compacted to 151.7M parameters (~74k hash slots/head) by reproducing Qwen4's native 64-bit bigram/trigram hash over 2.5M English WikiText-2 tokens and copying the highest-frequency trained
IQ4_NLrows byte-for-byte. On our diagnostic checks, this 151.7M table matched the full 20.5B teacher PLE upper bound.
Architecture Overview
| Specification | Qwen4-35B-A3B (Source) | Qwen4-9B-Preview |
|---|---|---|
| Stored Parameters | 35B + 20.5B PLE + 2B MTP | 8,999,835,008 (~9.0B) |
| File Size (GGUF) | ~21.3 GB (2 shards, UD-IQ1_S) | 3.27 GB (1 standalone file) |
| Decoder Layers | 40 (3ร Gated DeltaNet + 1ร QSA) | 40 (all preserved) |
| Hidden Dimension | 2048 (4-branch Hyper-Connections) | 2048 (all preserved) |
| Routed Experts / Layer | 256 (8 active + 1 shared) | 48 (8 active + 1 shared) |
| Expert Intermediate Width | 512 | 512 (byte-exact) |
| Compact PLE Table | 20.5B params | 151.7M params (WikiText-2 populated) |
| Native Context Length | 1,048,576 | 1,048,576 |
| Training / Fine-Tuning | Pre-trained + Post-trained | None (0 gradient steps) |
Quickstart (llama.cpp)
Requires a llama.cpp build with qwen4exp support (b12973+):
# Interactive web chat UI (Llama Chat) + OpenAI-compatible API
llama-server -m Qwen4-9B-Preview.gguf --host 127.0.0.1 --port 8080 -c 4096 --jinja
# CLI inference
llama-cli -m Qwen4-9B-Preview.gguf -c 4096 --jinja
Recommended Sampling Parameters (inherited from Qwen4)
- Thinking Mode (
<think>):temperature=1.0,top_p=0.95,top_k=20,presence_penalty=0.0 - Non-Thinking Mode:
temperature=0.7,top_p=0.80,top_k=20,presence_penalty=1.5
Early Smoke-Test Observations
Compared to a 9B random-weight control and a 12-layer depth-pruned 9B transfer (both completely garbled), Qwen4-9B-Preview recovers:
- Fluent English chat and instruction following
- Exact factual recall (e.g., chemical symbol for gold โ
Au, oxygen โO) - Multi-step
<think>arithmetic and transitive logic reasoning (e.g.,12 + 9 - 4 = 17,7 ร 6 = 42, transitive race/age ordering) - Basic Python evaluation (
len([3, 3, 5]) โ 3)
Limitations: As a zero-training preview keeping 48/256 experts per layer, occasional token glitches, formatting artifacts, or factual misses occur compared to the full 35B teacher.
License & Attribution
- License: Apache 2.0 (matching the upstream source model).
- Source Model: Built directly from Qwen/Qwen4-35B-A3B by the Qwen Team (Alibaba Group), retrieved December 3, 2026.
@misc{qwen4-35ba3b,
title = {{Qwen4-35B-A3B}},
author = {{Qwen Team}},
month = {December},
year = {2026},
url = {https://huggingface.co/Qwen/Qwen4-35B-A3B}
}
- Downloads last month
- -
We're not able to determine the quantization variants.
Model tree for AGofficial/Qwen4-9b-Preview
Base model
Qwen/Qwen4-35B-A3B