Text Generation
Transformers
Safetensors
English
glm4_moe
glm
MOE
pruning
compression
conversational
Instructions to use cerebras/GLM-4.6-REAP-218B-A32B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use cerebras/GLM-4.6-REAP-218B-A32B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="cerebras/GLM-4.6-REAP-218B-A32B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("cerebras/GLM-4.6-REAP-218B-A32B") model = AutoModelForCausalLM.from_pretrained("cerebras/GLM-4.6-REAP-218B-A32B") 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]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use cerebras/GLM-4.6-REAP-218B-A32B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "cerebras/GLM-4.6-REAP-218B-A32B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "cerebras/GLM-4.6-REAP-218B-A32B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/cerebras/GLM-4.6-REAP-218B-A32B
- SGLang
How to use cerebras/GLM-4.6-REAP-218B-A32B with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "cerebras/GLM-4.6-REAP-218B-A32B" \ --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": "cerebras/GLM-4.6-REAP-218B-A32B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
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 "cerebras/GLM-4.6-REAP-218B-A32B" \ --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": "cerebras/GLM-4.6-REAP-218B-A32B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use cerebras/GLM-4.6-REAP-218B-A32B with Docker Model Runner:
docker model run hf.co/cerebras/GLM-4.6-REAP-218B-A32B
File size: 5,979 Bytes
589b4e0 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 | ---
language:
- en
library_name: transformers
tags:
- glm
- MOE
- pruning
- compression
license: mit
name: cerebras/GLM-4.6-REAP-218B-A32B-FP8
description: >
This model was obtained by uniformly pruning 40% of experts in GLM-4.6-FP8 using the REAP method.
readme: >
https://huggingface.co/cerebras/GLM-4.6-REAP-218B-A32B-FP8/main/README.md
license_link: https://huggingface.co/zai-org/GLM-4.6-FP8/blob/main/LICENSE
pipeline_tag: text-generation
base_model:
- zai-org/GLM-4.6-FP8
---
<p align="center">
<em>๐ณ <strong>REAP</strong>๐ณ the Experts: Why Pruning Prevails for One-Shot MoE Compression</em><br>
<img src="https://i.imgur.com/rmzG3gg.png" alt="REAP" width="75%">
</p>
# GLM-4.6-REAP-218B-A32B-FP8
## โจ Highlights
Introducing **GLM-4.6-REAP-218B-A32B-FP8**, a **memory-efficient compressed variant** of GLM-4.6-FP8 that maintains near-identical performance while being **40% lighter**.
**Note: this is a BF16 version for more accurate downstream low-bit quantization. An [FP8 version](https://huggingface.co/cerebras/GLM-4.6-REAP-218B-A32B-FP8) is also available on HF.**
This model was created using **REAP (Router-weighted Expert Activation Pruning)**, a novel expert pruning method that selectively removes redundant experts while preserving the router's independent control over remaining experts. Key features include:
- **Near-Lossless Performance**: Maintains almost identical accuracy on code generation, agentic coding, and function calling tasks compared to the full 355B model
- **40% Memory Reduction**: Compressed from 355B to 218B parameters, significantly lowering deployment costs and memory requirements
- **Preserved Capabilities**: Retains all core functionalities including code generation, agentic workflows, repository-scale understanding, and function calling
- **Drop-in Compatibility**: Works with vanilla vLLM - no source modifications or custom patches required
- **Optimized for Real-World Use**: Particularly effective for resource-constrained environments, local deployments, and academic research
---
## ๐ Model Overview
**GLM-4.6-REAP-218B-A32B-FP8** has the following specifications:
- **Base Model**: GLM-4.6-FP8
- **Compression Method**: REAP (Router-weighted Expert Activation Pruning)
- **Compression Ratio**: 40% expert pruning
- **Type**: Sparse Mixture-of-Experts (SMoE) Causal Language Model
- **Number of Parameters**: 218B total, 32B activated per token
- **Number of Layers**: 92
- **Number of Attention Heads (GQA)**: 96 for Q and 8 for KV
- **Number of Experts**: 96 (uniformly pruned from 160)
- **Number of Activated Experts**: 8 per token
- **Context Length**: 202,752 tokens
- **License**: MIT
---
## ๐ Evaluations
TBD for BF16 model. [Evalulation results available for the FP8 variant](https://huggingface.co/cerebras/GLM-4.6-REAP-218B-A32B-FP8#%F0%9F%93%8A-evaluations).
For more details on the evaluation setup, refer to the [REAP arXiv preprint](https://arxiv.org/abs/2510.13999).
---
## ๐ Deployment
You can deploy the model directly using the **latest vLLM** (v0.11.0), no source modifications or custom patches required.
```bash
vllm serve cerebras/GLM-4.6-REAP-218B-A32B-FP8 \
--tensor-parallel-size 8 \
--tool-call-parser glm45 \
--enable-auto-tool-choice \
--enable-expert-parallel
```
If you encounter insufficient memory when running this model, you might need to set a lower value for `--max-num-seqs` flag (e.g. set to 64).
## ๐งฉ Model Creation
This checkpoint was created by applying the **REAP (Router-weighted Expert Activation Pruning)** method uniformly across all Mixture-of-Experts (MoE) blocks of **GLM-4.6-FP8**, with a **40% pruning rate**.
### How REAP Works
REAP selects experts to prune based on a novel **saliency criterion** that considers both:
- **Router gate values**: How frequently and strongly the router activates each expert
- **Expert activation norms**: The magnitude of each expert's output contributions
This dual consideration ensures that experts contributing minimally to the layer's output are pruned, while preserving those that play critical roles in the model's computations.
### Key Advantages
- **One-Shot Compression**: No fine-tuning required after pruning - the model is immediately ready for deployment
- **Preserved Router Control**: Unlike expert merging methods, REAP maintains the router's independent, input-dependent control over remaining experts, avoiding "functional subspace collapse"
- **Generative Task Superiority**: REAP significantly outperforms expert merging approaches on generative benchmarks (code generation, creative writing, mathematical reasoning) while maintaining competitive performance on discriminative tasks
### Calibration
The model was calibrated using a diverse mixture of domain-specific datasets including:
- Code generation samples ([evol-codealpaca](https://huggingface.co/datasets/theblackcat102/evol-codealpaca-v1))
- Function calling examples ([xlam-function-calling](https://huggingface.co/datasets/Salesforce/xlam-function-calling-60k))
- Agentic multi-turn trajectories ([SWE-smith-trajectories](https://huggingface.co/datasets/SWE-bench/SWE-smith-trajectories))
๐ For more details, refer to the following resources:
- [๐งพ arXiv Preprint](https://arxiv.org/abs/2510.13999)
- [๐งพ REAP Blog](https://www.cerebras.ai/blog/reap)
- [๐ป REAP Codebase (GitHub)](https://github.com/CerebrasResearch/reap)
---
## โ๏ธ License
This model is derived from
**[`zai-org/GLM-4.6-FP8`](https://huggingface.co/zai-org/GLM-4.6-FP8)**
and distributed under the **MIT license**.
---
## ๐งพ Citation
If you use this checkpoint, please cite the REAP paper:
```bibtex
@article{lasby-reap,
title={REAP the Experts: Why Pruning Prevails for One-Shot MoE compression},
author={Lasby, Mike and Lazarevich, Ivan and Sinnadurai, Nish and Lie, Sean and Ioannou, Yani and Thangarasa, Vithursan},
journal={arXiv preprint arXiv:2510.13999},
year={2025}
}
``` |