ternzip-27b / README.md
optimatechlabs's picture
Release verified 27B all-RAM runtime and Metal replay results
06de7c7 verified
|
Raw History Blame Contribute Delete
10.4 kB
metadata
license: apache-2.0
base_model: prism-ml/Ternary-Bonsai-2-27B-gguf
base_model_relation: quantized
pipeline_tag: text-generation
tags:
  - ternary
  - bonsai
  - prism-ml
  - qwen35
  - 1.58-bit
  - compression
  - lossless-compression
  - apple-silicon

Ternzip for Ternary Bonsai 2 27B

Three Apple silicon builds use the same 5.512 GB model archive. Download the weights once, then choose the runtime for your task.

Build Use it for Runtime download
All-RAM chat runtime Chat from the archive with all weights in RAM. Two clean runs matched stock on 32/32 chats each at 6.083 GB peak inference memory. Apple silicon runtime · 29.6 MB
Earlier low-memory prototype Run the 32-chat inference benchmark. Peak inference memory was 5.993 GB, down from 7.647 GB for stock Prism PQ2_0 on the same chats. Low-memory runtime and benchmark pack · 29.8 MB
Original v0.4.0 Chat with your own prompt or restore any of Prism’s three published language GGUFs byte for byte. Restore and chat tools · 26.9 MB

All-RAM chat on Apple silicon

On a 48 GB M4 Pro running macOS 26.5, this runtime used 20.4% less peak inference memory than stock PQ2_0. The compute weights and input embeddings stay in RAM. This build uses FP32 recurrent state and runs the sign multiply and Hadamard transform as separate Metal operations, including the SwiGLU variant.

32 scored chats per run Peak inference RAM Median tokens/s Slowest chat, tokens/s Exact chats
Stock PQ2_0 reference 7.645 GB 20.433 19.934 32/32
Clean extraction 1 6.083 GB 18.311 18.246 32/32
Clean extraction 2 6.083 GB 18.318 18.273 32/32

Each run matched the saved stock output and the pinned reference on all 3,746 generated token IDs, all 32 following-token decisions and all 32 decoded texts. Peak memory includes prefill and generation. Speed excludes prefill and warm-up. Both runs used independent extractions of the same archive.

Metal replay. The earlier build picked a different token twice on the reasoning and editing prefix test. The new build matched all 648 decisions and repeated every score-vector fingerprint. We also replayed the original 110-decision explanation prefix 20 times, with FP32 recurrent state in both configurations. With the sign multiply and Hadamard transform fused, 0/2,200 score vectors differed from the most frequent fingerprint at the same position, with 0 greedy decisions differing from stock. With the operations separated, those counts were 0/2,200 and 0. Both FP32 configurations repeated every score fingerprint and matched stock throughout this replay. The contribution of the fused transform to the earlier drift remains unresolved. These measurements used the same instrumented runner on the same Mac. Benchmark receipts and replay audit

Download. Use the existing 5.512 GB model archive with this 29.6 MB runtime. Runtime SHA-256 is 03028041b53807b8555305bf8b025bc56aeffdae6a065296388d2e7f25364ecf. Download the checksum file alongside the runtime.

shasum -a 256 -c SHA256SUMS-separate-fwht.txt
tar -xzf ternzip-27b-all-ram-separate-fwht-macos-arm64.tar.gz
cd ternzip-27b-all-ram-separate-fwht-macos-arm64
./run chat /path/to/ternzip-27b-final.trits 'What is 17 times 6?'
./run benchmark /path/to/ternzip-27b-final.trits run-1.json

First launch on macOS. The runtime is not Apple-notarized. If Gatekeeper blocks a downloaded executable, verify the archive checksum, then use System Settings → Privacy & Security → Open Anyway for that executable and run the command again. Apple’s first-launch instructions

Run the 27B low-memory prototype on Apple silicon

On one 48 GB M4 Pro running macOS 26.5, the prototype used 21.6% less peak inference memory than stock Prism PQ2_0. Median generation was 18.26–18.35 tokens/s for the prototype and 20.56 tokens/s for stock. Loading the prototype peaked at approximately 6.07 GB.

Same-session run, 32 chats each Peak inference Peak loading Median generation Exact chats vs. stock
Prototype, first run 5.993 GB 6.063 GB 18.26 tokens/s 30/32
Stock Prism PQ2_0 7.647 GB 7.449 GB 20.56 tokens/s Reference
Prototype, second run 5.993 GB 6.065 GB 18.35 tokens/s 31/32

