license: apache-2.0
library_name: mlx
pipeline_tag: image-text-to-text
base_model:
- 3hs4n/Ternary-Bonsai-2-27B-Uncensored-Heretic-v2-mlx-2bit-compact
tags: - mlx
- mlx-vlm
- tensorfold
- bonsai
- heretic
- uncensored
- 2-bit
- conversational
- reasoning
- vision
- tool-calling
- speculative-decoding
- apple-silicon
Ternary-Bonsai-2-27B-Uncensored-Heretic-v2-mlx-2bit-compact-TensorFold
Experimental, downloadable Apple Silicon release with target weights, drafter and a pinned TensorFold runtime. Validated on an Apple M1 Max with 64 GiB unified memory. Use the included launcher to obtain the measured TensorFold behavior.
This edition serves the existing Compact Heretic v2 MLX checkpoint through a modified TensorFold engine with DFlash2 acceleration, vision, bounded thinking and native tool calls. The target and on-disk drafter weights are unchanged. The improvements come from inference software and memory management.
At a glance
| Item | Measured or validated result |
|---|---|
| Target weights | 8.41 GB, unchanged |
| Existing BF16 drafter | 3.85 GB; quantized to 4-bit in RAM at load |
| Complete HF repository | Approximately 12.27 GB, including 12.26 GB of target + drafter weights |
| Runtime installation | About 1.11 GB allocated in the tested environment; dependencies download separately |
| Tested Mac | Apple M1 Max, 64 GiB unified memory |
| Maximum observed process footprint | 20.74 GiB, including the clean-package full-resolution image test |
| Text / code / math decode | 27.1 / 57.0 / 31.0 tokens/s |
| Quality comparison | 77/80 for both runtimes, with the same three failures |
| Validated configuration | 8K context, greedy, one sequence, prefix cache disabled |
| Model/API errors in the final comparison | 0 |
The process-memory peak excludes the rest of macOS and other apps. Minimum system RAM has not been established; only the stated 64 GiB Mac was tested. File size is not the RAM requirement.
Download and run
Requirements: Apple Silicon, macOS 26 or newer, native arm64 Python 3.11, and enough free unified memory for the observed 20.74 GiB process peak plus macOS and your other apps. A 64 GiB Mac is the tested hardware; a minimum RAM configuration has not been established. Unload other large models first.
Download the whole repository, including drafter/ and runtime/. With the Hugging Face CLI installed:
hf download 3hs4n/Ternary-Bonsai-2-27B-Uncensored-Heretic-v2-mlx-2bit-compact-TensorFold --local-dir Compact-TensorFold
cd Compact-TensorFold
python3.11 install.py
python3 serve.py
install.py verifies all release checksums, creates .venv-tensorfold, installs the 79 hash-pinned dependency wheels and the bundled TensorFold wheel, then checks dependencies. Initial installation requires internet access. The launcher loads the included weights offline; it does not fetch another model. Installation leaves your other environments unchanged. The lock is specific to Python 3.11 / macOS arm64; this edition has not been validated on Windows, Linux or other GPUs.
The dependency wheels total approximately 254 MB of additional download; an installed environment occupied about 1.11 GB in the measured setup. Download size, installed software size and process RAM are different measurements.
The dedicated OpenAI-compatible endpoint is http://127.0.0.1:8080/v1. Use python3 serve.py --port 8088 if that port is occupied. The model ID is Ternary-Bonsai-2-27B-Uncensored-Heretic-v2-mlx-2bit-compact-TensorFold, also returned by /v1/models. A client that supports custom OpenAI-compatible servers can connect to this endpoint. Native in-app TensorFold loading in Unsloth or LM Studio has not been validated. Opening the MLX weights directly in an app does not activate this TensorFold engine.
curl http://127.0.0.1:8080/v1/chat/completions \
-H 'Content-Type: application/json' \
-d '{"model":"Ternary-Bonsai-2-27B-Uncensored-Heretic-v2-mlx-2bit-compact-TensorFold","messages":[{"role":"user","content":"What is 17 times 19?"}],"temperature":0,"max_tokens":256}'
The launcher checks Ollama for loaded models at startup and during use; on contention it stops only its own child. Additional OpenAI-compatible services can be guarded with --check-model-url http://127.0.0.1:PORT/v1/models. Inspect settings without loading with python3 serve.py --show-command; stop with Ctrl-C. Prefix caching and disk snapshots are disabled in this measured profile.
Thinking is off by default. To enable it for a request, use:
{
"chat_template_kwargs": {"enable_thinking": true},
"thinking_budget": 128
}
The launcher supplies a 128-token default thinking budget when a thinking request omits one. The measured speed profile uses temperature 0. Other sampling settings have not been validated for this edition.
Speed and memory
The comparison used the same target checkpoint, AC power and one test server at a time. The native runtime was bracketed by two TensorFold speed arms, with excluded warmups and 3 native / 6 TensorFold timed samples per workload.
| Probe | Native mlx-vlm | TensorFold + DFlash2 | Observed change |
|---|---|---|---|
| Text | 21.15 tokens/s | 27.05 tokens/s | +27.9% |
| Code | 21.04 tokens/s | 57.04 tokens/s | +171.2% |
| Math explanation | 21.08 tokens/s | 31.04 tokens/s | +47.2% |
| Peak process RAM, including large-image test | 14.08 GiB | 20.67 GiB | TensorFold uses more RAM |
The earlier text-only TensorFold profile peaked at 22.83 GiB. Releasing loading buffers earlier and using 512-row prefill chunks reduced the final peak by 2.15 GiB / 9.4%, even with vision enabled. Decode rates stayed within about 1% of that earlier profile.
The rates include stream-completion overhead after the first text event. Text and math throughput probes stop at 128 tokens, so their speed results do not grade a complete answer. Faster decoding also does not imply a faster first token: code first-token latency was approximately 0.392 s native / 0.645 s TensorFold. Both complete coding and broader quality checks were evaluated separately.
Two candidate server starts took approximately 69–70 seconds, including startup checks. Preparation, implementation, validation and final audit took 44.5 minutes in the recorded session. These are observations on this Mac, not timing guarantees for other hardware.
Quality and vision
| Fixed checks | Native | TensorFold |
|---|---|---|
| Original Compact fixtures | 20/20 | 20/20 |
| Additional synthetic checks | 46/48 | 46/48 |
| Fixed 12-question GSM8K subset | 11/12 | 11/12 |
| Total | 77/80 | 77/80 |
No quality regressions were observed in this suite. Both runtimes made the same three errors: Persian 17+23, selecting only the last code from a list, and GSM8K test index 450. These results are not universal accuracy, an official full benchmark, or proof that all outputs match between runtimes. Drafted/plain token hashes matched 7/7 probes within TensorFold, including image cases. Relevant unit tests passed 120/120.
The tested image capabilities include OCR, counting, spatial questions, charts, multiple images, image-based thinking and a native tool call based on image text. A separate 2,048×2,048 OCR image ran at 4,096 vision tokens and passed on both runtimes: 45.95 s TensorFold / 48.82 s native, one observation each.
The frontend shares a 4,096-visual-token budget across a request's images; larger images or multiple images can be resized to fit. The existing Compact tower remains lossy compared with the original FP16 vision tower. This runtime does not retrain vision or recover detail lost in the original Compact quantization.
Runtime and compatibility
The installed engine is TensorFold Python 0.6.6, locally versioned 0.6.6+compact.vision2. Native TensorFold 1.1.9 does not include this Bonsai integration. The tested stack is Python 3.11.15, MLX 0.32.4, mlx-lm 0.32.2, mlx-vlm 0.7.11, Transformers 5.22.1 and HF Hub 2.4.0. Exact installed packages are in the runtime requirements; the hash lock pins the actual wheels used by the installer.
The runtime patch adapts the real Qwen vision frontend to Prism's Hadamard-aware embedding, adds image rotary handling, reduces temporary loading buffers and provides the measured prefill setting. It preserves target weights and the matching signed Hadamard transforms.
Validated scope is this 8K, single-sequence greedy profile on the stated Mac. Sampling, larger contexts, automatic prefix caching, video, concurrent clients and other GPUs remain untested. The checkpoint's configured 262,144-token architectural limit does not establish that this runtime profile has been validated at that length. The Uncensored name is inherited from the source; this work did not further alter refusal behavior.
Provenance, integrity and license
- Target: 3hs4n's Compact Heretic v2 MLX release, with original contributions from Prism ML and OS-Software. Target SHA256:
d667a865dd15a1f926c2495c751fbe6e16ee6e372fc61eb59c439445c97da8fb. - Drafter: naklitechie/Qwen3.8-27B-DFlash2-ternary-bonsai2, derived from z-lab's DFlash2, revision
0059b38aa255698b1a87305eb3fbb5a3cfd616e2. Drafter SHA256:eb141d0fb8621cf7a7c81047b83810fa19b8093543bd05529e9478d9555cb8f1. - Engine: ashhart/TensorFold, original Python source commit
cb2ebf0540f42604e2759b2ddef497861e928248, with the included local patch. - MLX and mlx-vlm provide the tensor runtime and vision tower implementation. The source target, drafter and TensorFold use Apache-2.0; their licenses and notices are preserved in this repository,
drafter/, and the bundled runtime wheel/source archive. Dependency licenses remain their own.
Both weight checksums were verified after inference. Sanitized measured results accompany this card. The release contains no local environments, raw working logs, credentials or personal computer paths. Verify a downloaded copy with python3 install.py --verify-only or shasum -a 256 -c SHA256SUMS. The portable smoke test checks text, thinking, native tools with a round trip, OCR and a 4,096-token image against a running server. It is a small integration test, separate from the 80-check quality comparison.
A fresh installation from the bundled wheel and 79 hash-verified dependency wheels passed dependency checks and 6/6 integration checks with 0 errors. Startup was 82.9 seconds, followed by 62.7 seconds for the checks. Full-image OCR used 4,124 prompt tokens and took 45.39 seconds. That run peaked at 20.74 GiB. See clean-install evidence. These one-run packaging checks are reported separately from the repeated native/TensorFold performance comparison above. To repeat them after starting the server:
python3 smoke_test.py
The runtime source archive in runtime/ contains the already patched source, its Apache license, third-party notices and bundled-code licenses. To rebuild the wheel, unpack it and run python -m pip wheel --no-deps --no-build-isolation ./tensorfold-0.6.6+compact.vision2 in an environment with setuptools and wheel installed. Do not apply the patch twice. Public source identities and both weight hashes are recorded in release provenance.