// the find
guillaume-be/rust-bert
Rust native ready-to-use NLP pipelines and transformer-based models (BERT, DistilBERT, GPT2,...)
rust-bert is a Rust port of Hugging Face Transformers, giving you production-ready NLP pipelines (NER, QA, summarization, translation, text generation, embeddings) backed by libtorch or ONNX runtime. It's for Rust teams who need inference performance without a Python process and don't want to write the model plumbing themselves.
The pipeline API is genuinely ergonomic — QuestionAnsweringModel::new(Default::default()) and you're running inference in three lines. ONNX support via the ort crate is a meaningful addition: you can export from Hugging Face Optimum and drop the PyTorch dependency entirely for deployment. Text generation benchmarks are credible (2–4x over Python transformers) because the bottleneck shifts from the model to tokenization, and the Rust tokenizer is fast. The model coverage is broad and honestly maintained — the model/task matrix is explicit about what's supported rather than hiding gaps.
The libtorch setup is a genuine pain point: you're manually downloading a versioned libtorch binary, setting env vars, and hoping the version pins don't drift between rust-bert and tch-rs releases — the README already has a caveat about this. No support for anything post-2023 in the model list: no Llama, Mistral, Phi, or any of the architectures that have replaced GPT-J and GPT-Neo for generation tasks, which limits its usefulness if you care about modern models. The ONNX path requires a Python step (Optimum export) to get weights into the right format, which undermines the 'no Python' story for teams that don't already have the Hugging Face ecosystem set up. Last push was January 2026 but the issue tracker likely has accumulating debt around the libtorch version chase — this is a one-maintainer project and that's a real adoption risk.