Repository navigation
Description
Proposal
Publish a small, versioned set of Gemma conformance test vectors that downstream implementations can run to verify behavioral compatibility with the DeepMind reference implementation.
The fixtures would be compact reference cases covering semantics that are easy to implement almost correctly but still diverge in hard-to-diagnose ways.
A first version could cover:
- tokenizer input/output IDs;
- attention masks and positions;
- prefill logits for fixed inputs;
- incremental decode steps, including KV-cache positions and expected logits;
- multimodal preprocessing where applicable;
- DiffusionGemma denoising/self-conditioning state for a few fixed steps and masks.
Each fixture could contain the model/config identifier, small inputs, selected intermediate metadata, and reference outputs with documented numerical tolerances. The harness would load the normal published checkpoint rather than storing model weights in the repository.
Motivation
Gemma is implemented and served through multiple ecosystems. When implementations disagree, it is often unclear whether the difference comes from tokenization, masking, positions, cache indexing, diffusion state handling, or ordinary numerical tolerance.
A first-party conformance suite would give implementers a precise compatibility target and make regressions easier to localize.
Possible structure
conformance/
gemma3/
tokenizer.json
prefill.json
decode_step.json
diffusion_gemma/
denoise_step_0.json
denoise_step_1.json
selected_canvas.json
with a small runner such as:
python -m gemma.conformance --model gemma3 --checkpoint /path/to/checkpointThe runner would report each semantic boundary separately rather than only comparing a final generated string.
Scope
I would keep the first contribution deliberately narrow:
- define a versioned fixture schema;
- add a runner for the existing reference implementation;
- publish a handful of deterministic Gemma/DiffusionGemma vectors;
- document tolerance rules for external implementations;
- add CI coverage ensuring the reference implementation continues to reproduce them.
No external framework dependency would be required.
I searched current issues and PRs for conformance vectors, golden fixtures, implementation parity, and reference logits and did not find an equivalent proposal.
If this direction is useful, I would be happy to prototype the fixture format, runner, tests, and an initial set of vectors.
Activity
Bhupendra-glitch commentedon Nov 22, 2026
Hi @sylvesterkaczmarek @i reviewed issue #786 and PR #797. I would like to contribute to the next stage of the Gemma conformance suite, particularly KV-cache incremental decoding and attention mask/position validation.
I will first inspect the existing implementation and tests to avoid duplicating the tokenizer work in PR #797.
Would this be a useful direction for a separate contribution? I'd be happy to work on it.
sylvesterkaczmarek commentedon Nov 22, 2026
Thanks @Bhupendra-glitch, yes, that would be a useful next slice from my perspective, subject to the maintainers' review. #797 only covers Gemma 2 tokenizer vectors, so KV-cache incremental decoding and attention mask/position semantics would be separate. I'd start with one small, deterministic Gemma 2 example comparing prefill with stepwise decode, recording token IDs, cache positions, masks and selected logits with explicit tolerances. A focused PR with a reference-output generator and a failing-on-mismatch test would be more useful than a large fixture catalogue. Please avoid copying model weights into the repo. Happy to coordinate on the fixture schema here to keep the contributions compatible.