Laguna-XS-2.1
Collection
MLX versions of Laguna-XS-2.1 • 6 items • Updated
How to use mlx-community/Laguna-XS-2.1-3bit 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("mlx-community/Laguna-XS-2.1-3bit")
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 mlx-community/Laguna-XS-2.1-3bit with Pi:
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "mlx-community/Laguna-XS-2.1-3bit"
# 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": "mlx-community/Laguna-XS-2.1-3bit"
}
]
}
}
}# Start Pi in your project directory: pi
How to use mlx-community/Laguna-XS-2.1-3bit with Hermes Agent:
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "mlx-community/Laguna-XS-2.1-3bit"
# 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 mlx-community/Laguna-XS-2.1-3bit
hermes
How to use mlx-community/Laguna-XS-2.1-3bit with OpenClaw:
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "mlx-community/Laguna-XS-2.1-3bit"
# 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 "mlx-community/Laguna-XS-2.1-3bit" \ --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"
How to use mlx-community/Laguna-XS-2.1-3bit with MLX LM:
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "mlx-community/Laguna-XS-2.1-3bit"
# Install MLX LM
uv tool install mlx-lm
# Start the server
mlx_lm.server --model "mlx-community/Laguna-XS-2.1-3bit"
# Calling the OpenAI-compatible server with curl
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "mlx-community/Laguna-XS-2.1-3bit",
"messages": [
{"role": "user", "content": "Hello"}
]
}'Converted from poolside/Laguna-XS-2.1 to MLX format, quantized to 3 bits (group size 64, 3.503 bpw effective).
laguna architecture yet — there's an open PR:
mlx-lm#1223.</think> tag at the start of responses, which
isn't that common. It won't affect anything tho.Measured with oMLX's benchmark harness on a Macbook Pro M5 Max 128GB 40 GPU (single request, 128 generated tokens):
| prompt | gen tok/s | prefill tok/s | TTFT ms | peak GB |
|---|---|---|---|---|
| 1k | 137.2 | 3959 | 259 | 14.3 |
| 4k | 128.8 | 4003 | 1023 | 14.9 |
| 8k | 124.4 | 3807 | 2152 | 15.0 |
| 16k | 114.6 | 3214 | 5098 | 15.3 |
| 32k | 98.8 | 2612 | 12546 | 15.9 |
| Variant | bpw | Disk | gen tok/s (1k → 32k) |
|---|---|---|---|
| bf16 | 16 | 62 GB | 70.6 → 58.7 |
| 8bit | 8.500 | 33 GB | 95.4 → 76.7 |
| 6bit | 6.501 | 25 GB | 102.9 → 80.9 |
| 5bit | 5.502 | 21 GB | 115.9 → 87.7 |
| 4bit | 4.503 | 18 GB | 126.0 → 91.3 |
| 3bit (this repo) | 3.503 | 14 GB | 137.2 → 98.8 |
uvx --from mlx-vlm mlx_vlm.generate --model mlx-community/Laguna-XS-2.1-3bit --prompt "..." --max-tokens 300
OpenMDW-1.1, inherited from the base model.
3-bit
Base model
poolside/Laguna-XS-2.1