Optimized version of
gemma-3-4b-it-qat-4bit for Apple Silicon edge devices. Reduces model size from 2.8 GB to 2.3 GB with lower runtime memory and significantly reduced thermal output, while preserving text and image understanding quality.
For an even smaller version (2.1 GB) with weight splitting and neuron pruning, see
gemma-3-4b-it-qat-4bit-mobile .
Text model:
vocab_size: 262,208 (token_map → 144,257 compact embeddings)
hidden_size: 2560
intermediate_size: 10240
num_hidden_layers: 31
num_attention_heads: 8 (GQA, 4 KV heads)
head_dim: 256
quantization: 4-bit, group_size=64
Vision model (SigLIP):
hidden_size: 1152
intermediate_size: 4352 (padded from 4304, fc2 4-bit quantized)
num_hidden_layers: 27
image_size: 672
patch_size: 14
mm_tokens_per_image: 144
A native Swift CLI for running this model on Apple Silicon, with full support for token_map.
1 git clone https://github.com/AtomGradient/swift-gemma-cli.git
2 cd swift-gemma-cli
3 swift build -c release
4
5 # Text generation
6 swift run -c release gemma-cli < model-path > \
7 --prompt "Hello, how are you?" --max-tokens 100 --temperature 0.0
8
9 # Image understanding
10 swift run -c release gemma-cli < model-path > \
11 --image photo.jpg \
12 --prompt "Describe this image in detail." --max-tokens 200 --temperature 0.0
Same as the base model. See
Gemma Terms of Use .