Model Overview
- Model Architecture: Qwen3MoeForCausalLM
- Source Model: Qwen3-30B-A3B-Instruct-2507
- Supported Hardware: AMD EPYC (CPU inference)
- Preferred Operating System: Linux
- Inference Engine: vLLM v0.34.0
- Compression Framework: LLM Compressor v0.14.0
- Compression Method: REAP 50% expert pruning (weights remain BF16)
- Compatible Stack:
- ZenDNN (main)
- ZenTorch (main)
- PyTorch v2.14.0+cpu
- Transformers v5.20.2
- LLM Compressor v0.14.0
- vLLM v0.34.0
- Python 3.12.16
This is a pruned version of Qwen3-30B-A3B-Instruct-2507 created by AMD using LLM Compressor (compressed-tensors) for ZenDNN-optimized CPU inference.
Compression
The model was pruned from Qwen3-30B-A3B-Instruct-2507 using LLM Compressor via REAP (Router-weighted Expert Activation Pruning). This reduces the model weights from 56.9 GiB to 29.9 GiB on disk (~48% reduction).
- Method: REAP 50% expert pruning
- Config:
REAPPruningModifier, sparsity=0.50
- Sparsity: 50% of the experts in every MoE layer —
num_experts drops from 128 to 64 in each of the 48 decoder layers
- Precision: BF16 throughout — this is a structural pruning pass, not a quantization pass, so every tensor stays BF16 and the checkpoint carries no
quantization_config
- Pruned: the routed experts (
mlp.experts.*.{gate,up,down}_proj) and the matching router rows (mlp.gate.weight)
- Left intact:
self_attn.{q,k,v,o}_proj with their q/k norms, lm_head, embed_tokens, and the layer norms
- Calibration: 512 samples from the
perfectblend instruction mixture at a max sequence length of 2048
REAP scores each expert by how much it actually contributes to its layer's output, weighting the expert's activation magnitude by the router probability it receives, then drops the lowest-scoring half. The router's top-8 selection is unchanged and stays well inside the 64 experts that survive in each layer, with the router projection sliced down to match ([64, 2048]). Because the score depends on the router's real activations, the pass needs calibration data and moe_calibrate_all_experts=False so that each expert is only measured on the tokens actually routed to it.
Unlike the Gemma-4 and Qwen3.6 MoE checkpoints, Qwen3-30B-A3B stores one 2D tensor per expert (mlp.experts.N.{gate,up,down}_proj.weight) rather than fusing them into a 3D stack. Those are the same module names LLM Compressor addresses internally, so the pruning hooks attach directly and neither load_context() nor a repack step is needed. The result loads as a stock Qwen3-MoE checkpoint with num_experts set to 64.
from transformers import AutoModelForCausalLM, AutoTokenizer from llmcompressor import oneshotfrom llmcompressor.modifiers.pruning import REAPPruningModifier model_id = "Qwen/Qwen3-30B-A3B-Instruct-2507"output_dir = "./Qwen3-30B-A3B-Instruct-2507-REAP-50" # Step 1: Load the BF16 model. Qwen3 stores one 2D tensor per expert# (mlp.experts.N.{gate,up,down}_proj.weight), the same names llmcompressor uses# internally, so no load_context() and no repack step are needed.model = AutoModelForCausalLM.from_pretrained(model_id)tokenizer = AutoTokenizer.from_pretrained(model_id) # Step 2: REAP recipe. Drop 50% of the experts in every MoE layer (128 -> 64, 48 layers).# The router still selects top_k=8 per token, well inside the 64 that survive.recipe = REAPPruningModifier(sparsity=0.5) # Step 3: One-shot prune. 512 samples from the perfectblend dataset. All experts are not# force-calibrated, since REAP needs the router's real activations.oneshot( model=model, dataset="perfectblend", splits="train[:512]", recipe=recipe, max_seq_length=2048, num_calibration_samples=512, moe_calibrate_all_experts=False,) # Step 4: Save in compressed-tensors format.model.save_pretrained(output_dir, save_compressed=True)tokenizer.save_pretrained(output_dir)
Quick Start
Use with vLLM
from vllm import LLM, SamplingParams model = LLM( model="amd/Qwen3-30B-A3B-Instruct-2507-reap-50-llmcompressor", dtype="bfloat16",) sampling_params = SamplingParams(temperature=0.7, max_tokens=256)outputs = model.generate(["Hello, how are you?"], sampling_params)print(outputs[0].outputs[0].text)
Requirements
torch==2.14.0+cputransformers==5.20.2vllm==0.34.0llmcompressor==0.14.0zentorch # main
Built and validated on Python 3.12.16 with ZenDNN built from main.
OpenMP Setup
For optimal performance, set LD_PRELOAD with libomp.so (LLVM OpenMP) or libiomp5.so (Intel OpenMP):
# Using LLVM OpenMP (llvmopenmp)export LD_PRELOAD=$(find /path/to/env -name "libomp.so" | head -1) # Or using Intel OpenMP (libiomp)export LD_PRELOAD=$(find /path/to/env -name "libiomp5.so" | head -1)
Note: Set LD_PRELOAD before launching vLLM or any inference script.
Evaluation
The model was evaluated against the BF16 (unpruned) baseline on standard benchmarks using lm-evaluation-harness with the vLLM engine.
Table with columns: Benchmark, BF16 Baseline, REAP-50 (this model), Recovery| Benchmark | BF16 Baseline | REAP-50 (this model) | Recovery |
|---|
| GSM8K (5-shot) | 0.9575 | 0.9303 | 97.15% |
Evaluation Command
lm_eval \ --model vllm \ --model_args pretrained=amd/Qwen3-30B-A3B-Instruct-2507-reap-50-llmcompressor,dtype=bfloat16,max_model_len=4096 \ --tasks gsm8k \ --batch_size auto \ --trust_remote_code \ --num_fewshot 5 \ --apply_chat_template \ --log_samples \ --gen_kwargs "max_gen_toks=2048" \ --output_path .
Limitations
- Version Lock: This model is validated against ZenDNN
main / ZenTorch main / PyTorch v2.14.0+cpu / Transformers v5.20.2. It may not load correctly on other versions.
- CPU Only: This model is optimized for AMD EPYC CPU inference via ZenDNN. It is not intended for GPU inference.
- Accuracy Trade-off: Removing half of every layer's experts permanently removes capacity rather than approximating it, so the loss is not recoverable at inference time the way a quantization error partly is. On GSM8K this costs about 2.7 points (97.15% recovery).
- No Shared Expert: Every token in this architecture is served entirely by routed experts, with no always-on shared expert to fall back on, so the pruning is felt on every token rather than only on the routed portion of the layer.
- Calibration Bias: The experts that survive were chosen from 512 general instruction-following samples. Behavior on domains far from that distribution may degrade more than the GSM8K number suggests.
License
This model is distributed under the same license as the source model. See the LICENSE file for details.
Modifications copyright (c) 2026 Advanced Micro Devices, Inc. All rights reserved.