MLX quants
Collection
49 items • Updated
How to use Xylolabs/gpt-oss-20b-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/gpt-oss-20b-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)How to use Xylolabs/gpt-oss-20b-MLX-4bit with Pi:
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "Xylolabs/gpt-oss-20b-MLX-4bit"
# 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/gpt-oss-20b-MLX-4bit"
}
]
}
}
}# Start Pi in your project directory: pi
How to use Xylolabs/gpt-oss-20b-MLX-4bit with MLX LM:
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "Xylolabs/gpt-oss-20b-MLX-4bit"
# Install MLX LM
uv tool install mlx-lm
# Start the server
mlx_lm.server --model "Xylolabs/gpt-oss-20b-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/gpt-oss-20b-MLX-4bit",
"messages": [
{"role": "user", "content": "Hello"}
]
}'How to use Xylolabs/gpt-oss-20b-MLX-4bit with Hermes Agent:
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "Xylolabs/gpt-oss-20b-MLX-4bit"
# 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/gpt-oss-20b-MLX-4bit
hermes
How to use Xylolabs/gpt-oss-20b-MLX-4bit with OpenClaw:
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "Xylolabs/gpt-oss-20b-MLX-4bit"
# 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/gpt-oss-20b-MLX-4bit" \ --custom-provider-id mlx-lm \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
openclaw agent --local --agent main --message "Hello from Hugging Face"
openai/gpt-oss-20b is the source model. The MLX weights run with mlx-lm.
pip install mlx-lm==0.32.2
mlx_lm.generate --model Xylolabs/gpt-oss-20b-MLX-4bit --prompt "What is the capital of Australia?"
The reference for KL and top-1 is the original weights (MXFP4 experts, other weights BF16) on WikiText-2, chat and held-out text (40/20/20 chunks of 512).
| Quant | Size | WikiText-2 KL | top-1 | Chat KL | top-1 | Held-out KL | top-1 | 7-question answer check |
|---|---|---|---|---|---|---|---|---|
| MLX 4-bit | 11.47 GB | 0.354894 | 54.66% | 0.704089 | 67.49% | 0.452159 | 53.51% | 7/7 |
| MLX 8-bit | 12.08 GB | 0.069925 | 85.13% | 0.103656 | 89.75% | 0.074301 | 83.04% | 7/7 |
| mlx-community MXFP4-Q8 | 12.08 GB | 0.088387 | 82.00% | 0.226985 | 84.39% | 0.096826 | 80.41% | |
| mlx-community MXFP4-Q4 | 11.18 GB | 0.641462 | 41.38% | 3.073213 | 30.84% | 1.003017 | 31.53% | |
| BF16 | 13.76 GB | 7/7 |
Apache License 2.0. See LICENSE, USAGE_POLICY and NOTICE.
4-bit
Base model
openai/gpt-oss-20b