Text Generation
MLX
Safetensors
English
Chinese
hy_v4
quantized
hy4
Mixture of Experts
conversational
4-bit precision
Instructions to use Xylolabs/Hy4-MLX-4bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use Xylolabs/Hy4-MLX-4bit 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("Xylolabs/Hy4-MLX-4bit") 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 Xylolabs/Hy4-MLX-4bit with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "Xylolabs/Hy4-MLX-4bit"
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "mlx-lm": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "Xylolabs/Hy4-MLX-4bit" } ] } } }Run Pi
# Start Pi in your project directory: pi
- MLX LM
How to use Xylolabs/Hy4-MLX-4bit with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "Xylolabs/Hy4-MLX-4bit"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "Xylolabs/Hy4-MLX-4bit" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8080/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Xylolabs/Hy4-MLX-4bit", "messages": [ {"role": "user", "content": "Hello"} ] }' - Hermes Agent
How to use Xylolabs/Hy4-MLX-4bit 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 "Xylolabs/Hy4-MLX-4bit"
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 Xylolabs/Hy4-MLX-4bit
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use Xylolabs/Hy4-MLX-4bit with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "Xylolabs/Hy4-MLX-4bit"
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 "Xylolabs/Hy4-MLX-4bit" \ --custom-provider-id mlx-lm \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
Short card: Mac hardware table, plain rows, shorter Updates, one size per file
Browse files
README.md
CHANGED
|
@@ -93,8 +93,8 @@ Mean KL divergence from BF16 (lower is better) and top-1 agreement with BF16.
|
|
| 93 |
|
| 94 |
| Quant | Size | WikiText-2 KL | top-1 | Chat KL | top-1 | Held-out KL | top-1 |
|
| 95 |
|---|---:|---:|---:|---:|---:|---:|---:|
|
| 96 |
-
|
|
| 97 |
-
|
|
| 98 |
|
| 99 |
<picture>
|
| 100 |
<source media="(prefers-color-scheme: dark)" srcset="https://huggingface.co/Xylolabs/Hy4-MLX-4bit/resolve/main/accuracy-kl-dark.png">
|
|
@@ -108,17 +108,19 @@ Mean KL divergence from BF16 (lower is better) and top-1 agreement with BF16.
|
|
| 108 |
|
| 109 |
## Which file for your hardware
|
| 110 |
|
| 111 |
-
|
| 112 |
|
| 113 |
-
| Hardware | Memory |
|
| 114 |
-
|---|---
|
| 115 |
-
| Mac Studio M5 Max
|
| 116 |
-
| Mac Studio M5 Max
|
| 117 |
-
| Mac Studio M5 Max
|
| 118 |
-
| Mac Studio M5 Ultra | 96 GB unified | none
|
| 119 |
-
| Mac Studio M5 Max, 40-core GPU
|
| 120 |
-
| Mac Studio M5 Ultra | 256 GB unified | none
|
| 121 |
-
| Mac Studio M5 Ultra, 80-core GPU | 512 GB unified | `Xylolabs/Hy4-MLX-4bit` (4-bit,
|
|
|
|
|
|
|
| 122 |
|
| 123 |
## License and notices
|
| 124 |
|
|
@@ -126,9 +128,8 @@ These files are under the Tencent Hy License, Version 1.0, copied in `LICENSE`,
|
|
| 126 |
|
| 127 |
## Updates
|
| 128 |
|
| 129 |
-
- 2026-11-22: Added
|
| 130 |
-
- 2026-11-
|
| 131 |
-
- 2026-11-21: The Accuracy table now covers WikiText-2, chat and held-out text against the corrected BF16 reference, replacing the earlier figure (WikiText-2 KL 0.128577 became 0.142528). Added the KL and top-1 charts.
|
| 132 |
- 2026-11-20: First release.
|
| 133 |
|
| 134 |
## Tencent's original model description
|
|
|
|
| 93 |
|
| 94 |
| Quant | Size | WikiText-2 KL | top-1 | Chat KL | top-1 | Held-out KL | top-1 |
|
| 95 |
|---|---:|---:|---:|---:|---:|---:|---:|
|
| 96 |
+
| MLX 4-bit | 456.63 GB | 0.142528 | 88.549% | 0.193011 | 90.126% | 0.066185 | 92.363% |
|
| 97 |
+
| MLX 8-bit | 828.681 GB | 0.038634 | 94.118% | 0.119845 | 93.565% | 0.016506 | 96.088% |
|
| 98 |
|
| 99 |
<picture>
|
| 100 |
<source media="(prefers-color-scheme: dark)" srcset="https://huggingface.co/Xylolabs/Hy4-MLX-4bit/resolve/main/accuracy-kl-dark.png">
|
|
|
|
| 108 |
|
| 109 |
## Which file for your hardware
|
| 110 |
|
| 111 |
+
A file fits when its size plus the KV cache at that context (f16) plus 2 GB for the runtime is under 75% of the memory, the default macOS GPU limit.
|
| 112 |
|
| 113 |
+
| Hardware | Memory | File | Context |
|
| 114 |
+
|---|---|---|---:|
|
| 115 |
+
| Mac Studio M5 Max, 32-core GPU | 36 GB unified | none | |
|
| 116 |
+
| Mac Studio M5 Max, 40-core GPU | 48 GB unified | none | |
|
| 117 |
+
| Mac Studio M5 Max, 40-core GPU | 64 GB unified | none | |
|
| 118 |
+
| Mac Studio M5 Ultra | 96 GB unified | none | |
|
| 119 |
+
| Mac Studio M5 Max, 40-core GPU | 128 GB unified | none | |
|
| 120 |
+
| Mac Studio M5 Ultra | 256 GB unified | none | |
|
| 121 |
+
| Mac Studio M5 Ultra, 80-core GPU | 512 GB unified | `Xylolabs/Hy4-MLX-4bit`* (4-bit, 456.6 GB) | 16K |
|
| 122 |
+
|
| 123 |
+
\* Fits only with the macOS GPU memory limit raised (up to 90% of the memory).
|
| 124 |
|
| 125 |
## License and notices
|
| 126 |
|
|
|
|
| 128 |
|
| 129 |
## Updates
|
| 130 |
|
| 131 |
+
- 2026-11-22: Added the vision tower and the DFly2 drafter with their Python modules.
|
| 132 |
+
- 2026-11-21: Accuracy table redone on WikiText-2, chat and held-out text against the corrected BF16 reference; charts added.
|
|
|
|
| 133 |
- 2026-11-20: First release.
|
| 134 |
|
| 135 |
## Tencent's original model description
|