REAP the Experts: Why Pruning Prevails for One-Shot MoE compression
Paper • 2510.13999 • Published • 20
How to use mattbucci/Qwen3-Coder-30B-A3B-REAP-AWQ with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="mattbucci/Qwen3-Coder-30B-A3B-REAP-AWQ")
messages = [
{"role": "user", "content": "Who are you?"},
]
pipe(messages) # Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("mattbucci/Qwen3-Coder-30B-A3B-REAP-AWQ")
model = AutoModelForCausalLM.from_pretrained("mattbucci/Qwen3-Coder-30B-A3B-REAP-AWQ", device_map="auto")
messages = [
{"role": "user", "content": "Who are you?"},
]
inputs = tokenizer.apply_chat_template(
messages,
add_generation_prompt=True,
tokenize=True,
return_dict=True,
return_tensors="pt",
).to(model.device)
outputs = model.generate(**inputs, max_new_tokens=40)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:]))How to use mattbucci/Qwen3-Coder-30B-A3B-REAP-AWQ with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "mattbucci/Qwen3-Coder-30B-A3B-REAP-AWQ"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "mattbucci/Qwen3-Coder-30B-A3B-REAP-AWQ",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/mattbucci/Qwen3-Coder-30B-A3B-REAP-AWQ
How to use mattbucci/Qwen3-Coder-30B-A3B-REAP-AWQ with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "mattbucci/Qwen3-Coder-30B-A3B-REAP-AWQ" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "mattbucci/Qwen3-Coder-30B-A3B-REAP-AWQ",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker run --gpus all \
--shm-size 32g \
-p 30000:30000 \
-v ~/.cache/huggingface:/root/.cache/huggingface \
--env "HF_TOKEN=<secret>" \
--ipc=host \
lmsysorg/sglang:latest \
python3 -m sglang.launch_server \
--model-path "mattbucci/Qwen3-Coder-30B-A3B-REAP-AWQ" \
--host 0.0.0.0 \
--port 30000
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:30000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "mattbucci/Qwen3-Coder-30B-A3B-REAP-AWQ",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use mattbucci/Qwen3-Coder-30B-A3B-REAP-AWQ with Docker Model Runner:
docker model run hf.co/mattbucci/Qwen3-Coder-30B-A3B-REAP-AWQ
In-house REAP-pruned and AWQ-quantized variant of Qwen/Qwen3-Coder-30B-A3B-Instruct, built end-to-end from the upstream BF16 base.
S_{L,E} = Σ_t (gate_t_E × ||down_proj_E(x_t)||₂) accumulated over 1024 code-mix calibration samples; top-96 experts per layer kept.moe_calibrate_all_experts=True so every expert sees every token (eliminates the rare-routed-expert zero-scale failure mode).ignore list); only the per-expert Linears are INT4-packed.| Field | Value |
|---|---|
| Class | Qwen3MoeForCausalLM |
| Hidden layers | 48 |
| Experts | 96 per layer (pruned from 128) |
| Active experts per token | 8 |
| Hidden size | 2048 |
| Quant format | AWQ 4-bit, group_size=128 |
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained(
"mattbucci/Qwen3-Coder-30B-A3B-REAP-AWQ",
torch_dtype="bfloat16",
device_map="auto",
)
tok = AutoTokenizer.from_pretrained("mattbucci/Qwen3-Coder-30B-A3B-REAP-AWQ")
messages = [{"role": "user", "content": "Write a Python function that returns the nth Fibonacci number using memoization."}]
text = tok.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tok(text, return_tensors="pt").to(model.device)
out = model.generate(**inputs, max_new_tokens=300, temperature=0.1)
print(tok.decode(out[0][inputs.input_ids.shape[1]:], skip_special_tokens=True))
The model uses Qwen3-Coder's tool-call XML format (<function=NAME>...):
python -m sglang.launch_server \
--model-path mattbucci/Qwen3-Coder-30B-A3B-REAP-AWQ \
--quantization moe_wna16 \
--dtype bfloat16 \
--tool-call-parser qwen3_coder \
--tensor-parallel-size 2 \
--context-length 32768 \
--disable-cuda-graph
finish_reason: stop.moe_calibrate_all_experts=True which forces every token through every kept expert during the Hessian collection phase, removing the rare-routed-expert blind spot that caused zero-scale failures in earlier MoE AWQ ships.Apache 2.0, inherited from Qwen/Qwen3-Coder-30B-A3B-Instruct.
Base model
Qwen/Qwen3-Coder-30B-A3B-Instruct