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 8 |
+
- am
|
| 9 |
+
- zu
|
| 10 |
+
- xh
|
| 11 |
+
- af
|
| 12 |
+
- so
|
| 13 |
+
- rw
|
| 14 |
+
- sn
|
| 15 |
+
- tw
|
| 16 |
+
- ee
|
| 17 |
+
- wo
|
| 18 |
+
- ny
|
| 19 |
+
- ti
|
| 20 |
+
- nso
|
| 21 |
+
- tn
|
| 22 |
+
- om
|
| 23 |
+
- ve
|
| 24 |
+
- nd
|
| 25 |
+
- ar
|
| 26 |
+
- fr
|
| 27 |
+
- pt
|
| 28 |
+
- es
|
| 29 |
+
- de
|
| 30 |
+
- zh
|
| 31 |
+
- ja
|
| 32 |
+
- ko
|
| 33 |
+
license: mit
|
| 34 |
tags:
|
| 35 |
+
- translation
|
| 36 |
+
- mlx
|
| 37 |
+
- apple-silicon
|
| 38 |
+
- multilingual
|
| 39 |
+
- african-languages
|
| 40 |
+
pipeline_tag: text2text-generation
|
| 41 |
+
library_name: mlx
|
| 42 |
---
|
| 43 |
+
|
| 44 |
+
# TranslateBlue v2 (MLX 4-bit)
|
| 45 |
+
|
| 46 |
+
Translation model focused on **29 languages** with emphasis on **African languages**, in MLX 4-bit format for **Apple Silicon** (M1+ Mac, and mlx-swift on supported devices).
|
| 47 |
+
|
| 48 |
+
## Model description
|
| 49 |
+
|
| 50 |
+
- **Base model**: Qwen3-4B-Instruct
|
| 51 |
+
- **Format**: MLX, 4-bit quantized
|
| 52 |
+
- **Size**: ~2.1 GB
|
| 53 |
+
- **Training**: LoRA fine-tuning on parallel translation data (10,000 steps, 16 LoRA layers)
|
| 54 |
+
- **Training data**: 563,986 sentence pairs from 29 languages
|
| 55 |
+
|
| 56 |
+
## Intended use
|
| 57 |
+
|
| 58 |
+
- **Text translation** between the supported languages, especially to/from African languages
|
| 59 |
+
- **Offline translation** on Mac (and in apps using mlx-swift where supported)
|
| 60 |
+
- **Low-latency translation** on Apple Silicon with Metal acceleration
|
| 61 |
+
|
| 62 |
+
## Supported languages (29)
|
| 63 |
+
|
| 64 |
+
| Code | Language | Code | Language | Code | Language |
|
| 65 |
+
|------|-------------|------|-----------------|------|-----------------|
|
| 66 |
+
| sw | Swahili | ha | Hausa | yo | Yoruba |
|
| 67 |
+
| ig | Igbo | am | Amharic | zu | Zulu |
|
| 68 |
+
| xh | Xhosa | af | Afrikaans | so | Somali |
|
| 69 |
+
| rw | Kinyarwanda | sn | Shona | tw | Twi |
|
| 70 |
+
| ee | Ewe | wo | Wolof | ny | Chichewa |
|
| 71 |
+
| ti | Tigrinya | nso | Northern Sotho | tn | Tswana |
|
| 72 |
+
| om | Oromo | ve | Venda | nd | Ndebele |
|
| 73 |
+
| ar | Arabic | fr | French | pt | Portuguese |
|
| 74 |
+
| es | Spanish | de | German | zh | Chinese |
|
| 75 |
+
| ja | Japanese | ko | Korean | en | English |
|
| 76 |
+
|
| 77 |
+
## Limitations
|
| 78 |
+
|
| 79 |
+
- **Apple Silicon only** for this MLX build (Mac with M1 or later; mlx-swift on supported iOS/iPadOS when available).
|
| 80 |
+
- Best for **short to medium** sentences; very long texts may lose quality.
|
| 81 |
+
- Low-resource pairs may be less accurate than high-resource ones.
|
| 82 |
+
- No built-in language detection; source and target languages should be specified in the prompt.
|
| 83 |
+
|
| 84 |
+
## How to use
|
| 85 |
+
|
| 86 |
+
### Prompt format
|
| 87 |
+
|
| 88 |
+
Use a clear translation instruction, for example:
|
| 89 |
+
|
| 90 |
+
```
|
| 91 |
+
Translate from English to Swahili:
|
| 92 |
+
|
| 93 |
+
Hello, how are you?
|
| 94 |
+
```
|
| 95 |
+
|
| 96 |
+
### With Python (mlx-lm)
|
| 97 |
+
|
| 98 |
+
```bash
|
| 99 |
+
pip install mlx mlx-lm
|
| 100 |
+
```
|
| 101 |
+
|
| 102 |
+
```python
|
| 103 |
+
from mlx_lm import load, generate
|
| 104 |
+
from mlx_lm.sample_utils import make_sampler
|
| 105 |
+
|
| 106 |
+
model, tokenizer = load("aoiandroid/TranslateBlue-v2-MLX-4bit")
|
| 107 |
+
sampler = make_sampler(temp=0.3, top_p=0.9)
|
| 108 |
+
|
| 109 |
+
messages = [{"role": "user", "content": "Translate from English to Swahili:\n\nHello, how are you?"}]
|
| 110 |
+
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
|
| 111 |
+
response = generate(model, tokenizer, prompt=prompt, max_tokens=64, sampler=sampler, verbose=False)
|
| 112 |
+
print(response)
|
| 113 |
+
```
|
| 114 |
+
|
| 115 |
+
### With Swift (mlx-swift / TranslateBlue)
|
| 116 |
+
|
| 117 |
+
The model is registered as **TranslateBlue v2 (MLX)**. After downloading via the app (or placing the model in the expected path), it runs with MLXModelService using the same prompt format above.
|
| 118 |
+
|
| 119 |
+
## Training details
|
| 120 |
+
|
| 121 |
+
| Setting | Value |
|
| 122 |
+
|----------------|---------|
|
| 123 |
+
| Base model | Qwen3-4B-Instruct |
|
| 124 |
+
| Method | LoRA |
|
| 125 |
+
| LoRA layers | 16 |
|
| 126 |
+
| Steps | 10,000 |
|
| 127 |
+
| Training samples | 563,986 |
|
| 128 |
+
| Validation loss | ~2.5 |
|
| 129 |
+
|
| 130 |
+
## Related models
|
| 131 |
+
|
| 132 |
+
- **GGUF version** (llama.cpp, cross-platform): [aoiandroid/TranslateBlue-v2-GGUF](https://huggingface.co/aoiandroid/TranslateBlue-v2-GGUF)
|
| 133 |
+
|
| 134 |
+
## License
|
| 135 |
+
|
| 136 |
+
MIT.
|
| 137 |
+
|
| 138 |
+
## Citation
|
| 139 |
+
|
| 140 |
+
If you use this model in research or a product, please cite the base model (Qwen3) and the TranslateBlue project as appropriate.
|