--- base_model: CraneAILabs/ganda-gemma-1b language: - en - lg library_name: litert license: gemma tags: - luganda - translation - conversational - gemma - gemma3 - fine-tuned - litert - mobile - android - ios - mediapipe - edge - on-device - luganda - translation - conversational - gemma - gemma3 - fine-tuned - litert - mobile - android - ios - mediapipe pipeline_tag: text-generation --- # Ganda Gemma 1B - LiteRT LiteRT (formerly TensorFlow Lite) optimized version of **Ganda Gemma 1B** - a fine-tuned Gemma 3 1B instruction model specialized for **English-to-Luganda translation and Luganda conversational AI**. This repository contains MediaPipe task bundles optimized for mobile deployment on Android and iOS devices. ## πŸ“Š Translation Performance ![Translation Performance Comparison](ganda_gemma_ascending_chart.png) ### FLORES-200 Evaluation Results Our Ganda Gemma 1B model demonstrates strong performance in English-to-Luganda translation: | Metric | Score | Ranking | |--------|-------|---------| | **BLEU** | **6.99** | 2nd out of 5 models | | **chrF++** | **40.32** | 2nd out of 5 models | ### Model Comparison | Model | Parameters | BLEU | chrF++ | Efficiency* | |-------|------------|------|--------|-------------| | Gemma 3 4B | 4B | 1.1 | 20.05 | 0.28 | | Gemma 3 27B | 27B | 3.65 | 31.37 | 0.14 | | GPT-5 Mini | N/A | 5.14 | 36.55 | N/A | | **Ganda Gemma 1B** | **1B** | **6.99** | **40.32** | **6.99** | | Gemini 2.0 Flash | Large | 7.94 | 43.38 | N/A | *Efficiency = BLEU Score / Parameters (in billions) ### Key Performance Insights 🎯 **Efficiency Leader**: Achieves the highest BLEU-to-parameter ratio (6.99 BLEU per billion parameters) πŸš€ **Size Advantage**: Outperforms Gemma 3 4B (4x larger) by 535% on BLEU score πŸ’Ž **Competitive Quality**: Outperforms GPT-5 Mini by 36% on BLEU score with known parameter count ⚑ **Practical Deployment**: Runs efficiently on consumer hardware while maintaining quality ### Evaluation Details - **Dataset**: FLORES-200 Englishβ†’Luganda (1,012 translation pairs) - **Metrics**: BLEU (bilingual evaluation understudy) and chrF++ (character F-score) - **Evaluation**: Zero-shot translation performance - **Model**: ganda-gemma-1b checkpoint with GRPO enhancement ## πŸ“± Available Models | File | Size | Quantization | Use Case | |------|------|--------------|----------| | `ganda-gemma-1b-instruct.task` | ~978MB | FP16 | **Recommended** - Instruction following format with MediaPipe bundling | | `ganda-gemma-1b.tflite` | ~973MB | FP16 | Raw TFLite model - requires custom tokenizer integration | ## πŸš€ Quick Start ### Android (MediaPipe) ```kotlin import com.google.mediapipe.tasks.genai.llminference.LlmInference // Load the model val options = LlmInference.LlmInferenceOptions.builder() .setModelPath("/path/to/ganda-gemma-1b-instruct.task") .build() val llmInference = LlmInference.createFromOptions(context, options) // Generate response val response = llmInference.generateResponse("Translate to Luganda: Good morning") println(response) ``` ### iOS (MediaPipe) ```swift import MediaPipeTasksGenAI // Load the model let options = LlmInference.Options() options.modelPath = "/path/to/ganda-gemma-1b-instruct.task" let llmInference = try LlmInference(options: options) // Generate response let response = try llmInference.generateResponse(inputText: "Translate to Luganda: Good morning") print(response) ``` ### Web (MediaPipe) ```javascript import { LlmInference } from '@mediapipe/tasks-genai'; const llm = await LlmInference.createFromModelPath( '/path/to/ganda-gemma-1b-instruct.task' ); const response = await llm.generateResponse('Translate to Luganda: Good morning'); console.log(response); ``` ## 🌍 Language Capabilities - **Input Languages**: English + Luganda - **Output Language**: Luganda only - **Primary Focus**: English-to-Luganda translation and Luganda conversation ## πŸ“¦ Model Variants Guide ### 1. `ganda-gemma-1b-instruct.task` (RECOMMENDED) **Best for**: Most mobile applications - ready-to-use MediaPipe bundle **Input format**: Natural instructions ``` Translate to Luganda: Hello, how are you? ``` **MediaPipe formats as**: ``` ### Instruction: Translate to Luganda: Hello, how are you? ### Response: ``` ### 2. `ganda-gemma-1b.tflite` **Best for**: Custom integrations requiring direct TFLite model access **Requirements**: You need to handle tokenization manually **Use case**: Advanced users who want to integrate with custom tokenizers or frameworks ## 🎯 Capabilities - **Translation**: English-to-Luganda translation - **Conversational AI**: Natural dialogue in Luganda - **Summarization**: Text summarization in Luganda - **Writing**: Creative and informational writing in Luganda - **Question Answering**: General knowledge responses in Luganda ## πŸ’‘ Generation Parameters Optimal settings for mobile deployment: ```javascript // JavaScript/Web const response = await llm.generateResponse(prompt, { temperature: 0.3, topK: 40, randomSeed: 42 }); ``` ```kotlin // Android val response = llmInference.generateResponse( inputText = prompt, temperature = 0.3f, topK = 40, randomSeed = 42 ) ``` ```swift // iOS let options = LlmInference.Options() options.temperature = 0.3 options.topK = 40 options.randomSeed = 42 let response = try llmInference.generateResponse( inputText: prompt, options: options ) ``` ## πŸ“± Mobile Integration ### Memory Requirements - **RAM**: Minimum 3GB recommended for optimal performance - **Storage**: ~1.2GB per task bundle - **CPU**: ARMv8 or newer recommended ### Performance Tips 1. **Preload models** during app initialization 2. **Use appropriate quantization**: FP16 provides good quality for mobile 3. **Cache responses** for repeated queries 4. **Batch processing** for multiple translations ## πŸ”— Related Models - **Original Model**: [CraneAILabs/ganda-gemma-1b](https://huggingface.co/CraneAILabs/ganda-gemma-1b) - Full precision HuggingFace model - **GGUF Quantizations**: [CraneAILabs/ganda-gemma-1b-GGUF](https://huggingface.co/CraneAILabs/ganda-gemma-1b-GGUF) - Optimized for llama.cpp/Ollama - **Ollama**: [crane-ai-labs/ganda-gemma-1b](https://ollama.com/crane-ai-labs/ganda-gemma-1b) - Ready-to-run with Ollama ## 🎨 Use Cases - **Mobile Translation Apps**: Offline English-Luganda translation - **Language Learning**: Practice Luganda with instant feedback - **Cultural Apps**: Create culturally aware Luganda content - **Educational Tools**: Luganda learning assistants for mobile - **Offline AI**: No internet required after model download - **Edge Computing**: Run AI locally on mobile devices ## ⚠️ Limitations - **Language Output**: Responds only in Luganda - **Mobile Resources**: Requires significant RAM and storage - **Context Length**: Optimized for shorter inputs on mobile - **Quantization**: FP16 requires more memory than INT4/INT8 - **Platform Support**: Requires MediaPipe Tasks GenAI support ## πŸ› οΈ Development Setup ### Android ```gradle dependencies { implementation 'com.google.mediapipe:tasks-genai:latest.release' } ``` ### iOS ```swift // Add to Package.swift .package(url: "https://github.com/google/mediapipe", from: "0.10.0") ``` ### Web ```bash npm install @mediapipe/tasks-genai ``` ## πŸ“„ License This model is released under the [Gemma Terms of Use](https://ai.google.dev/gemma/terms). Please review the terms before use. ## πŸ™ Acknowledgments - **Google**: For the Gemma 3 base model, support and guidance. - **Community**: For Luganda language resources and datasets - **Gilbert Korir (Msingi AI, Nairobi, Kenya)** - **Alfred Malengo Kondoro (Hanyang University, Seoul, South Korea)** ## Citation If you use these LiteRT models in your research or mobile applications, please cite: ```bibtex @misc{crane_ai_labs_2025, author = {Bakunga Bronson and Kato Steven Mubiru and Lwanga Caleb and Gimei Alex and Kavuma Lameck and Roland Ganafa and Sibomana Glorry and Atuhaire Collins and JohnRoy Nangeso and Tukamushaba Catherine}, title = {Ganda Gemma: A Fine-tuned Gemma 3 1B Model for Luganda conversational AI}, year = {2025}, url = {https://huggingface.co/CraneAILabs/ganda-gemma-1b}, organization = {Crane AI Labs} } ``` --- **Built with ❀️ by Crane AI Labs** *Ganda Gemma - Your helpful Luganda AI companion, now on mobile!*