Instructions to use 2001Y/Ternary-Bonsai-2-27B-Abliterated-v2-PQ2_0-MTP-MLX with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use 2001Y/Ternary-Bonsai-2-27B-Abliterated-v2-PQ2_0-MTP-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("2001Y/Ternary-Bonsai-2-27B-Abliterated-v2-PQ2_0-MTP-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 2001Y/Ternary-Bonsai-2-27B-Abliterated-v2-PQ2_0-MTP-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 "2001Y/Ternary-Bonsai-2-27B-Abliterated-v2-PQ2_0-MTP-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": "2001Y/Ternary-Bonsai-2-27B-Abliterated-v2-PQ2_0-MTP-MLX" } ] } } }Run Pi
# Start Pi in your project directory: pi
- MLX LM
How to use 2001Y/Ternary-Bonsai-2-27B-Abliterated-v2-PQ2_0-MTP-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 "2001Y/Ternary-Bonsai-2-27B-Abliterated-v2-PQ2_0-MTP-MLX"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "2001Y/Ternary-Bonsai-2-27B-Abliterated-v2-PQ2_0-MTP-MLX" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "2001Y/Ternary-Bonsai-2-27B-Abliterated-v2-PQ2_0-MTP-MLX", "messages": [ {"role": "user", "content": "Hello"} ] }' - Hermes Agent
How to use 2001Y/Ternary-Bonsai-2-27B-Abliterated-v2-PQ2_0-MTP-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 "2001Y/Ternary-Bonsai-2-27B-Abliterated-v2-PQ2_0-MTP-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 2001Y/Ternary-Bonsai-2-27B-Abliterated-v2-PQ2_0-MTP-MLX
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use 2001Y/Ternary-Bonsai-2-27B-Abliterated-v2-PQ2_0-MTP-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 "2001Y/Ternary-Bonsai-2-27B-Abliterated-v2-PQ2_0-MTP-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 "2001Y/Ternary-Bonsai-2-27B-Abliterated-v2-PQ2_0-MTP-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"
Ternary-Bonsai-2-27B-Abliterated-v2-PQ2_0-MTP-MLX
An MLX-native conversion of BoldingBuilds' Ternary-Bonsai-2-27B-Abliterated-v2-PQ2_0-MTP, preserving exact ternary weight representations and enabling self-speculative decoding (Multi-Token Prediction) on Apple Silicon.
Key Technical Facts
- Lossless Quant-Native Weight Preservation: Converted directly from the official PQ2_0 GGUF without re-quantization. All 866 tensors (27.3 billion elements) are mapped bitwise-exact to MLX affine packed representation.
- Thinking Mode Fix (v2 Update): Incorporates BoldingBuilds' v2 output-projection adjustment, preventing runaway reasoning loops and ensuring proper closure (
</think>) before emitting the final answer. - MTP Self-Speculative Decoding: Integrates the grafted Qwen3.8 MTP draft head. Correctly resolves the Sylvester-Walsh-Hadamard orthogonal rotation coordinates across both primary and MTP embedding projections, achieving an empirical ~87.5% draft acceptance rate in oMLX.
- Low Memory Footprint: Runs within ~8.6 - 9.4 GB unified memory (VRAM), making 27B parameter reasoning accessible on 16GB Apple Silicon machines (MacBook Air / Pro / Mac mini).
Architecture & Specifications
| Parameter | Specification |
|---|---|
| Base Architecture | Qwen3.5 / Bonsai 2 (Hybrid GDN + Full Attention) |
| Parameters | 27B total |
| Effective Bit-Width | 2.13 bpw (Ternary weights with block scales) |
| Context Length | Up to 131,072 tokens |
| Vocabulary Size | 248,320 tokens (ByteLevel BPE, full tail tokens preserved) |
| Speculative Engine | Multi-Token Prediction (MTP) depth=1 |
| Runtime Target | oMLX (native Metal kernel & MTP pipeline support) |
Quickstart (oMLX)
For optimal performance with speculative MTP decoding on Apple Silicon, run using oMLX (free, open-source macOS-native LLM runner with smart caching and native MTP acceleration).
This model requires custom architecture code (model.py) to handle Hadamard orthogonal transformations and MTP draft grafting.
1. Python Inference via oMLX Runtime
from omlx.model_settings import ModelSettings
from omlx.utils.model_loading import lm_load_compat, maybe_apply_pre_load_patches
import mlx_lm
model_path = "path/to/Ternary-Bonsai-2-27B-Abliterated-v2-PQ2_0-MTP-MLX"
# Enable MTP speculative decoding (depth=1)
settings = ModelSettings(mtp_enabled=True, mtp_fixed_depth=1)
maybe_apply_pre_load_patches(model_path, model_settings=settings)
# Load model (strict=True, trust_remote_code=True)
model, tokenizer = lm_load_compat(model_path, trust_remote_code=True, lazy=False)
# Generate
prompt = "<|im_start|>user\nExplain quantum entanglement in simple terms.<|im_end|>\n<|im_start|>assistant\n"
response = mlx_lm.generate(model, tokenizer, prompt=prompt, max_tokens=512, verbose=True)
print(response)
2. Standalone MLX-LM CLI
When using standard mlx_lm, run with --trust-remote-code:
mlx_lm.generate \
--model path/to/Ternary-Bonsai-2-27B-Abliterated-v2-PQ2_0-MTP-MLX \
--prompt "Hello!" \
--trust-remote-code
(Note: Speculative MTP acceleration requires the oMLX patch layer or an MTP-enabled mlx-lm runtime branch).
Provenance & Attribution
- Base Weights & Architecture: Prism ML (Sylvester-Walsh-Hadamard transform + Qwen3.5-based hybrid).
- Abliteration & Output Tuning: BoldingBuilds (quant-native ternary bit flip, thinking-closure fix).
- MTP Architecture: Qwen Team, Alibaba Cloud.
- License: Apache-2.0.
- Downloads last month
- 1,040
2-bit
Model tree for 2001Y/Ternary-Bonsai-2-27B-Abliterated-v2-PQ2_0-MTP-MLX
Base model
Qwen/Qwen3.8-27B