mouri45's picture
Upload folder using huggingface_hub
beb359f verified
|
Raw
History Blame Contribute Delete
2.05 kB
---
license: apache-2.0
license_link: https://ai.google.dev/gemma/docs/gemma_4_license
base_model: google/gemma-4-e2b-it
tags:
- mlx
- gemma4
- text-only
language:
- ja
- en
library_name: mlx
pipeline_tag: text-generation
---
# gemma-4-e2b-it-lite-mlx
Text-only, lightweight 4-bit MLX quantization of
[google/gemma-4-e2b-it](https://huggingface.co/google/gemma-4-e2b-it),
optimized for on-device inference on iPhone (8GB devices) and Apple Silicon Macs.
**~2.05 GB** — compared to 3.58 GB for the official
[mlx-community/gemma-4-e2b-it-4bit](https://huggingface.co/mlx-community/gemma-4-e2b-it-4bit)
(which bundles the audio/vision towers in BF16).
## What was changed (modification notice)
- Converted from the original bf16 checkpoint with **mlx-lm 0.31.3** (`mlx_lm.convert`).
- **Text-only**: `audio_tower`, `vision_tower`, `embed_audio`, `embed_vision`,
`multi_modal_projector` weights are not included. This checkpoint works with
text-only Gemma 4 runtimes (e.g. mlx-lm / mlx-swift-lm `MLXLLM`).
- Quantization recipe: **4-bit / group size 64 (affine)** for all layers, except
`embed_tokens_per_layer` (per-layer embeddings, ~1.3 GB at 4-bit) which is
quantized to **2-bit / group size 64**. The per-layer override is recorded in
`config.json` (`quantization` section).
- KV-shared layers (15-34) do not include `k_proj` / `v_proj` / `k_norm`
(same layout as the official MLX conversion).
Japanese smoke tests (greeting / Q&A / no repetition loops) show quality on par
with the official 4-bit conversion on this recipe. A uniform 3-bit recipe of the
same size was clearly worse and was rejected.
## Attribution
Gemma 4 is developed by **Google DeepMind** and released under the
[Apache License 2.0](https://ai.google.dev/gemma/docs/gemma_4_license).
This repository redistributes a quantized derivative under the same license.
## Usage (mlx-lm)
```bash
pip install mlx-lm
mlx_lm.generate --model mouri45/gemma-4-e2b-it-lite-mlx --prompt "こんにちは!"
```
Created as part of the AppleSiliconLLM project (Issue0012).