mlboydaisuke commited on
Commit
a020061
·
verified ·
1 Parent(s): 9b69ddb

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +79 -0
README.md ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ base_model: Qwen/Qwen3-VL-8B-Instruct
4
+ tags:
5
+ - coreai
6
+ - apple
7
+ - macos
8
+ - on-device
9
+ - vision-language
10
+ - vlm
11
+ - qwen3-vl
12
+ ---
13
+
14
+ # Qwen3-VL 8B — Core AI (`.aimodel`)
15
+
16
+ `Qwen/Qwen3-VL-8B-Instruct` converted to Apple **Core AI** (`.aimodel`,
17
+ macOS 27): image+text → text fully on the GPU via Apple's `coreai-pipelined`
18
+ engine, zero custom kernels. The 8B sibling of the
19
+ [Qwen3-VL 2B](https://huggingface.co/mlboydaisuke/Qwen3-VL-2B-CoreAI) port —
20
+ **same recipe**, with one one-line loader change for its **untied** LM head.
21
+
22
+ > **Mac-only.** The 8.7 GB int8hu decoder exceeds the iPhone increased-memory
23
+ > jetsam ceiling (~6.4 GB class). For on-device iPhone use, see the
24
+ > [4B](https://huggingface.co/mlboydaisuke/Qwen3-VL-4B-CoreAI) or
25
+ > [2B](https://huggingface.co/mlboydaisuke/Qwen3-VL-2B-CoreAI) ports.
26
+
27
+ Part of the [CoreAI-Model-Zoo](https://github.com/john-rocky/coreai-model-zoo);
28
+ full card with the conversion design:
29
+ [zoo/qwen3-vl.md](https://github.com/john-rocky/coreai-model-zoo/blob/main/zoo/qwen3-vl.md).
30
+
31
+ ## Measured
32
+
33
+ | platform | prefill tok/s | decode tok/s | numerics |
34
+ |---|---:|---:|---|
35
+ | M4 Max (macOS 27 beta) | **54.4** | **54.3** | torch ladder vs fp32-HF incl. untied head + depth-27 ViT (vision cos 1.0001, 36/36 layers cos 1.000, decode 16/16) + engine ≡ python 24/24 on the 211-tok multimodal prompt |
36
+
37
+ Decode is bandwidth-bound: the 8.7 GB int8hu decoder reads ~8.7 GB/token.
38
+ Vision encode runs once per image. Cold GPU specialization ~16.5 s, warm load
39
+ a few seconds.
40
+
41
+ ## Files
42
+
43
+ | path | what | size |
44
+ |---|---|---:|
45
+ | `gpu-pipelined/qwen3_vl_8b_instruct_decode_int8hu_s1/` | text decoder LanguageBundle (SHIP: int8 per-block-32 body + untied absmax int8 head; tokenizer + metadata included) | 8.7 GB |
46
+ | `gpu-pipelined/qwen3_vl_8b_instruct_vision/` | fixed-grid vision encoder (448×448 → 196 tokens + DeepStack), fp16 | 1.1 GB |
47
+
48
+ ## How it works (short version)
49
+
50
+ The text-only pipelined engine carries the VLM through an id-space trick —
51
+ no engine code changes beyond the published
52
+ [static-inputs patch](https://github.com/john-rocky/coreai-model-zoo/tree/main/apps):
53
+
54
+ - the vision encoder runs once per image; its embeddings ride **4 static
55
+ graph inputs** (rewritable owned `MTLBuffer`s),
56
+ - the prompt's `<|image_pad|>` ids become **extension ids `vocab + slot`**;
57
+ the graph selects text-table vs image-embed rows per token and applies the
58
+ three DeepStack adds the same way,
59
+ - **interleaved M-RoPE is derived in-graph from (ids, position) alone** —
60
+ image tokens self-locate, text tokens use a host-set shift; with zero
61
+ embeds the same bundle is a plain Qwen3 text LLM.
62
+
63
+ The 8B differs from 2B/4B only in configuration: its LM head is **untied**
64
+ (a separate `lm_head.weight`, quantized int8 absmax like the body) and its
65
+ ViT is larger (depth 27, hidden 1152) — both absorbed by the config-driven
66
+ overlay. Numerics are gated the zoo way: fp32-HF oracle → torch ladder
67
+ (36/36 layers) → engine ≡ python 24/24.
68
+
69
+ ## Run it
70
+
71
+ Conversion is reproducible from the zoo:
72
+ `conversion/export_qwen3_vl_pipelined.py int8hu --hf-id Qwen/Qwen3-VL-8B-Instruct`.
73
+ For the run contract (S=1 prefill, `COREAI_CHUNK_THRESHOLD=1`), see
74
+ [knowledge/pipelined-engine.md](https://github.com/john-rocky/coreai-model-zoo/blob/main/knowledge/pipelined-engine.md).
75
+
76
+ ## License
77
+
78
+ Apache-2.0 (inherited from Qwen3-VL-8B-Instruct). Conversion code BSD-3-Clause
79
+ (zoo repo).