Instructions to use EngineeringWithJay/Swift-Bonsai-2-27B-MLX with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use EngineeringWithJay/Swift-Bonsai-2-27B-MLX 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("EngineeringWithJay/Swift-Bonsai-2-27B-MLX") 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 EngineeringWithJay/Swift-Bonsai-2-27B-MLX with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "EngineeringWithJay/Swift-Bonsai-2-27B-MLX"
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": "EngineeringWithJay/Swift-Bonsai-2-27B-MLX" } ] } } }Run Pi
# Start Pi in your project directory: pi
- MLX LM
How to use EngineeringWithJay/Swift-Bonsai-2-27B-MLX with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "EngineeringWithJay/Swift-Bonsai-2-27B-MLX"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "EngineeringWithJay/Swift-Bonsai-2-27B-MLX" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8080/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "EngineeringWithJay/Swift-Bonsai-2-27B-MLX", "messages": [ {"role": "user", "content": "Hello"} ] }' - Hermes Agent
How to use EngineeringWithJay/Swift-Bonsai-2-27B-MLX 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 "EngineeringWithJay/Swift-Bonsai-2-27B-MLX"
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 EngineeringWithJay/Swift-Bonsai-2-27B-MLX
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use EngineeringWithJay/Swift-Bonsai-2-27B-MLX with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "EngineeringWithJay/Swift-Bonsai-2-27B-MLX"
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 "EngineeringWithJay/Swift-Bonsai-2-27B-MLX" \ --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"
Swift Bonsai 2 27B โ MLX pack
Swift Bonsai 2 is UkisAI's reasoning-efficient derivative of Prism ML's Ternary Bonsai 2 27B. This pack repackages the Swift trunk as a text-only MLX build for Apple Silicon; a small patched Prism loader ships at runtime/.
This is a local community build, not an official ukisai or Prism ML release. For speculative decoding via the Qwen3.8 MTP head see EngineeringWithJay/Swift-Bonsai-2-MTPLX.
What is inside
model.safetensorsโ Swift trunk, PQ2_0-family ternary 2-bit, re-encoded into MLX affine 2-bit. SHA256f82bb8b5971c7cc6860d84a27eead799444ed8d01a756964b57faeef730c1a0a.runtime/โ patched Prism loader and encoder (ternary PQ2_0/PTQ1_0 โ MLX affine 2-bit; seeruntime/requirements.txt).reload-validation.jsonโ greedy logits vs ukisai GGUF (max abs diff 0.0), argmax identical, PONG identical.- No MTP sidecar.
Architecture
| Field | Value |
|---|---|
| Backbone | Qwen3.8-27B (GQA, head_dim 256, 24 Q heads, 4 KV heads) |
| Trunk | Ternary weights (one scale per signed 128-block), hadamard-signed 2-bit |
| Attention | Hybrid Gated DeltaNet linear attention + full attention every 4th layer |
| Hidden | 5,120 |
| Layers | 64 |
| Context | 262,144 native |
Performance
Swift's own benchmark suite is upstream; this pack does not re-measure. From ukisai's published results, vs base Ternary Bonsai 2: GPQA-Diamond 84.34% (vs 84.18%), C-Eval 81.47% (vs 81.37%), IFBench 82.60% (vs 82.13%), AIME 2025 93.33% (vs 92.00%). Greedy decoding equivalence to the ukisai GGUF source is verified (reload-validation.json); text quality is preserved bit-exact.
How to use
MLX does not load this pack directly; the prism_hadamard_qwen35 model type needs the bundled patched loader.
import sys
from pathlib import Path
sys.path.insert(0, str(Path("runtime").resolve()))
from artifact import load_model
model = load_model(Path(".").resolve())
# ... then drive generation from the runtime module
Sampling (ukisai's Swift settings): temperature 1.0, top-p 0.95, top-k 20, min-p 0.0. Do not add repetition penalties.
Memory
~7.2 GB weights on disk. KV cache grows with context; keep โฒ 16K ctx on a 16 GB host (use 96K only on 24+ GB unified memory).
Limitations
- Experimental research release. Swift is uneven on instruction following, tool use, and open-ended coding.
- Not valid for stock
mlx_lmpaths โ needs the patched loader inruntime/. - MLX pack is text-only; no vision, no MTP. Reconstruction artifacts aside from ukisai's GGUF source are not distributed here.
License & attribution
Apache-2.0. Created using Bonsai by Prism ML. Swift weights by UkisAI. See NOTICE.txt and LICENSE.
Citation
@misc{swift-bonsai-2-mlx,
title = {Swift Bonsai 2 27B โ MLX pack},
author = {EngineeringWithJay},
year = {2026},
url = {https://huggingface.co/EngineeringWithJay/Swift-Bonsai-2-MLX}
}
- Downloads last month
- 259
Quantized
Model tree for EngineeringWithJay/Swift-Bonsai-2-27B-MLX
Base model
Qwen/Qwen3.8-27B