Across both prototype runs, 62/64 response texts matched stock. 61/64 chats also matched every emitted token and the next-token decision. Memory is sampled process footprint in decimal GB. Generation timing excludes prompt processing.

Audit the published results. Extract the benchmark pack, enter its directory, and run python3 audit.py. It recomputes the figures from the included logs without downloading the weights.

Run the comparison on your Mac. Supply the shared Ternzip archive, Prism’s PQ2_0 GGUF, and a new results directory. From the extracted benchmark pack, run:

sh reproduce.sh /path/to/ternzip-27b-final.trits /path/to/Ternary-Bonsai-2-27B-PQ2_0.gguf ./fresh-results

The public pack’s audit reproduced the published figures.

Original v0.4.0 restore and chat

Place the shared model archive, the v0.4.0 Mac tools, and the release checksums in the same directory. Verify and unpack the tools once:

shasum -a 256 -c SHA256SUMS
tar -xzf ternzip-27b-tools-macos-arm64.tar.gz

Chat directly from the archive:

./ternzip-27b-macos-arm64/ternzip-27b chat ternzip-27b-final.trits "What is 17 times 6? Reply with only the number."

Restore a GGUF:

./ternzip-27b-macos-arm64/ternzip-27b restore ternzip-27b-final.trits my-27b-PTQ1_0.gguf

The default output is PTQ1_0. Add --format PQ2_0 for Prism’s Apple execution layout or --format Q2_0 for stock llama.cpp b11556 or newer. The tools also support chat from a restored PQ2_0 file. Full v0.4.0 release

Original build benchmarks

This separate test covered startup and chat on a 48 GB M4 Pro with both inputs on the same external drive. Each path ran eight prompts three times with a 1,024-token context and a 128-token output cap.

Input Median generation Warm startup Peak across startup and chat
Ternzip archive 20.13 tokens/s 58.74 s 8.52–8.54 GB
Restored Prism PQ2_0 19.87 tokens/s 1.50 s 8.04 GB

All 3,021 generated token IDs and all 24 following decisions matched. Both paths loaded 7,195,047,936 bytes of weight tensors. We recommend at least 16 GB unified memory for original-build archive chat. Testing used the 48 GB Mac. On an internal SSD, median archive startup was 57.66 s across three starts after a full-file hash, including 56.20 s unpacking and 0.40 s reading.

Archive size and restore accuracy

The 5,512,286,013-byte archive restores PTQ1_0, PQ2_0 and Q2_0. Each output matched Prism’s published SHA-256. Stored separately, the three files total 20.779 GB. Storing the archive saves 15.267 GB (73.47%) before filesystem deduplication. For one layout, savings are 7.30% against PTQ1_0, 23.51% against PQ2_0 and 27.72% against Q2_0. The archive plus the original Mac tools totals 5,539,146,942 bytes. Prism supplies the optional vision projector separately.

The encoder exploits a property of these weights. In 97.27% of the ternary blocks, exactly 42 of 128 weights are zero. Using the zero count during encoding saved 86,002,538 bytes in a full-file comparison.

Stock Prism Metal reproducer

This standalone diagnostic needs Prism’s PQ2_0 file and the Metal reproducer · 2.32 MB. It uses unmodified Prism runtime libraries from commit a153697. From the extracted reproducer directory, run:

./run /path/to/Ternary-Bonsai-2-27B-PQ2_0.gguf 20

At identical prefixes on the same M4 Pro, default Metal fusion produced 5 changed score vectors in 2,200 decisions in one run and 4 in 2,200 in another. One change flipped the greedy token. With GGML_METAL_FUSION_DISABLE=1, the two runs recorded 0 in 4,400. The operation responsible remains unknown.

The public archives matched the published hashes. Checksums for the benchmark pack and Metal reproducer

Credits and citation

Created using Bonsai by Prism ML. Prism derived the model from Qwen/Qwen3.8-27B and identifies the GGUF architecture as qwen35. OptimaTech Labs independently modified the storage format. Apache 2.0 applies, with Prism and Qwen/Alibaba notices included. Prism’s original release

Prism requests the following citation for the underlying model. Prism’s citation

@techreport{bonsai2_27b,
    title   = {Bonsai 2 27B: A 27B Ternary Reasoning Model},
    author  = {Prism ML},
    year    = {2026},
    month   = {September},
    url     = {https://prismml.com}
}