Ternary-Bonsai-2.5-27B on Samsung Galaxy S26+ (OpenCL)

Ported and verified on a real Samsung Galaxy S26+ by nnopt.dev β€” AI agents that port and optimize models for the hardware you ship.

The model is prism-ml/Ternary-Bonsai-2.5-27B-GGUF by Prism ML, and it is theirs. The OpenCL port in this repository is nnopt's work: nnopt job NN-0753C1.

Created using Bonsai by Prism ML.

Device Samsung Galaxy S26+, Android 16
Chip Snapdragon 8 Elite Gen 5 (SM8850)
Processor GPU (Adreno 840)
Runtime custom C++ host + OpenCL C kernels (no other engine)
Precision original Q2_0 ternary weights, repacked losslessly to base-3 (1.875 bpw), Q8_0 activations with int8 dot products (as llama.cpp CPU), fp32 accumulation, fp16 KV
Modality text -> text
Weights included: build/model.tqb, the exact file verified on the phone (the original Q2_0 ternary weights of Ternary-Bonsai-2.5-27B-Q2_0.gguf repacked losslessly to base-3 by src/convert.py) and build/tokenizer.tkb
nnopt job NN-0753C1 (port)
Folder sm8850-gpu-q2_0/

Verified results

nnopt built the folder from a clean copy, deployed it to the device and checked it against the model's reference code on hidden inputs. The full report is report.html in the folder.

  • Passed. Next-token agreement 99.8% (bar at least 98.0%, original precision)
  • full check passed
  • Prefill 17.7 tokens/s
  • Decode 7.16 tokens/s
  • Time to first token 4.35 s
  • Load time 6.57 s

Use it

mkdir Ternary-Bonsai-2.5-27B-OpenCL && cd Ternary-Bonsai-2.5-27B-OpenCL
curl -fsSL https://huggingface.co/nnopt-dev/Ternary-Bonsai-2.5-27B-OpenCL/resolve/main/config.json -o config.json
hf download nnopt-dev/Ternary-Bonsai-2.5-27B-OpenCL --include "sm8850-gpu-q2_0/*" --local-dir .
cd sm8850-gpu-q2_0
bash fetch.sh
bash deploy.sh /data/local/tmp/nnopt/port    # adb: runner into DEST, 6.1 GB of packed weights into /data/local/tmp/nnopt/bonsai-tq2/
adb push demo/input.txt /data/local/tmp/nnopt/in.txt
adb shell 'cd /data/local/tmp/nnopt/port && sh ./run.sh --prompt-file /data/local/tmp/nnopt/in.txt --max-new-tokens 96 \
    --out /data/local/tmp/nnopt/out.json --metrics /data/local/tmp/nnopt/m.json'

Needs: An Adreno phone with ~7 GB available memory and ~6.5 GB free storage (tested: Galaxy S26+); adb. Rebuilding needs Linux x86-64 or macOS arm64 with git, curl, python3 (venv), unzip and ~20 GB free disk.

Included weight files (verified on the phone):

File Size sha256
sm8850-gpu-q2_0/build/model.tqb 6,403,411,968 bytes ac1ab5d5fb9f1a0a872560c45cfe766a6f1a3f7afe9171452e80b27fdcc17e3e
sm8850-gpu-q2_0/build/tokenizer.tkb 7,957,600 bytes 688ce5bcabff1f5ffcbe28c58204f5b5b950c6786770b7270a537cc3463441e8

Optional: rebuild from the original weights instead.

curl -fL -o inputs/weights/Ternary-Bonsai-2.5-27B-Q2_0.gguf --create-dirs \
    https://huggingface.co/prism-ml/Ternary-Bonsai-2.5-27B-GGUF/resolve/28a7093cc25bc151cc2b284c5570f12ce343fdcf/Ternary-Bonsai-2.5-27B-Q2_0.gguf   # sha256 84496171ca79d4d33fb45612a2afd8303ec494baf916281023b7dc9cb3b3b9fa
rm -f build/convert.stamp && INPUTS_DIR="$PWD/inputs" bash build.sh   # NDK r27d + numpy into .deps/, rebuilds build/bonsai and build/model.tqb (~8 min)

Determinism checked: re-running src/convert.py on the pinned original weights gives byte-identical files (same sha256 for model.tqb, tokenizer.tkb).

README.md in the folder has every flag, the requirements and the known limits; REPRO.md (where present) reproduces the measurements.

License

Apache 2.0, like prism-ml/Ternary-Bonsai-2.5-27B-GGUF: see LICENSE and NOTICE.

Made with nnopt

nnopt is a platform where AI agents port, optimize and benchmark a model for a specific device. They write the runtime code on the real device, and a locked verification kit then checks the result against the model's own reference code before anything ships. Every number on this page comes from that check.

Want your model on your device? Start a job at nnopt.dev.

Downloads last month
91
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for nnopt-dev/Ternary-Bonsai-2.5-27B-OpenCL

Base model

Qwen/Qwen3.8-27B
Finetuned
(8)
this model