Core AI model zoo

Youtu-LLM-2B (dense MLA) — Core AI

The zoo’s first Multi-head Latent Attention (MLA) model on iPhone, and its first dense MLA. GLM-4.7-Flash brought the DeepSeek MLA family to the zoo, but as a 30B Mac-only MoE; Youtu-LLM-2B is the same attention at 1.96B dense, so the whole model — with a tiny latent KV cache — fits on an iPhone. Source: tencent/Youtu-LLM-2B (youtu-llm license, model_type youtu).

Architecturally this is dense DeepSeek-V2/V3 MLA on every layer + a plain SwiGLU FFN (the difference from GLM-4.7-Flash is MoE→dense MLP and a weight-tied head):

1.96B params, dense → int8 body + int8 head is ~2.2 GB, well inside the iPhone budget.

⬇️ Converted .aimodel bundle: gpu-pipelined/youtu_llm_2b_decode_absorbed_msdpa/ on 🤗 mlboydaisuke/Youtu-LLM-2B-CoreAI (2.2 GB int8, full LanguageBundle incl. tokenizer; decode-only loop-free for the pipelined engine). Convert with conversion/export_youtu_decode_pipelined.py.

Use it

💻 Build with itCoreAIKit (SPM), one line:

import CoreAIKit

let chat = try await ChatSession(catalog: "youtu-llm-2b")
let reply = try await chat.respond(to: "What can you do, offline?")
// downloads once, runs fully on-device; the <think> reasoning arrives as .thinking events,
// reply.content is the final answer

Also runs behind Apple’s FoundationModels API — CoreAIKit’s KitLanguageModel plugs this bundle into the system LanguageModelSession; capabilities (tool calling, guided generation) auto-detect per model.

▶️ Run it (source) — the ChatDemo runner (pick “Youtu-LLM 2B”), or the zoo’s own CoreAIChat on-device app. Verified on Mac via swift run chat-cli --model youtu-llm-2b“The capital of France is Paris.”

The bundle is a standard decode-only LanguageBundle on Apple’s coreai-pipelined GPU engine (COREAI_CHUNK_THRESHOLD=1, never engine.warmup()), chat-templated <|begin_of_text|><|User|>…<|Assistant|>.

Measured (release engine, COREAI_CHUNK_THRESHOLD=1)

surface prefill (S=1) decode numerics
M4 Max (llm-runner, greedy, split_g=8) 95.9 102.8 tok/s 16/16 top-1 = HF fp32 oracle
iPhone 17 Pro (PipelinedBench, p=128 g=256) 20.5 ~19 tok/s (in-app warm ~24) 16/16 · device ≡ Mac ≡ HF

engine ready 38.5 s cold on the iPhone (2.2 GB spec); the custom absorbed-MLA Metal kernel lowers on the A19 GPU (JIT cold-spec, no AOT needed on this path).

Numerics

Notes

How to reproduce

cd coreai-models   # with the youtu model overlay (see ../conversion)
# convert (int8 body + int8 head, absorbed-MLA flash-decode kernel; ~2.2 GB bundle)
.venv/bin/python ../coreai-models-community/conversion/export_youtu_decode_pipelined.py \
    --hf-id tencent/Youtu-LLM-2B --split-g 8
# bench (pipelined engine)
COREAI_CHUNK_THRESHOLD=1 .build/release/llm-runner \
    --model exports/youtu_llm_2b_decode_absorbed_msdpa \
    --raw-tokens rawtok.json --apply-chat-template false --sampling-strategy greedy \
    --max-tokens 16 --warmup exact --warmup-length 1

Model overlay: models/macos/youtu.py (naive dense-MLA + loader) + youtu_absorbed.py (absorbed decode, reusing glm4_moe_lite_absorbed). Decode-only loop-free for the pipelined engine. Full port notes (reuse, gates, int4 cliff, split_g non-lever, chat template): knowledge/youtu-mla-port.md.