Rust port of transformers (1M lines of code) TrustformeRS 0.1.1, a pure Rust port of Hugging Face Transformers with over 1.4 million lines of code, was released on April 25, 2026, delivering 49+ transformer architectures and up to 1.67x speedup over the Python original. The memory-safe implementation supports multi-backend GPU acceleration and deployment across WebAssembly, mobile, and server platforms. A high-performance, memory-safe Rust implementation of Hugging Face Transformers. TrustformeRS brings the power of transformer models to the Rust ecosystem with zero-cost abstractions, fearless concurrency, and deployment flexibility from edge to cloud. Project Status: TrustformeRS 0.1.1 was released on 2026-04-25. This release delivers 49+ transformer architectures, 5,358 tests with 100% pass rate, ~1,408,134 lines of 100% Pure Rust, and full multi-platform deployment WebAssembly, server REST/gRPC/GraphQL, mobile iOS/Android, RLHF/DPO training . Multi-backend GPU support: CUDA, Metal, ROCm, WebGPU, Vulkan, OpenCL, TPU. 🏎️ Performance : Leverages Rust's zero-cost abstractions, SIMD optimizations, and efficient memory management 🔒 Safety : Memory-safe by design with Rust's ownership model - no more segfaults or memory leaks 📦 Portability : Deploy anywhere from WebAssembly to embedded devices to GPU clusters 🔧 Control : Explicit resource management following SciRS2's Core Usage Policy 🤝 Compatibility : Loads Hugging Face model formats directly | Model | Task | TrustformeRS | HF Transformers | Speedup | |---|---|---|---|---| | BERT-base | Inference CPU | 23ms | 31ms | 1.35x | | BERT-base | Batch=32 CPU | 412ms | 687ms | 1.67x | | GPT-2 | Generation CPU | 89ms | 142ms | 1.59x | | LLaMA-7B | Generation GPU | 12ms/token | 18ms/token | 1.50x | | T5-base | Translation | 156ms | 234ms | 1.50x | | ViT-base | Image Classification | 15ms | 22ms | 1.47x | Benchmarks on Intel i9-12900K CPU and NVIDIA RTX 4090 GPU TrustformeRS follows a modular workspace structure inspired by Hugging Face Transformers: trustformers/ ├── trustformers-core/ Core traits and tensor abstractions 204,130 SLoC, Stable ├── trustformers-models/ 49+ model implementations 196,463 SLoC, Alpha ├── trustformers-tokenizers/ BPE, WordPiece, SentencePiece 51,211 SLoC, Stable ├── trustformers-optim/ 20+ optimizers and LR schedulers 71,429 SLoC, Stable ├── trustformers-training/ Distributed training, RLHF/DPO 89,413 SLoC, Stable ├── trustformers-serve/ REST/gRPC/GraphQL serving 361,251 SLoC, Stable ├── trustformers-wasm/ WebAssembly + WebGPU deployment 55,504 SLoC, Stable ├── trustformers-mobile/ iOS/Android deployment 143,001 SLoC, Alpha ├── trustformers-debug/ Profilers, visualizers, TensorBoard 101,448 SLoC, Alpha └── trustformers/ High-level integration crate 134,295 SLoC, Alpha Total : ~1.4M+ SLoC, 100% Pure Rust COOLJAPAN Policy Trait-based abstractions : Models, layers, and tokenizers implement common traits for composability Feature-gated backends : Choose between CPU, GPU, or WebAssembly targets Zero-copy model loading : Memory-mapped weights with SafeTensors format Explicit parallelism : You control thread and GPU usage, not the library dependencies trustformers = "0.1.1" use trustformers::prelude:: ; use trustformers::{AutoModel, AutoTokenizer}; fn main - Result< , Box