Instructions to use 0xSero/GLM-5.2-REAP-504B-GGUF 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 0xSero/GLM-5.2-REAP-504B-GGUF 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 0xSero/GLM-5.2-REAP-504B-GGUF:Q4_K_XL # Run inference directly in the terminal: llama cli -hf 0xSero/GLM-5.2-REAP-504B-GGUF:Q4_K_XL
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf 0xSero/GLM-5.2-REAP-504B-GGUF:Q4_K_XL # Run inference directly in the terminal: llama cli -hf 0xSero/GLM-5.2-REAP-504B-GGUF: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 0xSero/GLM-5.2-REAP-504B-GGUF:Q4_K_XL # Run inference directly in the terminal: ./llama-cli -hf 0xSero/GLM-5.2-REAP-504B-GGUF: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 0xSero/GLM-5.2-REAP-504B-GGUF:Q4_K_XL # Run inference directly in the terminal: ./build/bin/llama-cli -hf 0xSero/GLM-5.2-REAP-504B-GGUF:Q4_K_XL
Use Docker
docker model run hf.co/0xSero/GLM-5.2-REAP-504B-GGUF:Q4_K_XL
- LM Studio
- Jan
- vLLM
How to use 0xSero/GLM-5.2-REAP-504B-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "0xSero/GLM-5.2-REAP-504B-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": "0xSero/GLM-5.2-REAP-504B-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/0xSero/GLM-5.2-REAP-504B-GGUF:Q4_K_XL
- Ollama
How to use 0xSero/GLM-5.2-REAP-504B-GGUF with Ollama:
ollama run hf.co/0xSero/GLM-5.2-REAP-504B-GGUF:Q4_K_XL
- Unsloth Desktop
- Pi
How to use 0xSero/GLM-5.2-REAP-504B-GGUF with Pi:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf 0xSero/GLM-5.2-REAP-504B-GGUF:Q4_K_XL
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:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "0xSero/GLM-5.2-REAP-504B-GGUF:Q4_K_XL" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use 0xSero/GLM-5.2-REAP-504B-GGUF with Docker Model Runner:
docker model run hf.co/0xSero/GLM-5.2-REAP-504B-GGUF:Q4_K_XL
- Lemonade
How to use 0xSero/GLM-5.2-REAP-504B-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull 0xSero/GLM-5.2-REAP-504B-GGUF:Q4_K_XL
Run and chat with the model
lemonade run user.GLM-5.2-REAP-504B-GGUF-Q4_K_XL
List all available models
lemonade list
- Hermes Agent
How to use 0xSero/GLM-5.2-REAP-504B-GGUF with Hermes Agent:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf 0xSero/GLM-5.2-REAP-504B-GGUF: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 0xSero/GLM-5.2-REAP-504B-GGUF:Q4_K_XL
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use 0xSero/GLM-5.2-REAP-504B-GGUF with OpenClaw:
Start the llama.cpp server
# Install llama.cpp: brew install llama.cpp # Start a local OpenAI-compatible server: llama serve -hf 0xSero/GLM-5.2-REAP-504B-GGUF:Q4_K_XL
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:8080/v1 \ --custom-model-id "0xSero/GLM-5.2-REAP-504B-GGUF:Q4_K_XL" \ --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"
Add files using upload-large-folder tool
Browse files- .gitattributes +6 -0
- GLM-5.2-REAP-504B-Q2_K_XL-00001-of-00005.gguf +3 -0
- GLM-5.2-REAP-504B-Q2_K_XL-00002-of-00005.gguf +3 -0
- GLM-5.2-REAP-504B-Q2_K_XL-00003-of-00005.gguf +3 -0
- GLM-5.2-REAP-504B-Q2_K_XL-00004-of-00005.gguf +3 -0
- GLM-5.2-REAP-504B-Q2_K_XL-00005-of-00005.gguf +3 -0
- GLM-5.2-REAP-504B-Q3_K_XL-00006-of-00006.gguf +3 -0
- README.md +91 -0
.gitattributes
CHANGED
|
@@ -69,3 +69,9 @@ GLM-5.2-REAP-504B-Q4_K_XL-00001-of-00008.gguf filter=lfs diff=lfs merge=lfs -tex
|
|
| 69 |
GLM-5.2-REAP-504B-Q4_K_XL-00006-of-00008.gguf filter=lfs diff=lfs merge=lfs -text
|
| 70 |
GLM-5.2-REAP-504B-Q3_K_XL-00003-of-00006.gguf filter=lfs diff=lfs merge=lfs -text
|
| 71 |
GLM-5.2-REAP-504B-Q4_K_XL-00003-of-00008.gguf filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
GLM-5.2-REAP-504B-Q4_K_XL-00006-of-00008.gguf filter=lfs diff=lfs merge=lfs -text
|
| 70 |
GLM-5.2-REAP-504B-Q3_K_XL-00003-of-00006.gguf filter=lfs diff=lfs merge=lfs -text
|
| 71 |
GLM-5.2-REAP-504B-Q4_K_XL-00003-of-00008.gguf filter=lfs diff=lfs merge=lfs -text
|
| 72 |
+
GLM-5.2-REAP-504B-Q3_K_XL-00006-of-00006.gguf filter=lfs diff=lfs merge=lfs -text
|
| 73 |
+
GLM-5.2-REAP-504B-Q2_K_XL-00005-of-00005.gguf filter=lfs diff=lfs merge=lfs -text
|
| 74 |
+
GLM-5.2-REAP-504B-Q2_K_XL-00002-of-00005.gguf filter=lfs diff=lfs merge=lfs -text
|
| 75 |
+
GLM-5.2-REAP-504B-Q2_K_XL-00004-of-00005.gguf filter=lfs diff=lfs merge=lfs -text
|
| 76 |
+
GLM-5.2-REAP-504B-Q2_K_XL-00001-of-00005.gguf filter=lfs diff=lfs merge=lfs -text
|
| 77 |
+
GLM-5.2-REAP-504B-Q2_K_XL-00003-of-00005.gguf filter=lfs diff=lfs merge=lfs -text
|
GLM-5.2-REAP-504B-Q2_K_XL-00001-of-00005.gguf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:58417ae9e82666624eb153be37c1b693826b7c35bc3a638a9b58e956e2f49e3b
|
| 3 |
+
size 44769604288
|
GLM-5.2-REAP-504B-Q2_K_XL-00002-of-00005.gguf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:55479b34a090bf33ef3796b0f5d434aaab7013c9410ce6263b8f26199efaa493
|
| 3 |
+
size 44168328864
|
GLM-5.2-REAP-504B-Q2_K_XL-00003-of-00005.gguf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:10f037e9011a3df669c401dd126ba4b9755ab3c54d0cd096710aba5dcf41a55f
|
| 3 |
+
size 44564908096
|
GLM-5.2-REAP-504B-Q2_K_XL-00004-of-00005.gguf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d5f400699af5bcf50dad51dead657ee8d4c2c23e657f86bcb1c7f9ae77d9c2f3
|
| 3 |
+
size 44876437408
|
GLM-5.2-REAP-504B-Q2_K_XL-00005-of-00005.gguf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:87b0a466f6ff75690abaaac94a5f1eae32337a49766a0081f7f6314a927cbe4b
|
| 3 |
+
size 27009792000
|
GLM-5.2-REAP-504B-Q3_K_XL-00006-of-00006.gguf
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:fa0ddda9eb8c66b1e7ab15fc7d0947a3b9a631e9fe9769a76a4ea874c4299a28
|
| 3 |
+
size 37565276768
|
README.md
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
base_model: zai-org/GLM-5.2
|
| 4 |
+
tags:
|
| 5 |
+
- moe
|
| 6 |
+
- reap
|
| 7 |
+
- pruning
|
| 8 |
+
- gguf
|
| 9 |
+
- llama.cpp
|
| 10 |
+
- glm
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# GLM-5.2-REAP-504B-GGUF (keep-168, Router-KD)
|
| 14 |
+
|
| 15 |
+
GGUF builds of a **34%-pruned** GLM-5.2 β 168 of 256 routed experts kept per layer (incl. the MTP
|
| 16 |
+
layer), **~504B params**, recovered with **gate-only Router-KD** to the unpruned teacher. This is
|
| 17 |
+
the keep-168 "floor": it reaches **parity with the full unpruned GLM-5.2** on real-world prompts
|
| 18 |
+
while being a third smaller.
|
| 19 |
+
|
| 20 |
+
## π Sponsor
|
| 21 |
+
|
| 22 |
+
All pruning, distillation, and evaluation ran on **8Γ NVIDIA B200 sponsored by [Lambda](https://lambda.ai)**. **Thank you, Lambda.** π
|
| 23 |
+
|
| 24 |
+
## Files
|
| 25 |
+
|
| 26 |
+
| file | bits | size (approx) | notes |
|
| 27 |
+
|---|---|---|---|
|
| 28 |
+
| `GLM-5.2-REAP-504B-BF16` | 16 | ~933 GB | full precision β for fine-tuning / re-quantizing |
|
| 29 |
+
| `GLM-5.2-REAP-504B-UD-Q4_K_XL` | ~4.5 | ~270 GB | dynamic β **recommended** quality/size balance |
|
| 30 |
+
| `GLM-5.2-REAP-504B-UD-Q3_K_XL` | ~3.5 | ~210 GB | dynamic β smaller, strong quality |
|
| 31 |
+
| `GLM-5.2-REAP-504B-UD-Q2_K_XL` | ~2.7 | ~160 GB | dynamic β smallest usable |
|
| 32 |
+
|
| 33 |
+
**`UD` = Unsloth-style Dynamic.** Quantized with an **importance matrix (imatrix)** calibration pass,
|
| 34 |
+
and **per-tensor dynamic precision**: attention, the shared expert, token-embedding and output tensors
|
| 35 |
+
are kept at higher bits while the routed experts are pushed low. This is dramatically better than flat
|
| 36 |
+
K-quants at 2β3 bit. The `imatrix.dat` used is included in the repo for reproducibility.
|
| 37 |
+
|
| 38 |
+
Large files are split into β€45 GB shards (`...-00001-of-000NN.gguf`); llama.cpp loads them directly
|
| 39 |
+
from the first shard.
|
| 40 |
+
|
| 41 |
+
## What this is
|
| 42 |
+
|
| 43 |
+
- **Arch:** `GlmMoeDsaForCausalLM` β 78 layers (3 dense + 75 MoE) + 1 MTP layer, DeepSeek Sparse
|
| 44 |
+
Attention, sigmoid router (top-8), 1 shared expert, hidden 6144.
|
| 45 |
+
- **Prune:** REAP (saliency = `gate Γ βexpert_outputβ`) β top-168/layer, consistent across all MoE
|
| 46 |
+
layers **and** the MTP layer; `n_routed_experts: 168`.
|
| 47 |
+
- **Recover:** freeze experts + backbone, train only the 75 router gates (~0.016% of params) to
|
| 48 |
+
KL-match the **unpruned** GLM-5.2 teacher's next-token distribution (plain uniform weighting,
|
| 49 |
+
lr 5e-5, 2999 sequences). This variant minimizes repetition / thought-loops.
|
| 50 |
+
|
| 51 |
+
## Eval
|
| 52 |
+
|
| 53 |
+
Held-out real-world prompts (50 probes, raw sampling, **no max_tokens / no timeout** β loops are
|
| 54 |
+
*detected*, not truncated):
|
| 55 |
+
|
| 56 |
+
| metric | keep-168 + Router-KD | unpruned teacher |
|
| 57 |
+
|---|---|---|
|
| 58 |
+
| attractor / loop rate | **0.08** (4/50) | 0.10 (6/50) |
|
| 59 |
+
| natural-EOS rate | **0.92** | 0.88 |
|
| 60 |
+
| output diversity (distinct-4) | **0.878** | β |
|
| 61 |
+
| median output length | 995 tok | β |
|
| 62 |
+
|
| 63 |
+
On this eval the pruned+recovered model is **at parity with the full teacher** β the 0.08 vs 0.10
|
| 64 |
+
gap is within noise on n=50. Metrics are measured on the recovered model; lower-bit quants (esp.
|
| 65 |
+
Q2_K) inherit the recipe but were not individually loop-tested and will degrade somewhat.
|
| 66 |
+
|
| 67 |
+
## Serving (llama.cpp)
|
| 68 |
+
|
| 69 |
+
```bash
|
| 70 |
+
# loads all shards from the first one
|
| 71 |
+
llama-cli -m GLM-5.2-REAP-504B-Q4_K_M-00001-of-000NN.gguf -p "Hello"
|
| 72 |
+
llama-server -m GLM-5.2-REAP-504B-Q4_K_M-00001-of-000NN.gguf --host 0.0.0.0 --port 8080
|
| 73 |
+
```
|
| 74 |
+
|
| 75 |
+
**Tip β brevity prompt:** GLM-5.2 (pruned or not) can over-think on some agent prompts. An optional
|
| 76 |
+
system prompt like *"Be concise. Think only as much as the task needs, then answer and stop."* cuts
|
| 77 |
+
median length roughly in half and removes some loops, at no retraining cost.
|
| 78 |
+
|
| 79 |
+
## Known limitations
|
| 80 |
+
|
| 81 |
+
- A few residual `</think>`-restart loops are **inherent to GLM-5.2** β the *unpruned* teacher loops
|
| 82 |
+
on the same prompts β so they are not an artifact of pruning and are not fully fixable via routing.
|
| 83 |
+
- The dynamic low-bit quants inherit the recipe but were not individually loop-tested; prefer `UD-Q4_K_XL` or BF16 where quality matters most.
|
| 84 |
+
|
| 85 |
+
## More
|
| 86 |
+
|
| 87 |
+
- Siblings: [`0xSero/GLM-5.2-481B`](https://huggingface.co/0xSero/GLM-5.2-481B) (keep-160), [`0xSero/GLM-5.2-469B`](https://huggingface.co/0xSero/GLM-5.2-469B) (keep-156).
|
| 88 |
+
- Writeup + code: [github.com/0xSero/glm52-reap-suite](https://github.com/0xSero/glm52-reap-suite)
|
| 89 |
+
|
| 90 |
+
---
|
| 91 |
+
*Compute sponsored by **[Lambda](https://lambda.ai)** β thank you. π*
|