Instructions to use 0xSero/GLM-5.2-REAP-504B-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use 0xSero/GLM-5.2-REAP-504B-GGUF with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="0xSero/GLM-5.2-REAP-504B-GGUF", filename="GLM-5.2-REAP-504B-BF16-00001-of-00023.gguf", )
llm.create_chat_completion( messages = [ { "role": "user", "content": "What is the capital of France?" } ] ) - 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 Studio
How to use 0xSero/GLM-5.2-REAP-504B-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 0xSero/GLM-5.2-REAP-504B-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 0xSero/GLM-5.2-REAP-504B-GGUF to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for 0xSero/GLM-5.2-REAP-504B-GGUF to start chatting
- 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 @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": "0xSero/GLM-5.2-REAP-504B-GGUF:Q4_K_XL" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
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 new
- OpenClaw new
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"
- 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
GLM-5.2-REAP-504B-GGUF — BF16 + dynamic 2/3/4-bit
GGUF builds of the 34%-expert-pruned, Router-KD-recovered GLM-5.2-504B — for llama.cpp (CPU / Metal / CUDA). Includes the first working GGUF of a GLM-5.2 DSA model, made possible by a custom patch for its shared sparse-attention indexer.
The full-precision NVFP4 model lives at 0xSero/GLM-5.2-504B — start there for the model story, eval, and architecture. This card is about the GGUF conversion specifically.
🙏 Sponsor
Built on 8× NVIDIA B200 sponsored by Lambda. Thank you. 🙏
Files
| file | bits | size | notes |
|---|---|---|---|
GLM-5.2-REAP-504B-BF16 |
16 | ~933 GB | full precision — for fine-tuning / re-quantizing (23 shards) |
GLM-5.2-REAP-504B-Q4_K_XL |
~4.5 | ~325 GB | recommended — dynamic, highest usable quality (8 shards) |
GLM-5.2-REAP-504B-Q3_K_XL |
~3.5 | ~259 GB | dynamic, strong quality/size (6 shards) |
GLM-5.2-REAP-504B-Q2_K_XL |
~2.7 | ~111 GB | dynamic, smallest (5 shards) |
Files > 45 GB are split (...-00001-of-000NN.gguf); point llama.cpp at the first shard and it
loads the rest automatically.
What "dynamic" means here
These are not flat K-quants. Each uses per-tensor precision: the parts that hurt most under quantization are kept high while the bulk (routed experts) is pushed low:
- token-embedding → Q6_K, output head → Q8_0/Q6_K
- attention (MLA q/kv) → Q6_K / Q5_K / Q4_K (by tier)
- shared expert → Q8_0 / Q6_K
- routed-expert down-projection kept above gate/up (it's the sensitive one)
Not yet imatrix-calibrated. A true importance-matrix pass needs the model running under llama.cpp, and our llama.cpp build is CPU-only while the GPUs were committed elsewhere. The per-tensor recipe still puts these well above naive quants; imatrix-calibrated builds may follow.
The hard part — making GLM-5.2 loadable in llama.cpp
GLM-5.2 uses DSA (DeepSeek-style sparse attention) with a shared indexer: only ~1 layer in 4 is
a "full" indexer layer; the other 57 of 78 layers share it and carry no indexer weights of
their own (index_topk_freq: 4). Stock llama.cpp demands an indexer tensor on every layer, so
the converted GGUF failed to load:
missing tensor 'blk.3.indexer.k_norm.weight'
The fix (applied to these files): we filled each of the 57 shared layers' indexer tensors (285 tensors total) by duplicating them from the nearest preceding full layer, making the GGUF loadable.
The MTP / next-token-prediction layer (blk.78) is preserved — kept at Q6_K in every quant
(the stock quantizer rejects the nextn layer's experts, so we pin them with explicit per-tensor
types). This keeps self-speculative decoding available in llama.cpp for this architecture.
Verified: the patched model loads and generates coherent text end-to-end in llama-cli.
Caveat (honest): the sharing is approximated — the duplicated weights are recomputed per layer rather than the index being reused exactly as the original does. Output is coherent in testing, but this is not a bit-exact reproduction of the reference attention. Prefer
Q4_K_XLor BF16 where fidelity matters most; the low-bit quants were not individually loop-tested.
Run it
# loads all shards from the first one
llama-cli -m GLM-5.2-REAP-504B-Q4_K_XL-00001-of-00008.gguf -p "Hello"
llama-server -m GLM-5.2-REAP-504B-Q4_K_XL-00001-of-00008.gguf --host 0.0.0.0 --port 8080
Tips (measured at n=2000): a sampler guardrail is the single best free anti-loop knob —
--min-p 0.05 --repeat-penalty 1.05 → loop 7.2%→4.9%; --repeat-penalty 1.10 → 2.3%, i.e. it
fully recovers the pruning-induced looping (raw 7.2%; unpruned teacher 3.6%). Use 1.05 by default,
1.10 if you see loops (higher penalty can slightly over-suppress legitimate repetition in code). A
"Be concise…" system prompt separately halves output length (it shortens, doesn't de-loop).
How the underlying model was made (short version)
REAP expert-pruning (gate × ‖expert_output‖) → keep 168/256 experts/layer (~504B, 34% pruned) →
gate-only Router-KD to the unpruned teacher (train 0.016% of params). On n=2000 held-out real
prompts it loops at 7.2% vs the unpruned teacher's 3.6% — pruning roughly doubles the loop rate
(gate-KD recovers routing but not full termination; a knowledge-recovery LoRA is in progress to close
the gap). Full details + honest accounting on the NVFP4 model card.
GGUF conversion + custom DSA-indexer patch. Compute sponsored by Lambda — thank you. 🙏
- Downloads last month
- 11,991
2-bit
3-bit
4-bit
16-bit
Model tree for 0xSero/GLM-5.2-REAP-504B-GGUF
Base model
zai-org/GLM-5.2