On this page · 4 sections
TL;DR
Transformers 5.21.0 changes how custom tensor-parallel and MoE expert-parallel plans must be written, and it adds an fp8 backend for QuantizedCache. Teams with custom parallel plans or quantized KV caches should review those code paths before upgrading. The release also adds MiniCPM-OCR, Flint, UltraVBert and Pocket TTS models.
| Change | Who is affected | Action |
|---|---|---|
| ColwiseParallel and RowwiseParallel apply only to linear layers; input embeddings get a dedicated style and are sharded by default (5.21.0) | Users with custom TP plans that apply these styles to embeddings | Switch those entries to the new embedding style |
| Every MoE TP and EP plan shards its experts, enforced by test_moe_parallel_plans_shard_experts (5.21.0) | Users with custom or downstream MoE parallel plans | Add expert sharding and run the new test |
| fp8 backend for QuantizedCache (5.21.0) | Users of quantized KV caches | Decide whether to enable it through cache_config |
| Cache fixes for static caches, BLOOM, chunked prefill and Qwen4-Exp (5.21.0) | Users of static caches, compiled generate or chunked prefill | Re-run those code paths after upgrading |
| MiniCPM-OCR, Flint, UltraVBert and Pocket TTS models (5.21.0) | Teams evaluating these model families | Review the linked documentation before adoption |
Transformers 5.21.0: Parallel Plan Changes, Cache Updates and New Models #
Tensor-Parallel Plans: Embedding Styles and Default Sharding #
The Transformers v5.21.0 release notes add a dedicated embedding style, shard every model's input embeddings by default, and support widths that are not divisible by the TP size. ColwiseParallel and RowwiseParallel now apply only to linear layers, so a custom plan that applies either one to an embedding module must switch to the new style. Because input embeddings are sharded by default, an explicit embedding entry should be compared against that default before you keep it. The notes list this change under breaking changes, so custom TP plans should be checked before the test suite runs.
MoE Parallel Plans: Expert Sharding Is Now Enforced #
Every MoE TP and EP plan now shards its experts, so models no longer keep all experts on every rank. The notes add a test, test_moe_parallel_plans_shard_experts, and state that custom or downstream MoE plans must add expert sharding to pass it. Running that test against your own plans is the direct way to see whether they match the new behaviour. The notes also say that adding expert sharding avoids wasted memory. A separate fix in the same release shards the text and vision experts of Ernie4.5-VL-MoE under TP and EP.
FP8 Backend for QuantizedCache #
The notes add an fp8 backend to QuantizedCache, alongside quanto and hqq. It stores KV states in torch.float8_e4m3fn with a single scale per tensor, and it is enabled with the two settings below. The notes list this under breaking changes, so code that constructs QuantizedCache should be reviewed before you adopt the backend. Teams that do not use quantized KV caches have no action from this item.
cache_implementation="quantized"
cache_config={"backend": "fp8"}Cache Fixes for Static, Compiled and Chunked Generation #
Flash Attention now works with static caches, and BLOOM no longer crashes with static cache or compiled generate. Chunked prefill supports cache continuation, and the Qwen4-Exp indexer's position history stays aligned with its cached keys. Linear-attention caches also gain getters such as is_recording_past and get_recurrent_state, which the notes say stop exposing cache internals. Teams using static caches, compiled generate or chunked prefill should re-run those code paths after upgrading.
Document Models: MiniCPM-OCR, Flint and UltraVBert #
MiniCPM-OCR is a document-understanding model from OpenBMB's MiniCPM-V family. The notes say it pairs a SigLIP vision encoder and a window-attention merger with a Qwen3.5 language model, and that it is specialized for text-dense images such as scanned pages, screenshots, receipts and tables. Teams with those inputs should test it on their own documents. Flint is Recursive's mixture-of-experts model, which routes each token to 6 of 256 experts by sigmoid score, and the first two layers are dense.
UltraVBert pairs the UltraBERT text encoder with a SigLIP vision encoder for visual document understanding and retrieval. Its image processor splits each page into 512-pixel tiles plus a global view, and the connector merges each 4 x 4 block of vision patches into one token, so a tile becomes 64 image tokens. The max_image_tiles setting defaults to 27 and caps the number of tiles per page. Teams processing long documents should check whether this cap fits their page counts.
Pocket TTS, Gradium Phonon TTS and the Audio Tokenizer #
Pocket TTS is Kyutai's 100M-parameter text-to-speech model, and the notes say it runs faster than real time on CPU. It emits one continuous audio latent per frame at 12.5 Hz, and a Mimi-based audio tokenizer decodes those latents to 24 kHz audio. Two flow heads are released, Lagrangian self-distillation (default) and drifting, and voices can be cloned from a recording, passed as precomputed latents, or loaded from cached KV states. The Pocket TTS audio tokenizer replaces Mimi's residual vector quantizer with a continuous 32-dimensional bottleneck.
Gradium Phonon TTS is trained with the Pocket TTS recipe, but its voice conditioning uses 512-dimensional latents from a separate, unreleased speaker codec. Its voices come as precomputed latents and cannot be cloned from a recording. Teams that need voice cloning should treat this as a deciding difference between the two models. This suggests that a Gradium voice pipeline depends on the latents Gradium supplies rather than on audio the user records.
Vision, Generation, Parallelism and Import Fixes #
- Vision image processors composite PNG transparency onto white, and background_color is preserved across the DeepSeek-VL and Janus processors.
- SmolVLM's inputs_merger is fixed for image tokens that are not a multiple of the patch size.
- Generate no longer drops the type of dict-like inputs such as ModelOutput, and Qwen3-Omni audio generation respects generation_mode.
- Expert-parallel token-dispatch gradients are restored on torch 2.7 to 2.10, and a Molmo2 model-parallel device mismatch is fixed.
- A tensor-parallel plan is added for Nemotron.
- The Gemma4, Gemma4 unified and EmbeddingGemma2 processors no longer fail on
from transformers import *in environments that have PIL but not torch; the notes say no user action is needed.
Transformers 5.18.0: Loading Fix for RTDetrModel and SEWDForCTC #
Transformers 5.18.0 also fixes silently random-initialized RTDetrModel and SEWDForCTC loads, so users of those checkpoints should confirm the loaded weights come from the checkpoint.
Upgrade Checklist for Transformers 5.21.0 #
- In 5.21.0, find custom TP plan entries that apply ColwiseParallel or RowwiseParallel to embedding modules, and switch them to the new embedding style.
- In 5.21.0, add expert sharding to every custom or downstream MoE TP and EP plan.
- In 5.21.0, run test_moe_parallel_plans_shard_experts against the updated plans.
- In 5.21.0, re-run your static-cache, compiled-generate and chunked-prefill code paths, including BLOOM usage.
- In 5.21.0, if your code constructs QuantizedCache, decide whether to set cache_config to the fp8 backend.
- In 5.18.0, confirm that RTDetrModel and SEWDForCTC loads contain the weights you expect rather than random initialization.
Sources
- Release Release: v5.21.0 · huggingface/transformers · GitHub github.com · Oct 26, 2026
- Release Release 5.18.0 · huggingface/transformers · GitHub github.com · Sep 30, 2026
Edited and approved by Jarosław Krzemiński. Spotted a mistake? Report a correction or read the corrections policy.




Comments