Downloads · 30 days
143
8% of all-time downloads
lube8163/gemma-4-12b-coreml-iphone-practical-chat
gemma-4-12b-coreml-iphone-practical-chat is a any-to-any model from lube8163. Use it for the any-to-any task on the model card, and read the license before you ship it in a product. It is set up for coreml. The card lists the license as apache-2.0.
This repository contains Core ML packages used to run a fully offline text/image/audio chat prototype on an iPhone. The model was converted from google/gemma-4-12B-it-qat-q40-unquantized and split into fixed-shape end…
Downloads · 30 days
143
8% of all-time downloads
All-time downloads
1.9K
Public
Repo size
7.6 GB
Likes
2
Public
Click a slice to open those files.
.bin19.8 GB · 100%
From the Hugging Face model README
This repository contains Core ML packages used to run a fully offline
text/image/audio chat prototype on an iPhone. The model was converted from
google/gemma-4-12B-it-qat-q4_0-unquantized
and split into fixed-shape endpoint, prefill, and per-token decode graphs so it
can run within mobile memory limits.
This is an experimental research release, not a drop-in Transformers model.
The matching SwiftUI application, conversion scripts, and device notes are in
lube8163-lab/llm-smallification.
The prefill and decode packages for the same decoder layer intentionally carry the same quantized weights. Hugging Face Xet can deduplicate the shared chunks. The optional speculative assets preserve target-greedy output: the target verifier, not the drafter, selects every emitted token.
models/
endpoints/
fused/
kv/
kv/
prefill/
decode/
multimodal/
speculative/
drafter/
verify/
SHA256SUMS covers every file in the published Core ML packages. The packages
are distributed as .mlpackage sources; compile them on macOS with
xcrun coremlcompiler compile rather than treating a locally generated
.mlmodelc bundle as the portable release artifact.
Clone the code repository and run:
./scripts/download_hf_gemma4_coreml_models.sh
This downloads only the practical-chat base set by default. To add the speculative verifier, MTP drafter, and selected six-layer fusion:
HF_MODEL_PROFILE=speculative \
./scripts/download_hf_gemma4_coreml_models.sh
The script verifies SHA256SUMS, compiles the selected packages, and stages
the resulting .mlmodelc bundles under the ignored iOS Models directory.
Building the app still requires Xcode, an Apple signing team, and a physical
iPhone with enough free storage.
| Item | Value |
|---|---|
| Devices | iPhone 14 (A15, 6 GB) and iPhone 17 / iPhone18,3 |
| OS | iOS 26.5 |
| Text window | 320-token prefill |
| KV cache | 512 slots, up to 192 generated tokens in the app |
| Decoder quantization | 4-bit palettization, per-grouped-channel group 16 |
| Endpoint quantization | int4-block embeddings, pal4 norm/lm_head |
| Speculative width | 4 rows: current token plus up to 3 drafts |
| Compute plan | Device-specific ANE / CPU+GPU routing; selected fused group on CPU+GPU |
| iPhone 14 high-acceptance probe | 4.93 to 2.06 seconds/token (2.40x) |
| iPhone 17, selected fused run | 24 tokens / 37.56 seconds = 0.639 token/s |
The matching application has produced meaningful Japanese text, image descriptions, and a short answer to an English spoken question entirely offline. Device behavior depends strongly on iPhone generation, available memory, prompt-dependent draft acceptance, iOS/Core ML version, and first-run compilation state. The 2.40x result is a selected high-acceptance 8-token probe, not a universal throughput claim; a 24-token low-acceptance prompt improved only from 4.20 to 4.12 seconds/token.
google/gemma-4-12B-it-qat-q4_0-unquantizedgoogle/gemma-4-12B-it-assistant58540658b6c08edab2ddc1fbde7f28cc9987ced3https://github.com/lube8163-lab/llm-smallificationThe upstream repository's later commit
a89c069a80c767b0d378c4806b2953ae9d2c711d updates its documentation; the
published weight file remains associated with the revision listed above.
The converted model artifacts are derived from Gemma 4 and are distributed
under the Apache License 2.0. See LICENSE and NOTICE.md. The files have been
modified through graph decomposition, fixed-shape tracing, precision changes,
and weight compression for Core ML. Apple, Core ML, iPhone, and Xcode are
trademarks of Apple Inc.; this project is not affiliated with Apple or Google.