Instructions to use XavierLocalAI/Hy3-4bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use XavierLocalAI/Hy3-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("XavierLocalAI/Hy3-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 XavierLocalAI/Hy3-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 "XavierLocalAI/Hy3-4bit"
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": "XavierLocalAI/Hy3-4bit" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use XavierLocalAI/Hy3-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 "XavierLocalAI/Hy3-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 XavierLocalAI/Hy3-4bit
Run Hermes
hermes
- OpenClaw new
How to use XavierLocalAI/Hy3-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 "XavierLocalAI/Hy3-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 "XavierLocalAI/Hy3-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"
- MLX LM
How to use XavierLocalAI/Hy3-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 "XavierLocalAI/Hy3-4bit"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "XavierLocalAI/Hy3-4bit" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "XavierLocalAI/Hy3-4bit", "messages": [ {"role": "user", "content": "Hello"} ] }'
| license: apache-2.0 | |
| base_model: tencent/Hy3 | |
| base_model_relation: quantized | |
| tags: | |
| - mlx | |
| - hunyuan | |
| - hy3 | |
| - moe | |
| pipeline_tag: text-generation | |
| library_name: mlx | |
| # Hy3-4bit (MLX) | |
| A clean 4-bit MLX quantization of [tencent/Hy3](https://huggingface.co/tencent/Hy3) (Hunyuan 3.0, Apache-2.0), converted with `mlx-lm` and verified running on Apple Silicon. | |
| Hy3 is a 295B-parameter Mixture-of-Experts model with **21B active parameters**, 80 layers, 192 routed experts (top-8) plus one shared expert, a native MTP (multi-token-prediction) head, and 256K context. | |
| ## Why this quant is clean | |
| Naive uniform 4-bit quantization degrades MoE models badly, because the router that picks which experts fire is precision-sensitive. This build follows a mixed-precision recipe: | |
| - **4-bit** (group size 64, affine) for attention and expert weights | |
| - **8-bit** for every MoE router gate (`*.mlp.router.gate`) | |
| - MTP head preserved | |
| That router protection is the difference between a coherent model and mush, and it matches the recipe used by the reference `mlx-community/Hy3-preview-4bit`. | |
| ## Footprint | |
| - Weights: ~166 GB | |
| - Fits: two 128GB Apple Silicon machines (or one 192GB+ Mac), does not fit a single 128GB machine at 4-bit. | |
| ## How it was made | |
| ```python | |
| from mlx_lm.convert import convert | |
| def hy3_predicate(path, module, config=None): | |
| if path.endswith("mlp.router.gate"): | |
| return {"group_size": 64, "bits": 8} | |
| return {"group_size": 64, "bits": 4} | |
| convert( | |
| hf_path="tencent/Hy3", | |
| mlx_path="Hy3-4bit", | |
| quantize=True, q_bits=4, q_group_size=64, q_mode="affine", | |
| quant_predicate=hy3_predicate, | |
| ) | |
| ``` | |
| `hy_v3` architecture support comes from [mlx-lm PR #1211](https://github.com/ml-explore/mlx-lm/pull/1211). | |
| ## Benchmarks (2x M5 Max, Thunderbolt RDMA) | |
| Measured on two M5 Max (128GB each), pipeline-parallel over Thunderbolt with Apple's `jaccl` RDMA backend (`MLX_METAL_FAST_SYNCH=1`). Single-stream decode. | |
| | Metric | Value | | |
| |---|---| | |
| | Decode (generation) | **36.91 tok/s** | | |
| | Prompt (prefill) | 8.6 tok/s | | |
| | Peak memory / node | 84.4 GB | | |
| | Backend | jaccl (RDMA), pipeline-parallel | | |
| Notes: at 4-bit (~166GB) the model does not fit a single 128GB machine, so this is a genuine 2-node cluster run. The `ring`/TCP backend trips the macOS Metal command-buffer watchdog on the cross-node fence wait; RDMA (`jaccl`) is required for stable single-stream decode. | |
| ## Credits | |
| - Base model: Tencent Hunyuan (`tencent/Hy3`, Apache-2.0) | |
| - Architecture support: mlx-lm PR #1211 | |
| - Quantization + Apple Silicon cluster benchmark: bicVanYonk | |