Gemma-3-270M pruned for caveman English (m = 1)
Gemma is provided under and subject to the Gemma Terms of Use found at ai.google.dev/gemma/terms. This model is a Model Derivative of
google/gemma-3-270m. Its use is subject to the use restrictions in Section 3.2 of the Gemma Terms of Use, including the Gemma Prohibited Use Policy. By using or redistributing this model you agree to those terms and must pass these restrictions on to anyone you distribute it to. Copies:GEMMA_TERMS_OF_USE.md,GEMMA_PROHIBITED_USE_POLICY.md,NOTICE.
google/gemma-3-270m with its tokenizer and (tied) embedding matrix pruned to the tokens that caveman English uses.
Caveman English is a closed-vocabulary register of English: 961 lowercase base-form words, frequent names Capitalized,
digits and . , ? ! — e.g. "mammoth be big animal with long hair." Gemma's embedding is 63% of its weights, so the
model shrinks by more than half.
| original | pruned | |
|---|---|---|
| vocabulary | 262,144 (+1 added outside) | 12,162 (+1) |
| parameters | 268.1 M | 108.1 M (−59.7%) |
| bf16 checkpoint | 536 MB | 218 MB |
| held-out caveman bits per byte | 1.5285 | 1.4919 |
| ordinary English bits per byte | 1.166 | 2.773 |
How it was pruned. Kept: every token that occurs at least once in a 9.2 MB caveman corpus (English Wikipedia rewritten
by claude-haiku-5-5), the 256 <0xNN> byte-fallback tokens (so any text still round-trips), the 7 special and 166
whitespace added tokens, and the closure over all BPE merges that produce a kept token (Gemma has duplicate merge
results). The 6,242 <unusedN> placeholder tokens were dropped. Ids are renumbered contiguously and the embedding rows
are sliced by index (no retraining); the train corpus is tokenized exactly as by the original tokenizer. Text outside
the domain is split into many more tokens and modelled much worse; the lower bits per byte on caveman text comes from
renormalising the softmax over fewer tokens, not from a better model.
Modified files (relative to google/gemma-3-270m):
model.safetensors— embedding / tied output matrix reduced from 262,144 to 12,224 rows (12,163 used + padding to a multiple of 64); all other weights unchanged.config.json—vocab_sizechanged to 12,224; special-token ids remapped.generation_config.json— special-token ids remapped.tokenizer.json,tokenizer_config.json— vocabulary, merges and added tokens pruned and renumbered.
from transformers import AutoModelForCausalLM, AutoTokenizer
repo = "miilg/gemma-3-270m-caveman"
tok = AutoTokenizer.from_pretrained(repo)
model = AutoModelForCausalLM.from_pretrained(repo, dtype="bfloat16")
x = tok("mammoth be big animal with long hair. people", return_tensors="pt")
print(tok.decode(model.generate(**x, max_new_tokens=30, do_sample=False)[0], skip_special_tokens=True))
Note: the base model often emits <start_of_image> as a separator in free generation; Google's tokenizer marks that
token as non-special, so skip_special_tokens=True keeps it (the original google/gemma-3-270m does the same).
Code, corpus, report and the full comparison with Qwen2.5-0.5B: https://github.com/miilv/prune-to-caveman (Skoltech, Modern Methods and Algorithms of Generative AI, Homework 1, bonus B2, Ilia Mikhalchuk). Sister model: miilg/qwen2.5-0.5b-caveman.