Instructions to use Xylolabs/Hy4-MLX-8bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use Xylolabs/Hy4-MLX-8bit 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-8bit") 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-8bit 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-8bit"
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-8bit" } ] } } }Run Pi
# Start Pi in your project directory: pi
- MLX LM
How to use Xylolabs/Hy4-MLX-8bit 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-8bit"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "Xylolabs/Hy4-MLX-8bit" # 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-8bit", "messages": [ {"role": "user", "content": "Hello"} ] }' - Hermes Agent
How to use Xylolabs/Hy4-MLX-8bit 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-8bit"
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-8bit
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use Xylolabs/Hy4-MLX-8bit 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-8bit"
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-8bit" \ --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"
The text model of tencent/Hy4 (770B parameters, 49B active) converted for MLX. mlx-lm runs it as a text model; the vision tower (image input) and the DFly2 drafter (speculative decoding) are separate files here, used through the Python modules.
How to run
Install mlx-lm and pass --trust-remote-code:
pip install mlx-lm==0.32.2
mlx_lm.generate --model Xylolabs/Hy4-MLX-8bit --trust-remote-code --prompt "Explain how a heat pump works."
mlx_lm.chat --model Xylolabs/Hy4-MLX-8bit --trust-remote-code
mlx_lm.server --model Xylolabs/Hy4-MLX-8bit --trust-remote-code
Speculative decoding
from mlx_lm import load
from dfly_v4 import load_drafter
from speculative_v4 import SpecStats, stream_generate
model, tokenizer = load(str(root), trust_remote_code=True)
drafter = load_drafter(str(root / "dfly"), model.args)
stats = SpecStats()
for part in stream_generate(model, tokenizer, "Explain how a heat pump works.", drafter=drafter, stats=stats):
print(part.text, end="")
Accuracy
Against BF16.
| Quant | Size | WikiText-2 KL | top-1 | Chat KL | top-1 | Held-out KL | top-1 |
|---|---|---|---|---|---|---|---|
| MLX 4-bit | 456.63 GB | 0.142528 | 88.549% | 0.193011 | 90.126% | 0.066185 | 92.363% |
| MLX 8-bit | 828.681 GB | 0.038634 | 94.118% | 0.119845 | 93.565% | 0.016506 | 96.088% |
Which file for your hardware
| Hardware | Memory | File | Context |
|---|---|---|---|
| Mac Studio M5 Max, 32-core GPU | 36 GB unified | none | |
| Mac Studio M5 Max, 40-core GPU | 48 GB unified | none | |
| Mac Studio M5 Max, 40-core GPU | 64 GB unified | none | |
| Mac Studio M5 Ultra | 96 GB unified | none | |
| Mac Studio M5 Max, 40-core GPU | 128 GB unified | none | |
| Mac Studio M5 Ultra | 256 GB unified | none | |
| Mac Studio M5 Ultra, 80-core GPU | 512 GB unified | Xylolabs/Hy4-MLX-4bit* (4-bit, 456.6 GB) |
16K |
* With the macOS GPU memory limit raised.
License and notices
Tencent Hy License, Version 1.0, copied in LICENSE. We quantized the weights and converted them to MLX. hy_v4.py carries code from Transformers (LICENSE.transformers) and mlx-lm (ORIGINS.md).
Updates
- 2026-11-22: Added a hardware recommendation table.
- 2026-11-22: Added the vision tower and the DFly2 drafter with their Python modules.
- 2026-11-20: First release.
- Downloads last month
- 337
8-bit
Model tree for Xylolabs/Hy4-MLX-8bit
Base model
tencent/Hy4