Skip to content

Commit 5f537dd

Browse files
committed
Benchmarking
1 parent 893de1a commit 5f537dd

1 file changed

Lines changed: 57 additions & 0 deletions

File tree

models/gemma4/BENCHMARKS.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Gemma 4 VLM — Core AI benchmarks (Apple silicon, GPU)
2+
3+
Prefill / decode throughput for the exported Gemma 4 vision-language bundles
4+
(`embed` + `main` + `vision`), measured on-device via `llm-runner`.
5+
6+
## Setup
7+
8+
- **Device:** Apple M5 Max, 128 GB unified memory (macOS).
9+
- **Weights:** 4-bit (uint4, asymmetric, group size 32), int8 externalized PLE, bf16 compute / bf16 KV cache.
10+
- **Sampling:** greedy.
11+
- **Input:** a 768×768 image (256 vision soft-tokens) plus a text prompt of the listed length.
12+
- **State:** warm — the Core AI specialization cache is populated from a prior run (cold model-load times listed separately).
13+
14+
### Methodology note
15+
16+
These are **single-pass** `llm-runner` timings (one prefill + one decode run), not
17+
averaged trials from the `llm-benchmark` harness. The benchmark harness is
18+
text-only today and cannot drive the VLM `main` graph (which takes
19+
`inputs_embeds`, not `input_ids`), so VLM numbers come from the runner's own
20+
`PerformanceMetrics`. Treat them as representative, not as averaged benchmark
21+
results.
22+
23+
**Prefill throughput is strongly prompt-length dependent.** At very short prompts
24+
the measurement is dominated by the one-time vision-encoder pass and first-token
25+
overhead, so prefill tok/s looks low; it rises steeply once the prompt is long
26+
enough to amortize that fixed cost.
27+
28+
## Gemma 4 E2B VLM
29+
30+
| Prompt tokens | Prefill (tok/s) | Decode (tok/s) |
31+
| ---: | ---: | ---: |
32+
| 270 | 62.9 | — (cold) |
33+
| 991 | 308.7 | 63.8 |
34+
| 4,467 | 4,234 | ~56 |
35+
| 14,267 | 5,289 | ~26 |
36+
| 22,141 | 4,652 | ~39 |
37+
38+
- Cold model load ≈ 6.7 s; warm load ≈ 1.1 s.
39+
40+
## Gemma 4 26B-A4B VLM (MoE)
41+
42+
| Prompt tokens | Prefill (tok/s) | Decode (tok/s) |
43+
| ---: | ---: | ---: |
44+
| 272 | 44.9 | — (cold) |
45+
| 4,467 | 1,006 | ~33 |
46+
| 14,267 | 2,030 | ~37 |
47+
| 22,141 | 2,188 | ~36 |
48+
49+
- Cold model load ≈ 18 s (18 GB bundle).
50+
51+
## Notes
52+
53+
- Decode was measured with short generation lengths (8–32 tokens) and is
54+
approximate; the short-generation samples are noisy.
55+
- The 26B model is a Mixture-of-Experts (A4B ≈ ~4B active parameters), which is
56+
why its decode is only modestly slower than E2B despite the much larger weight
57+
footprint, while its prefill (compute-bound) is roughly 2–2.5× slower.

0 commit comments

Comments
 (0)