Instructions to use unsloth/GLM-4.7-Flash-REAP-23B-A3B-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use unsloth/GLM-4.7-Flash-REAP-23B-A3B-GGUF with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="unsloth/GLM-4.7-Flash-REAP-23B-A3B-GGUF") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("unsloth/GLM-4.7-Flash-REAP-23B-A3B-GGUF", dtype="auto") - llama-cpp-python
How to use unsloth/GLM-4.7-Flash-REAP-23B-A3B-GGUF with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="unsloth/GLM-4.7-Flash-REAP-23B-A3B-GGUF", filename="GLM-4.7-Flash-REAP-23B-A3B-BF16.gguf", )
llm.create_chat_completion( messages = [ { "role": "user", "content": "What is the capital of France?" } ] ) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- llama.cpp
How to use unsloth/GLM-4.7-Flash-REAP-23B-A3B-GGUF with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf unsloth/GLM-4.7-Flash-REAP-23B-A3B-GGUF:UD-Q4_K_XL # Run inference directly in the terminal: llama-cli -hf unsloth/GLM-4.7-Flash-REAP-23B-A3B-GGUF:UD-Q4_K_XL
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf unsloth/GLM-4.7-Flash-REAP-23B-A3B-GGUF:UD-Q4_K_XL # Run inference directly in the terminal: llama-cli -hf unsloth/GLM-4.7-Flash-REAP-23B-A3B-GGUF:UD-Q4_K_XL
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf unsloth/GLM-4.7-Flash-REAP-23B-A3B-GGUF:UD-Q4_K_XL # Run inference directly in the terminal: ./llama-cli -hf unsloth/GLM-4.7-Flash-REAP-23B-A3B-GGUF:UD-Q4_K_XL
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf unsloth/GLM-4.7-Flash-REAP-23B-A3B-GGUF:UD-Q4_K_XL # Run inference directly in the terminal: ./build/bin/llama-cli -hf unsloth/GLM-4.7-Flash-REAP-23B-A3B-GGUF:UD-Q4_K_XL
Use Docker
docker model run hf.co/unsloth/GLM-4.7-Flash-REAP-23B-A3B-GGUF:UD-Q4_K_XL
- LM Studio
- Jan
- vLLM
How to use unsloth/GLM-4.7-Flash-REAP-23B-A3B-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "unsloth/GLM-4.7-Flash-REAP-23B-A3B-GGUF" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "unsloth/GLM-4.7-Flash-REAP-23B-A3B-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/unsloth/GLM-4.7-Flash-REAP-23B-A3B-GGUF:UD-Q4_K_XL
- SGLang
How to use unsloth/GLM-4.7-Flash-REAP-23B-A3B-GGUF 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 "unsloth/GLM-4.7-Flash-REAP-23B-A3B-GGUF" \ --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": "unsloth/GLM-4.7-Flash-REAP-23B-A3B-GGUF", "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 "unsloth/GLM-4.7-Flash-REAP-23B-A3B-GGUF" \ --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": "unsloth/GLM-4.7-Flash-REAP-23B-A3B-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Ollama
How to use unsloth/GLM-4.7-Flash-REAP-23B-A3B-GGUF with Ollama:
ollama run hf.co/unsloth/GLM-4.7-Flash-REAP-23B-A3B-GGUF:UD-Q4_K_XL
- Unsloth Studio new
How to use unsloth/GLM-4.7-Flash-REAP-23B-A3B-GGUF with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for unsloth/GLM-4.7-Flash-REAP-23B-A3B-GGUF to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for unsloth/GLM-4.7-Flash-REAP-23B-A3B-GGUF to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for unsloth/GLM-4.7-Flash-REAP-23B-A3B-GGUF to start chatting
- Pi new
How to use unsloth/GLM-4.7-Flash-REAP-23B-A3B-GGUF with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf unsloth/GLM-4.7-Flash-REAP-23B-A3B-GGUF:UD-Q4_K_XL
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "llama-cpp": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "unsloth/GLM-4.7-Flash-REAP-23B-A3B-GGUF:UD-Q4_K_XL" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use unsloth/GLM-4.7-Flash-REAP-23B-A3B-GGUF with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama-server -hf unsloth/GLM-4.7-Flash-REAP-23B-A3B-GGUF:UD-Q4_K_XL
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:8080/v1 hermes config set model.default unsloth/GLM-4.7-Flash-REAP-23B-A3B-GGUF:UD-Q4_K_XL
Run Hermes
hermes
- Docker Model Runner
How to use unsloth/GLM-4.7-Flash-REAP-23B-A3B-GGUF with Docker Model Runner:
docker model run hf.co/unsloth/GLM-4.7-Flash-REAP-23B-A3B-GGUF:UD-Q4_K_XL
- Lemonade
How to use unsloth/GLM-4.7-Flash-REAP-23B-A3B-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull unsloth/GLM-4.7-Flash-REAP-23B-A3B-GGUF:UD-Q4_K_XL
Run and chat with the model
lemonade run user.GLM-4.7-Flash-REAP-23B-A3B-GGUF-UD-Q4_K_XL
List all available models
lemonade list
Includes Unsloth chat template fixes!
Forllama.cpp, use--jinja
Unsloth Dynamic 2.0 achieves superior accuracy & outperforms other leading quants.
๐ณ REAP๐ณ the Experts: Why Pruning Prevails for One-Shot MoE Compression
GLM-4.7-Flash-REAP-23B-A3B
โจ Highlights
Introducing GLM-4.7-Flash-REAP-23B-A3B, a memory-efficient compressed variant of GLM-4.7-Flash that maintains near-identical performance while being 25% lighter.
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 30B model
- 25% Memory Reduction: Compressed from 30B to 23B 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.7-Flash-REAP-23B-A3B has the following specifications:
- Base Model: GLM-4.7-Flash
- Compression Method: REAP (Router-weighted Expert Activation Pruning)
- Compression Ratio: 25% expert pruning
- Type: Sparse Mixture-of-Experts (SMoE) Causal Language Model
- Number of Parameters: 23B total, 3B activated per token
- Number of Layers: 47
- Number of Attention Heads: 20 for QKV
- Number of Experts: 48 (uniformly pruned from 64)
- Number of Activated Experts: 4 per token
- Context Length: 202,752 tokens
- License: MIT
๐ Evaluations
| Benchmark | GLM-4.7-Flash | GLM-4.7-Flash-REAP-23B-A3B | ||
|---|---|---|---|---|
| Compression | โ | 25% | ||
| Coding | ||||
| HumanEval | 94.5 | 95.1 | ||
| HumanEval+ | 89.0 | 89.0 | ||
๐ฉ This checkpoint maintains almost identical performance while being 25% lighter.
For more details on the evaluation setup, refer to the REAP arXiv preprint.
๐ Deployment
You can deploy the model directly using the latest vLLM (that supports GLM4.7-Flash), no source modifications or custom patches required.
vllm serve cerebras/GLM-4.7-Flash-REAP-23B-A3B \
--tensor-parallel-size 4 \
--reasoning-parser glm45 \
--tool-call-parser glm47 \
--enable-auto-tool-choice
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.7, with a 25% 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)
- Function calling examples (xlam-function-calling)
- Agentic multi-turn trajectories (SWE-smith-trajectories)
๐ For more details, refer to the following resources:
โ๏ธ License
This model is derived from
zai-org/GLM-4.7-Flash
and distributed under the MIT license.
๐งพ Citation
If you use this checkpoint, please cite the REAP paper:
@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}
}
- Downloads last month
- 19,421
1-bit
2-bit
3-bit
4-bit
5-bit
6-bit
8-bit
16-bit
Model tree for unsloth/GLM-4.7-Flash-REAP-23B-A3B-GGUF
Base model
zai-org/GLM-4.7-Flash