/ Модель

Характеристики

Контекст
262 144 токена
Лицензия
Apache 2.0
Архитектура
prism_hadamard_qwen35 · dense
Базовая модель
Ternary-Bonsai-2-4B-mlx-2bit
Опубликована
12 ноя 2026

Ternary-Bonsai-2-4B-MTPLX

Генерация текстаТекст → текст4 профессии

Перепакованная 2-битная мультимодальная модель Prism ML на 4 млрд параметров для диалога и генерации текста с ускорением MTP на Apple Silicon.

273скачиваний за 30 дней0лайковвеса обновлены12 ноя 2026

Бенчмарки

Как модель справилась с задачами пользователей ailist и что о ней публикуют открытые лидерборды

Публичные оценки

Из открытых лидербордов. Сравнивайте результаты одного теста при одинаковых условиях — отсутствие оценки не значит, что модель хуже.

В подключённых источниках результатов для этой модели пока нет.

Что умеет модель

Описание составлено по карточке модели и метаданным Hugging Face

Ternary Bonsai 2 4B MTPLX — перепакованная EngineeringWithJay версия модели Prism ML Ternary-Bonsai-2-4B-mlx-2bit. Это плотная мультимодальная модель семейства prism_hadamard_qwen35 с 2-битным тернарным квантованием основного блока и присоединённой головой MTP для спекулятивного декодирования. Веса основного блока побайтно совпадают с исходным пакетом; изменения касаются упаковки и интерфейса MTPLX.

Модель предназначена для диалога и генерации текста, в том числе с чтением изображений, на устройствах Apple Silicon. Голова MTP позволяет использовать спекулятивное декодирование в MTPLX; автор README сообщает о средней скорости 43,9 токена/с на одном M5 Air с 16 ГБ объединённой памяти на пяти текстовых запросах и 35,9 токена/с при запросе с изображением. Эти замеры относятся к указанной машине и настройке.

Для запуска требуется MTPLX 2.12 или новее и поддержка исправления для связанной проекции выходного слоя; в версии 2.12.3 автору потребовалась отдельная ветка исправления. Обычный mlx-lm этот пакет загрузить не может. Проверено чтение текста и изображений, но поведение с видео и несколькими изображениями не подтверждено. Лицензия — Apache-2.0.

Сценарии применения

  • диалоговая генерация текста на Apple Silicon
  • чтение изображений в диалоговом запросе
  • ускорение генерации текста спекулятивным декодированием MTP

Ограничения

Для запуска нужен MTPLX 2.12+ с исправлением поддержки связанной выходной проекции; обычный mlx-lm не подходит. Проверено чтение текста и изображений, но работа с видео и несколькими изображениями не подтверждена.

Для каких профессий подходит4

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

Ternary Bonsai 2 4B — MTPLX pack (EngineeringWithJay)

Our own repackaging of Prism ML's official Ternary-Bonsai-2-4B-mlx-2bit into the MTPLX pack contract, with Prism's own 4B MTP head attached, so the 4B can be served with native MTP speculative decoding on Apple silicon.

No weight bytes were changed. The trunk is byte-identical to the upstream pack (model.safetensors sha256 432f48d0edcb8da2e6a4e0c960785883…, 1,871,365,704 bytes).

Measured on this machine

One M5 Air (16 GB unified memory), MTPLX 2.12.3, one model resident, thinking disabled:

measurementresult
mean decode over 5 prompts43.9 t/s
fastest prompt64.8 t/s
decode with an image in the prompt35.9 t/s
visionread a real UI viewport screenshot's values correctly (Temperature 0.60, Top P 0.95, Top K 20, MTP on, Draft depth 1, Max tokens 16.4k)

MTP and the tied output projection

Prism ships the 4B with tie_word_embeddings: true and no lm_head tensors: the output projection is the embedding. MTPLX's draft-head builder (draft_lm_head._make_embedding_as_linear_head) only accepted nn.Embedding and nn.QuantizedEmbedding, so it raised TypeError on MTPLX's own HadamardQuantizedEmbedding — and it is hit even with --no-mtp, so a tied pack could not be served at all.

The 4B therefore needs a one-branch patch to MTPLX. It is not a change to this pack:

# mtplx/draft_lm_head.py, in _make_embedding_as_linear_head, before the final raise
    elif hasattr(module, "as_linear"):
        # MTPLX's own HadamardQuantizedEmbedding: a tied Bonsai-2 output
        # projection. It already exposes as_linear(), which rotates the input
        # forward and reuses the stored packed matrix, so the draft head is
        # the target's own tied head, exactly.
        original = _embedding_report(module)
        return _EmbeddingAsLinear(module), {
            "source": "tied_embedding",
            "original": original,
            "draft_only": original,
            "reused_existing_quantization": True,
            "elapsed_s": time.perf_counter() - started,
        }

