c-elo/kikuyu_translategemma_4b_v7_highrank_rslora
Uploaded finetuned model
- Developed by: gateremark
- License: apache-2.0
- Finetuned from model: google/translategemma-4b-it
This Gemma3 / TranslateGemma model was trained with Unsloth and Hugging Face's TRL library.
C-elo Labs Organization Release
This repository is the C-elo Labs organization release of the Kikuyu TranslateGemma-4B V7 model, originally developed by Mark Gatere under `gateremark/kikuyu_translategemma_4b_v7_highrank_rslora`.
This is the current preferred C-elo Labs English → Kikuyu translation model for production-facing use. The original gateremark repository remains available as the development-history copy, while this c-elo repository is maintained for C-elo Labs research, product, and public release references.
Kikuyu TranslateGemma-4B V7
Fine-tuned English -> Kikuyu translation model based on Google's TranslateGemma-4B-it.
This is the current fast production model behind C-elo Translate. It was trained as a smaller, faster alternative to the earlier 12B model while improving automatic evaluation scores and manual translation quality.
Live demo: c-elo.com/c-elo-ai
Previous 12B model: gateremark/kikuyu_translategemma_12b_merged_V2
Model Details
Why This Model
The earlier 12B Kikuyu TranslateGemma model reached 19.61 BLEU, but it was large and slower to cold-start in production. This V7 4B-family model is smaller, faster to load, and evaluated better on the same held-out split:
Usage
Recommended: Unsloth / Gemma3Processor Path
This model uses the TranslateGemma/Gemma3 chat template. For reliable generation, use the processor for apply_chat_template() and the underlying text tokenizer for tokenization/decoding.
import torch
from unsloth import FastLanguageModel
model_id = "gateremark/kikuyu_translategemma_4b_v7_highrank_rslora"
model, processor = FastLanguageModel.from_pretrained(
model_name=model_id,
max_seq_length=4096,
dtype=None,
load_in_4bit=False, # Set True if you need lower VRAM and accept possible quality changes.
)
text_tokenizer = (
getattr(processor, "tokenizer", None)
or getattr(processor, "text_tokenizer", None)
or processor
)
if text_tokenizer.pad_token_id is None:
text_tokenizer.pad_token = text_tokenizer.eos_token
model.config.pad_token_id = text_tokenizer.pad_token_id
text_tokenizer.padding_side = "left"
FastLanguageModel.for_inference(model)
terminators = []
for token_id in [
text_tokenizer.eos_token_id,
text_tokenizer.convert_tokens_to_ids("<end_of_turn>"),
text_tokenizer.convert_tokens_to_ids("<eos>"),
]:
if (
isinstance(token_id, int)
and token_id >= 0
and token_id != getattr(text_tokenizer, "unk_token_id", None)
and token_id not in terminators
):
terminators.append(token_id)
def translate_to_kikuyu(text: str) -> str:
messages = [
{
"role": "user",
"content": [
{
"type": "text",
"source_lang_code": "en",
"target_lang_code": "ki",
"text": text,
}
],
}
]
formatted_text = processor.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True,
)
inputs = text_tokenizer(
[formatted_text],
return_tensors="pt",
padding=True,
)
inputs = {key: value.to(model.device) for key, value in inputs.items()}
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=128,
do_sample=False,
eos_token_id=terminators,
pad_token_id=text_tokenizer.pad_token_id,
)
input_len = inputs["input_ids"].shape[1]
response = text_tokenizer.decode(
outputs[0][input_len:],
skip_special_tokens=True,
)
return response.strip()
print(translate_to_kikuyu("Hello, how are you?"))
# Example output: Ndũmĩrĩrie, ũraigua atĩa?Minimal Inference Notes
- Use
target_lang_code="ki"for Kikuyu. - Use left padding for batched generation with decoder-only models.
- Deterministic decoding (
do_sample=False) is recommended for translation. - The model is trained for English -> Kikuyu. Reverse Kikuyu -> English was not part of this run.
Training Details
Dataset
- Dataset: gateremark/english-kikuyu-translations
- Size: 30,430 parallel English-Kikuyu sentence pairs
- Split: 95% train / 5% eval
- Train examples: 28,908
- Eval examples: 1,522
V7 Hyperparameters
Target Modules
[
"q_proj",
"k_proj",
"v_proj",
"o_proj",
"gate_proj",
"up_proj",
"down_proj",
]Evaluation
Evaluation was run on the held-out 5% split from the same dataset using BLEU and chrF++.
Automatic metrics are useful for regression testing, but Kikuyu quality should also be checked with native-speaker review because morphology, idiom, tone, and dialect variation are not fully captured by BLEU.
Sample Translations
Intended Use
- English -> Kikuyu translation tools
- Kikuyu language learning applications
- Low-resource African language NLP research
- Cultural and linguistic preservation projects
- Prototyping multilingual AI interfaces for Kikuyu speakers
Limitations
- Direction: English -> Kikuyu only. Kikuyu -> English was not trained in this run.
- Language coverage: Optimized for Kikuyu (
ki), not other Gikuyu-related dialects or neighboring Bantu languages. - Domain: Best for general text. Technical, legal, medical, poetic, or highly idiomatic content may need human review.
- Evaluation: BLEU and chrF++ do not fully measure naturalness, dialect fit, or cultural nuance.
- Production use: Review outputs before high-stakes use.
Citation
@misc{gatere2026kikuyutranslategemma4bv7,
author = {Mark Gatere},
title = {Kikuyu TranslateGemma-4B V7: rsLoRA Fine-tuning for English to Kikuyu Translation},
year = {2026},
publisher = {Hugging Face},
howpublished = {\url{https://huggingface.co/gateremark/kikuyu_translategemma_4b_v7_highrank_rslora}}
}Acknowledgments
- Google for TranslateGemma-4B-it
- Unsloth for efficient fine-tuning
- Hugging Face for model and dataset hosting
- Modal for GPU training and deployment infrastructure
- Kikuyu speakers and reviewers supporting C-elo's translation work
