Add model card
Browse files
README.md
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: other
|
| 3 |
+
license_name: youtu-llm
|
| 4 |
+
license_link: https://huggingface.co/tencent/Youtu-LLM-2B/blob/main/LICENSE
|
| 5 |
+
base_model: tencent/Youtu-LLM-2B
|
| 6 |
+
tags:
|
| 7 |
+
- apple
|
| 8 |
+
- coreai
|
| 9 |
+
- aimodel
|
| 10 |
+
- on-device
|
| 11 |
+
- mla
|
| 12 |
+
- youtu
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
# Youtu-LLM-2B — Apple Core AI (`.aimodel`)
|
| 16 |
+
|
| 17 |
+
[Youtu-LLM-2B](https://huggingface.co/tencent/Youtu-LLM-2B) (Tencent) converted to Apple
|
| 18 |
+
**Core AI** for iOS 27 / macOS 27 (beta) — the **[zoo](https://github.com/john-rocky/coreai-model-zoo)'s
|
| 19 |
+
first Multi-head Latent Attention (MLA) model that runs on iPhone**, and its first **dense**
|
| 20 |
+
MLA (GLM-4.7-Flash brought MLA to the zoo but as a 30B Mac-only MoE).
|
| 21 |
+
|
| 22 |
+
Youtu-LLM-2B is a **dense DeepSeek-V2/V3-style MLA** decoder: 1.96B params, 32 layers,
|
| 23 |
+
`kv_lora_rank` 512 · `q_lora_rank` 1536 · `qk_nope` 128 + decoupled `qk_rope` 64 (head_dim
|
| 24 |
+
192) · `v_head_dim` 128 · interleaved RoPE θ=1.6e6 · dense SwiGLU FFN (6144) · 128K context ·
|
| 25 |
+
weight-tied head · Llama-3 tokenizer. It has a **reasoning ("thinking") mode** (`<think>…</think>`)
|
| 26 |
+
and native agentic/tool-use ability.
|
| 27 |
+
|
| 28 |
+
The MLA decode caches only the **compressed latent** (`[512]` + `[64]` rope key per token,
|
| 29 |
+
2×`[288]` halves) instead of a full per-head K/V, and folds the KV up-projection into the
|
| 30 |
+
query lift / value readout — a tiny KV cache that a custom **absorbed-MLA flash-decode Metal
|
| 31 |
+
kernel** attends. Rides Apple's **`coreai-pipelined` GPU engine** via the decode-only loop-free
|
| 32 |
+
export (async encode, on-GPU argmax sampling, on-device KV growth).
|
| 33 |
+
|
| 34 |
+
| surface (int8 ship bundle) | prefill (S=1) | decode | numerics |
|
| 35 |
+
|---|---:|---:|---|
|
| 36 |
+
| **M4 Max** (release `llm-runner`, greedy) | 95.9 | **102.8 tok/s** | 16/16 top-1 = HF fp32 oracle |
|
| 37 |
+
| **iPhone 17 Pro** (PipelinedBench p=128 g=256; in-app warm ~24) | 20.5 | **~19 tok/s** | **16/16 · device ≡ Mac ≡ HF** |
|
| 38 |
+
|
| 39 |
+
Numerics: the authored Core AI model is **token-exact to the fp32 HF reference** (naive +
|
| 40 |
+
absorbed forms, prefill cosine 1.000002, greedy 0 flips), and the int8 bundle running on the
|
| 41 |
+
real GPU engine reproduces the oracle **byte-for-byte, 16/16 on both prompts, on Mac and on the
|
| 42 |
+
iPhone 17 Pro** — the [zoo](https://github.com/john-rocky/coreai-model-zoo) ship gate.
|
| 43 |
+
|
| 44 |
+
## Use it
|
| 45 |
+
|
| 46 |
+
This bundle runs in **[CoreAIChat](https://github.com/john-rocky/coreai-model-zoo/tree/main/apps/CoreAIChat)**
|
| 47 |
+
(the zoo's on-device chat app): pick **Youtu-LLM 2B** in the model picker; the app downloads
|
| 48 |
+
`gpu-pipelined/youtu_llm_2b_decode_absorbed_msdpa/` from this repo into `Documents/models/` on
|
| 49 |
+
first run, then loads from the local cache. 2B (≥2 GB) bundles need the app's
|
| 50 |
+
`com.apple.developer.kernel.increased-memory-limit` entitlement (CoreAIChat ships it).
|
| 51 |
+
|
| 52 |
+
Engine contract (decode-only static-`[1,1]` graph): set `COREAI_CHUNK_THRESHOLD=1` before engine
|
| 53 |
+
creation (prefill runs as pipelined S=1 steps); don't call `engine.warmup()` (it warms query
|
| 54 |
+
length 256) — a 1-token generate after load is the warmup. Chat template:
|
| 55 |
+
`<|begin_of_text|><|User|>…<|Assistant|>` (thinking mode on → `<think>…</think>` then the answer).
|
| 56 |
+
|
| 57 |
+
## Contents
|
| 58 |
+
|
| 59 |
+
- `gpu-pipelined/youtu_llm_2b_decode_absorbed_msdpa/` — the int8 per-block-32 (body + head)
|
| 60 |
+
decode bundle with the absorbed-MLA flash-decode Metal kernel: `metadata.json`, the
|
| 61 |
+
`.aimodel` (LanguageBundle), and the tokenizer. ~2.2 GB.
|
| 62 |
+
- `config.json` — the source model config (for reference).
|
| 63 |
+
|
| 64 |
+
Conversion code and the full engineering notes live in the
|
| 65 |
+
[model zoo](https://github.com/john-rocky/coreai-model-zoo) (`conversion/export_youtu_decode_pipelined.py`,
|
| 66 |
+
`models/macos/youtu.py` + `youtu_absorbed.py`; the absorbed-MLA cache + flash-decode kernel are
|
| 67 |
+
shared with GLM-4.7-Flash).
|
| 68 |
+
|
| 69 |
+
## License
|
| 70 |
+
|
| 71 |
+
Weights follow Tencent's **`youtu-llm`** license (see `license_link`) — commercial use and
|
| 72 |
+
redistribution of derivatives permitted with attribution; **⚠️ the license states Youtu-LLM is
|
| 73 |
+
NOT intended for use within the European Union.** The Core AI conversion adds no restrictions.
|