Hugging FaceLysandre, Arthur Zucker, Cyril Vallez, Vaibhav SrivastavAnnouncement
Transformers v5: Simple model definitions powering the AI ecosystem
Summary
Transformers v5.0.0rc-0 introduces major architectural updates focused on simplicity, training, inference, and ecosystem interoperability across modern AI workflows. The release adopts a modular modeling approach and centralizes attention implementations into a unified AttentionInterface abstraction to reduce contribution and code review overhead. Support for Flax and TensorFlow is officially sunset in favor of focusing on PyTorch as the primary backend, while tokenization is standardized around the tokenizers library. For execution workloads, v5 adds native continuous batching, paged attention mechanisms, and a dedicated transformers serve OpenAI-compatible serving system. Finally, weight loading is refactored to make low-precision quantization a first-class citizen alongside broad interoperability with formats such as GGUF, MLX, and TorchAO.
Context
Five years after the release of Transformers v4, the library expanded from 40 model architectures to over 400 and exceeded 1.2 billion total installs. To maintain relevance as a core model definition toolkit across diverse tools, the project needed to streamline code maintenance, reduce contribution complexity, and modernize support for large-scale training, inference, and quantization across the AI ecosystem.
Approach / What changed
Transformers v5 adopts a modular design, introduces an AttentionInterface abstraction, and sunsets Flax and TensorFlow support to focus on PyTorch. The release standardizes tokenization around the tokenizers backend, eliminating the fast/slow tokenizer distinction. It also expands pre-training compatibility, integrates continuous batching, paged attention, and a new transformers serve API, while making quantization a first-class feature alongside cross-ecosystem formats like GGUF.
Takeaways
Transformers v5 drops backend support for Flax and TensorFlow to focus exclusively on PyTorch as its primary modeling backend.
The AttentionInterface centralizes attention methods like FlashAttention, FlexAttention, and SDPA, keeping only eager evaluation in core modeling files.
The library removes the fast and slow tokenizer distinction, standardizing primarily on the tokenizers backend with torchvision for fast image processors.
Source and freshness
- Source
- huggingface.co
- Published
- Added to Yomu
- Last updated
Summaries are generated from the original by a language model. Check the original before relying on it.
Keep reading
Related reading
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
The best engineering reads, once a week
One useful email. Unsubscribe anytime.