altamt
Bidirectional Kinyarwanda ⇄ English machine translation — fast on your CPU.
altamt (Advanced Lightweight Translation AI Model Transformer) is a compact (~130–195M parameter) modern Transformer (RMSNorm · SwiGLU · Grouped-Query Attention · RoPE) that translates in both directions with one model and auto-detects the input language. No GPU required.
Installation
pip install altamt
# optional extras
pip install "altamt[onnx]" # ONNX Runtime export & inference
pip install "altamt[benchmark]" # compare against NLLB / Opus-MT baselines
Quickstart (Python)
from altamt import Translator
translator = Translator(model_path="path/to/checkpoint")
# Language auto-detection: just pass text.
result = translator.translate("Mwaramutse nshuti zanjye")
print(result)
# {'translated_text': 'Good morning my friends',
# 'detected_src': 'rw', 'tgt': 'en', 'latency_ms': 42.1}
# Or pin the direction explicitly:
translator.translate("How are you today?", src_lang="en", tgt_lang="rw")
# Batch translation — directions can even be mixed in one batch:
translator.translate_batch(["Mwaramutse", "Good morning"])
Make it faster: INT8 quantization
translator = Translator("path/to/checkpoint", quantize=True, num_threads=8)
translator.warmup()
INT8 dynamic quantization typically gives ~2× lower latency and ~4× smaller weight matrices on x86 CPUs, with a negligible quality drop.
Quickstart (CLI)
altamt translate "Mwaramutse nshuti zanjye" --model path/to/checkpoint
# Good morning my friends
# [rw -> en | 42.1 ms]
altamt translate "Hello" --model path/to/checkpoint --tgt-lang rw --int8 --json
altamt benchmark --model path/to/checkpoint --test-file test.parquet --int8
altamt export-onnx --model path/to/checkpoint --output-dir ./onnx_model
altamt train --config config.yaml
Why altamt?
- One model, both directions — a target-language tag (
<2en>/<2rw>) steers the decoder, so RW→EN and EN→RW share all parameters and vocabulary. - Automatic language detection — a built-in, microsecond-fast character n-gram detector picks the direction when you don't.
- Built for CPU — Grouped-Query Attention + full KV-cached decoding + INT8 quantization target <100 ms per sentence on a modern 8-core CPU (beam=1, short sentences).
- Multi-format data — training and benchmarking read
.json,.jsonland.parquetinterchangeably. - Honest benchmarking —
altamt benchmarkreports SacreBLEU, chrF++, latency, throughput and memory, and can run NLLB/Opus-MT baselines through the same harness, emitting Markdown and LaTeX tables.
Indicative CPU performance
Numbers depend on your hardware, sentence length, beam size and thread count; measure on your machine with altamt benchmark. On a modern 8-core x86 CPU (beam=1, ~20-token sentences, num_threads=8), the INT8 base model targets <100 ms/sentence, with fp32 roughly 2× slower and ~780 MB peak RAM.
Documentation
Full architecture details, data format specs, training and paper-publishing guides live in the GitHub README.
License
Apache 2.0
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file altamt-1.0.tar.gz.
File metadata
- Download URL: altamt-1.0.tar.gz
- Upload date:
- Size: 145.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
24b14e7d3680f4a329553ba860479215d9114e6194aa2ca42f1282e8aca08c69
|
|
| MD5 |
07c95dc384003294f876aae5b01d7939
|
|
| BLAKE2b-256 |
eb6c8972f69931d5d217291ff085399173308432d421edeb837733e8f0a90690
|
File details
Details for the file altamt-1.0-py3-none-any.whl.
File metadata
- Download URL: altamt-1.0-py3-none-any.whl
- Upload date:
- Size: 120.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a38f058388d6c608d2662f2d3e199968ed04ace7b173b56ec163f0e680193d52
|
|
| MD5 |
7238b4bdae14e6348ba2cb66ffe71f91
|
|
| BLAKE2b-256 |
5775ad25e5e7de818c566ef847ca6dadcd66b5ef9ac93fd467f41a55435c61e7
|