Instructions to use spicyneuron/GLM-5.2-MLX-4.5bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use spicyneuron/GLM-5.2-MLX-4.5bit with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("spicyneuron/GLM-5.2-MLX-4.5bit") prompt = "Write a story about Einstein" messages = [{"role": "user", "content": prompt}] prompt = tokenizer.apply_chat_template( messages, add_generation_prompt=True ) text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Pi
How to use spicyneuron/GLM-5.2-MLX-4.5bit with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "spicyneuron/GLM-5.2-MLX-4.5bit"
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "mlx-lm": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "spicyneuron/GLM-5.2-MLX-4.5bit" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use spicyneuron/GLM-5.2-MLX-4.5bit with Hermes Agent:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "spicyneuron/GLM-5.2-MLX-4.5bit"
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 spicyneuron/GLM-5.2-MLX-4.5bit
Run Hermes
hermes
- MLX LM
How to use spicyneuron/GLM-5.2-MLX-4.5bit with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "spicyneuron/GLM-5.2-MLX-4.5bit"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "spicyneuron/GLM-5.2-MLX-4.5bit" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "spicyneuron/GLM-5.2-MLX-4.5bit", "messages": [ {"role": "user", "content": "Hello"} ] }'
| language: | |
| - en | |
| - zh | |
| library_name: mlx | |
| license: mit | |
| pipeline_tag: text-generation | |
| tags: | |
| - mlx | |
| base_model: zai-org/GLM-5.2 | |
| [zai-org/GLM-5.2](https://huggingface.co/zai-org/GLM-5.2) optimized for running on a Mac Studio M3 512. | |
| - A mixed-precision quant that balances speed, memory, and accuracy. | |
| - 4-bit baseline with important layers at higher precision. | |
| - Fits into ~420 GB memory, leaving enough room for a smaller utility model. | |
| # Usage | |
| NOTE: Run with https://github.com/ml-explore/mlx-lm/pull/1410 until the PR is merged. | |
| ```sh | |
| # Start server at http://localhost:8080/v1/chat/completions | |
| uvx --from mlx-lm mlx_lm.server \ | |
| --host 127.0.0.1 \ | |
| --port 8080 \ | |
| --model spicyneuron/GLM-5.2-MLX-4.5bit | |
| ``` | |
| # Benchmarks | |
| metric | this model | |
| --- | --- | |
| bpw | 4.535 | |
| base memory | 392.454 | |
| peak memory (1024/512) | 422.787 | |
| prompt tok/s (1024) | 194.114 ± 0.079 | |
| gen tok/s (512) | 17.781 ± 0.028 | |
| kl mean\* | 0.049 ± 0.002 | |
| kl p95 | 0.113 ± 0.002 | |
| perplexity | 4.642 ± 0.036 | |
| arc_challenge | 0.690 ± 0.021 | |
| hellaswag | 0.780 ± 0.019 | |
| \* KL calculated against the largest quant I could run locally (~5.3 bit). Real KL is against FP will be higher. | |
| # Methodology | |
| Quantized with a [mlx-lm fork](https://github.com/spicyneuron/mlx-lm/tree/override). | |
| MLX quantization options differ than llama.cpp, but the principles are the same: | |
| - Sensitive layers like MoE routing, attention, and output embeddings get higher precision | |
| - More tolerant layers like MoE experts get lower precision | |