With that branch the 4B loads with mtp_layers: 1 and tier: verified. The untied 9B and 27B packs need no patch. The same fix is what makes any tied Bonsai-2 size (the 2B) servable at all.

How to serve it

Requires MTPLX 2.12+ with the branch above (or a future release that includes it). Plain mlx-lm cannot load this pack: its model_type is prism_hadamard_qwen35, which carries the Hadamard/sign-flip integration the format needs.

mtplx serve \
  --model /path/to/Ternary-Bonsai-2-4B-MTPLX \
  --port 8003 --cache-dir /path/to/models \
  --reasoning off --allow-swap \
  --mtp --generation-mode mtp \
  --mtp-batch-numerics throughput --draft-core device \
  --scheduler-mode hyper --batching-preset latency \
  --paged-kv-quantization q4 \
  --ssd-session-cache on --ssd-session-cache-dir /path/to/ssd-bank \
  --ssd-session-cache-max-size 30G

On a 16 GB Mac also set:

export MTPLX_MEMORY_LIMIT_BYTES=14495552000
export MTPLX_SESSION_BANK_MAX_BYTES=3221225472

Do not lower the session bank budget to 64 MB. The bank cannot hold one conversation entry below roughly 1 GB, so the prefix is never reused and every turn re-prefills the whole conversation (14.1 s per turn instead of 0.6 s on the same 16K-token workload).

Verify before serving:

mtplx inspect --model /path/to/Ternary-Bonsai-2-4B-MTPLX
# tier: verified | can_run: true | runtime_compatibility: native | mtp_layers: 1

What we changed relative to the upstream pack

Packaging only, all four verified by mtplx inspect:

  1. mtp/model.safetensors moved to mtp.safetensors at the pack root.
  2. Its 31 tensor keys were given the mtp. prefix (fc.weight → mtp.fc.weight); Prism ships them unprefixed for mlx-vlm, MTPLX expects the prefix. Payloads unchanged.
  3. config.json gained mtplx_mtp_contract, mtplx_mtp_quantization (bits 4, group size 64, mode affine, policy all, prequantized true), mlx_lm_extra_tensors {mtp_file}, model_family, and text_config.mtp_num_hidden_layers = 1.
  4. mtplx_runtime.json was written with the keys MTPLX requires (mtplx_version, arch_id, mtp_depth_max, recommended_profile, exactness_baseline, verified_on).

The tensor namespace was already language_model.* + vision_tower.* (matching MTPLX's contract) and components.mtp was set to true to match the sidecar we ship.

Architecture

propertyvalue
familyTernary Bonsai 2 4B (Prism ML), prism_hadamard_qwen35
trunk quantization2-bit ternary, affine, group size 128
hidden size2560
layers32 (8 full-attention, 24 linear-attention / Gated DeltaNet)
attention heads16 attention / 4 key-value, head_dim 256
intermediate size9216
output projectiontied to the embedding (tie_word_embeddings: true)
MTP headqwen3_5_mtp, 4-bit group-64 affine, prequantized, depth 1
context262,144 native
KV per token32 KB bf16 (8 full-attention layers x 2 x 4 heads x 256 dim x 2 bytes)
vision tower24 blocks, hidden 1024

Limitations

  • This is the base model, not a Swift finetune.
  • The MTP head is Prism's own, trained against the Ternary Bonsai 2 trunk. We measured decode rates on this machine but did not publish a separate acceptance-rate table.
  • The MTP draft-head patch above is required on MTPLX 2.12.3.
  • We verified text-image reading, not video or multi-image behaviour.

License and attribution

Apache-2.0. The weights are Prism ML's, redistributed unchanged; our repackaging (README, mtplx_runtime.json, config.json additions, packaging) is also Apache-2.0. See NOTICE.txt for the full attribution chain and LICENSE for the licence text.

Citation

@misc{engineeringwithjay_ternary_bonsai2_4b_mtplx,
  title  = {Ternary Bonsai 2 4B -- MTPLX pack},
  author = {EngineeringWithJay},
  year   = {2026},
  note   = {MTPLX-native repackaging of prism-ml/Ternary-Bonsai-2-4B-mlx-2bit; weight bytes unchanged},
  url    = {https://huggingface.co/EngineeringWithJay/Ternary-Bonsai-2-4B-MTPLX}
}

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм

Нельзя запустить

MLX-модели работают только на Apple Silicon, на GPU NVIDIA они не запускаются.

Ревизия весов
529dab1

0 моделей