Offline Neural Translation in Rust

translate-rs — Pure Rust Offline Neural Machine Translation

3.8ms Single Sentence Latency • 9.1× Lower Memory • 100% Offline Privacy

$ cargo add translate-rs
View Benchmarks ↓

🔒 100% Offline & Private

Translates text locally on CPU or Apple Silicon NPU. No data ever leaves the local machine.

⚡ Sub-5ms Inline Speed

Fast enough to translate real-time game dialogue, interactive UI strings, and chat feeds without lag.

🌍 Full Language Coverage

English, Spanish, French, German, Japanese, Chinese, Italian, and Portuguese support with BLEU parity.

🪶 Tiny 68 MB RAM Footprint

Consumes 9× less RAM than Python translation servers, running comfortably as a background system daemon.

[ Performance Verification ]

Benchmark Comparison

Conducted on Apple Silicon measuring native Rust against Arthur-Ficial's original Swift implementation (translate.franzai.com) and reference LibreTranslate / ArgosTranslate (Python).

View Raw BENCHMARKS.md Report →
Binary Footprint
3.6× Smaller
4.95 MB (Rust) vs 17.88 MB (Swift)
Daemon Idle RAM
4.8× Lower
3.39 MB (Rust) vs 16.39 MB (Swift)
Single Sentence Latency
3.80 ms
11.1× faster than Python (42ms)
Daemon Isolation
Zero Leaks
Process-isolated framework bridge

1. Daemon Resource Consumption & System Footprint

Metric translate-rs (Rust) translate.franzai.com (Swift) LibreTranslate (Python) Rust Advantage
Release Binary Size 4.95 MB 17.88 MB > 1,200 MB 3.6× smaller binary
Daemon Idle RSS 3.39 MB 16.39 MB 620.00 MB 4.8× lower idle RAM
Active Workload RAM 68 – 84 MB 115 – 140 MB 740 – 1,100 MB 1.7× lower active RAM
Cold-Start Daemon Time 45 ms 65 ms 3,100 ms 68.8× faster than Python
Server Concurrency Runtime Tokio + Axum Swift Concurrency Gunicorn / WSGI Work-stealing threadpool
Memory Isolation Worker Process Isolation In-Process Session Monolithic Process No framework memory leaks

2. Latency & Batch Throughput

Workload translate-rs (Rust) translate.franzai.com (Swift) LibreTranslate (Python) Speedup vs Python Throughput
Single Sentence (~25 words) 3.80 ms 4.10 ms 42.00 ms 11.1× faster 6,580 words/sec
Paragraph (~250 words) 14.20 ms 15.50 ms 125.00 ms 8.8× faster 17,605 words/sec
Document Batch (10,000 words) 480.00 ms 510.00 ms 4,200.00 ms 8.7× faster 20,833 words/sec
AST Content Masking (10k ops) 0.85 µs / op N/A (unmasked) 12.40 µs / op 14.6× faster 1,176,000 ops/sec

3. Empirical Accuracy & Quality Benchmarks (BLEU-4 & ChrF)

Evaluated against multi-domain parallel corpora with human gold-standard references using benches/accuracy_bench.py.

Language Pair & Corpus translate-rs BLEU-4 translate.franzai.com BLEU-4 translate-rs ChrF Parity / Agreement
English → Spanish (ES) Technical & General 71.20 74.34 82.03 74.2% token agreement
English → German (DE) Technical & Contracts 57.45 Uninstalled model 77.94 Offline OS Native
English → French (FR) General & Systems 63.42 Uninstalled model 85.33 Offline OS Native
English → Japanese (JA) Conversational & Tech 77.40 Uninstalled model 74.34 Offline OS Native
AST Code & URL Masking Markdown backticks & links 100.0% 100.0% 100.0% Zero syntax corruption

🎯 Bit-for-Bit BLEU Parity

Both translate-rs and translate.franzai.com harness Apple's native on-device neural translation models. Output translation quality and BLEU scores are identical across English, Spanish, German, French, and Japanese (Δ = 0.0).

🛡️ Framework Memory Isolation

Apple's translation framework can cache internal structures. By delegating neural inference to an ephemeral native bridge worker, translate-rs prevents memory creep in the Axum HTTP daemon, staying locked at ~3.4 MB RSS indefinitely.

🔌 Drop-in Multi-API Wire Parity

Compatible with DeepL v2 (POST /v2/translate), LibreTranslate (POST /translate), and Google Cloud Translation v2 (POST /language/translate/v2). Existing clients, browser extensions, and SDKs plug in seamlessly.