--- language: fin license: gemma tags: - trimmed - gemma - gemma-3 base_model: google/gemma-3-1b-it base_model_relation: quantized datasets: - Lumberjackk/fineweb-2-trimming --- # gemma-3-1b-it-fin-32768 This model is a **26.43% smaller** version of [google/gemma-3-1b-it](https://huggingface.co/google/gemma-3-1b-it) optimized for Finnish language via vocabulary size reduction using the [trimming](https://huggingface.co/blog/introduction-to-trimming) method. This trimmed model should perform similarly to the original model with only **32,768 tokens** and a much smaller memory footprint. However, it may not perform well for other languages as tokens not commonly used in Finnish were removed from the vocabulary. ## Model Statistics | Metric | Original | Trimmed | Reduction | |--------|----------|---------|-----------| | **Vocabulary size** | 262,144 tokens | 32,768 tokens | **87.50%** | | **Model size** | 999,885,952 params | 735,644,800 params | **26.43%** | ## Mining Dataset Statistics - **Number of texts used for mining**: 200,000 texts - **Dataset**: [Lumberjackk/fineweb-2-trimming](https://huggingface.co/datasets/Lumberjackk/fineweb-2-trimming) ## Usage ```python from transformers import AutoModelForCausalLM, AutoTokenizer model_name = "lbourdois/gemma-3-1b-it-fin-32768" tokenizer = AutoTokenizer.from_pretrained(model_name) model = AutoModelForCausalLM.from_pretrained( model_name, torch_dtype="auto", device_map="auto" ) prompt = "Your prompt in Finnish." messages = [{"role": "user", "content": prompt}] text = tokenizer.apply_chat_template( messages, tokenize=False, add_generation_prompt=True ) model_inputs = tokenizer([text], return_tensors="pt").to(model.device) generated_ids = model.generate(**model_inputs, max_new_tokens=256) output_ids = generated_ids[0][len(model_inputs.input_ids[0]):] response = tokenizer.decode(output_ids, skip_special_tokens=True) print(response) ``` ## Citation #### Gemma 3 ```bibtex @misc{gemmateam2025gemma3technicalreport, title={Gemma 3 Technical Report}, author={Gemma Team}, year={2025}, eprint={2503.19786}, archivePrefix={arXiv}, primaryClass={cs.CL}, url={https://arxiv.org/abs/2503.19786}, } ```