Add model card
Browse files
README.md
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
base_model: Qwen/Qwen3.5-4B
|
| 4 |
+
tags:
|
| 5 |
+
- apple
|
| 6 |
+
- coreai
|
| 7 |
+
- aimodel
|
| 8 |
+
- on-device
|
| 9 |
+
- qwen3.5
|
| 10 |
+
pipeline_tag: text-generation
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# Qwen3.5-4B β Apple Core AI (`.aimodel`)
|
| 14 |
+
|
| 15 |
+
Qwen3.5-4B (the 4B member of the GDN hybrid linear-attention family) converted to Apple
|
| 16 |
+
**Core AI** for macOS 27 / iOS 27 (beta), riding Apple's **`coreai-pipelined` GPU engine**
|
| 17 |
+
via the same decode-only loop-free export as the
|
| 18 |
+
[0.8B](https://huggingface.co/mlboydaisuke/qwen3.5-0.8B-CoreAI) and
|
| 19 |
+
[2B](https://huggingface.co/mlboydaisuke/qwen3.5-2B-CoreAI) siblings β async encode,
|
| 20 |
+
on-GPU argmax sampling, on-device KV growth, zero custom kernels.
|
| 21 |
+
|
| 22 |
+
> [!NOTE]
|
| 23 |
+
> **b2-native repo (2026-07-15).** This bundle was exported with `coreai-core 1.0.0b2`
|
| 24 |
+
> and loads on the OS 27 **beta 3** toolchain. Unlike the sibling repos there is no
|
| 25 |
+
> June-era b1 tree here; `gpu-pipelined-b2/` is the only (and canonical) path.
|
| 26 |
+
|
| 27 |
+
## Bundles
|
| 28 |
+
|
| 29 |
+
- **`gpu-pipelined-b2/qwen3_5_4b_decode_int8hu_block32_sym/` β the ship config (~5.4 GB)**:
|
| 30 |
+
transformer int8 linear per-block-32 + **untied 248K-vocab lm_head in per-block-32
|
| 31 |
+
absmax int8** (`int8hu --head-sym`), the same head recipe validated on the 0.8B/2B ports
|
| 32 |
+
(plain absmax `symmetric` β clipping variants flip oracle top-1s; full story in the zoo's
|
| 33 |
+
[pipelined-engine notes](https://github.com/john-rocky/coreai-model-zoo/blob/main/knowledge/pipelined-engine.md)).
|
| 34 |
+
Full LanguageBundle (`metadata.json` + `tokenizer/` + `.aimodel`), `input_ids` STATIC
|
| 35 |
+
`[1,1]` single-step export β `EngineFactory` classifies it dynamic β pipelined engine.
|
| 36 |
+
|
| 37 |
+
## Measured β DeviceMark
|
| 38 |
+
|
| 39 |
+
Quality and speed for exactly these bytes are published on
|
| 40 |
+
**[DeviceMark](https://devicemark.github.io/)**: the full 596-item battery
|
| 41 |
+
(IFEval + MMLU + MATH) with Wilson CIs, retention vs the float baseline, and Mac decode
|
| 42 |
+
speed β see the qwen3.5-4B row, and per-entry gate provenance on the
|
| 43 |
+
[methodology page](https://devicemark.github.io/methodology.html).
|
| 44 |
+
|
| 45 |
+
β οΈ **Reasoning-style budgeting**: this model thinks at length before answering. Give it a
|
| 46 |
+
generous completion budget (DeviceMark evaluates it at **4096 max tokens**; tight caps get
|
| 47 |
+
eaten entirely by the thinking phase and yield empty answers).
|
| 48 |
+
|
| 49 |
+
## Run (macOS)
|
| 50 |
+
|
| 51 |
+
Needs the engine patch stack from the
|
| 52 |
+
[zoo](https://github.com/john-rocky/coreai-model-zoo) (`apps/coreai-shared-product.patch` β
|
| 53 |
+
`apps/coreai-pipelined-extra-states.patch`), then:
|
| 54 |
+
|
| 55 |
+
```bash
|
| 56 |
+
COREAI_CHUNK_THRESHOLD=1 llm-benchmark --model qwen3_5_4b_decode_int8hu_block32_sym -p 128 -g 256 -n 3
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
+
- `COREAI_CHUNK_THRESHOLD=1` **before engine creation** β prefill runs as pipelined S=1
|
| 60 |
+
steps (prompt tok/s β decode tok/s).
|
| 61 |
+
- **Never call `engine.warmup()`** β it warms query length 256 and the static `[1,1]`
|
| 62 |
+
graph rejects it. A 1-token generate after load is the warmup.
|
| 63 |
+
- Benchmark **Release** builds only (Debug measures ~3Γ slow).
|
| 64 |
+
|
| 65 |
+
## iPhone
|
| 66 |
+
|
| 67 |
+
No iPhone bundle is published here: 4B-class graphs exceed on-device GPU specialization
|
| 68 |
+
and need ahead-of-time (h18p) compilation. For phones, use the
|
| 69 |
+
[0.8B](https://huggingface.co/mlboydaisuke/qwen3.5-0.8B-CoreAI) (50+ tok/s in ~1 GB) or
|
| 70 |
+
[2B](https://huggingface.co/mlboydaisuke/qwen3.5-2B-CoreAI) (28β30 tok/s) pipelined bundles.
|
| 71 |
+
|
| 72 |
+
## Reproduce
|
| 73 |
+
|
| 74 |
+
Conversion script (self-contained) + method page in the zoo:
|
| 75 |
+
[`conversion/export_qwen3_5_decode_pipelined.py`](https://github.com/john-rocky/coreai-model-zoo/blob/main/conversion/export_qwen3_5_decode_pipelined.py)
|
| 76 |
+
(`int8hu --head-sym --hf-id Qwen/Qwen3.5-4B`) Β·
|
| 77 |
+
[`knowledge/pipelined-engine.md`](https://github.com/john-rocky/coreai-model-zoo/blob/main/knowledge/pipelined-engine.md)
|