github huggingface/transformers v5.25.0
Release v5.25.0

2 hours ago

Release v5.25.0

New Model additions

Ergo

image

Amazon Ergo is a frontier open-weights model for software engineering and agentic workflows. Ergo is designed to tackle complex, long-running tasks while being fast and cost efficient. Ergo is a 1.1 trillion parameter mixture-of-experts model with 55 billion active parameters and a 1M-token context window.

Links: Documentation | Model weights | Official Post

Kolibri1_1

image

Kolibri 1.1 is Aleph Alpha's successor to Kolibri 1. It is a causal language model that keeps the mixture-of-experts layers and sliding-window attention layers of Kolibri 1, and uses dense MLPs in its first two layers. Every fifth layer is an "indexed_attention" layer that sparsely attends to the whole context. Each query sees the first 8 tokens, the 128 most recent tokens, and the 2048 highest-scoring other keys. Keys and values are rounded to NVFP4. The Transformers version is a reference implementation that supports only the eager and SDPA attention implementations.

Links: Documentation

MiniCPM5-15B-A2.5B

MiniCPM5-15B-A2.5B is a decoder-only mixture-of-experts language model with 15 billion total parameters and 2.5 billion active parameters per token. It uses gated grouped-query attention. The first decoder layer has a dense feed-forward network, and each later layer combines a shared expert with 16 routed experts selected from 160 per token.

Links: Documentation

PI0.5

PI0.5 is a vision-language-action model for robot manipulation from Physical Intelligence. It keeps the PI0 layout: a PaliGemma backbone reads the camera images and the prompt, and a smaller Gemma action expert predicts a chunk of actions with flow matching. Compared to PI0, the robot state is discretized into 256 bins and written into the text prompt rather than projected into the action expert, and the action expert receives the denoising timestep through adaptive RMS norms.

Links: Documentation | Paper

Param2Moe

Param2Moe is the architecture behind Param-2-17B-MoE-A2.4B, a Mixture of Experts language model from BharatGen AI. It has 17B total parameters, with 2.4B active per token, and supports English, Hindi, and 21 Indian languages. It uses grouped-query attention with QK normalization and full rotary position embeddings. Its hybrid MoE design has a dense first layer, then routes each token to 6 of 64 experts plus 2 always-active shared experts, using sigmoid routing with expert bias correction. The architecture is the same as GLM-4-MoE, so the auto classes load it with the GLM-4-MoE implementation and only the config is specific to Param2Moe.

Links: Documentation

LLaVA-OneVision-1.5

LLaVA-OneVision-1.5 is a vision-language model that pairs a native-resolution vision encoder with a Qwen3 language backbone. The vision encoder adds a learned class token to each image, applies full attention, removes the class token, and merges spatial patches into visual features for the language model, which uses standard one-dimensional rotary positions over the combined image and text sequence. The accompanying paper presents an open framework for training vision-language models from scratch at reduced cost. It reports that the 8B model exceeds Qwen2.5-VL-7B on 18 of 27 benchmarks and the 4B model exceeds Qwen2.5-VL-3B on all 27. Transformers supports the 4B and 8B Instruct checkpoints.

Links: Documentation | Paper

Ovis2.5

Ovis2.5, from AIDC-AI, is a multimodal model for image, video, and text understanding. It combines a native-resolution vision encoder, which keeps variable-resolution visual inputs as a sequence of patches rather than fixed-resolution tiles, with a visual tokenizer and a Qwen3 language backbone. It also offers an optional thinking prompt format for tasks that benefit from a longer reasoning response.

Links: Documentation | Paper

Kernels becomes a default dependency

Starting with this release, kernels is a base dependency of Transformers and is automatically installed with pip install transformers. Kernels are now enabled by default when loading models with from_pretrained, bringing out-of-the-box performance improvements to operations such as RMSNorm and RoPE, with particularly noticeable benefits for models using linear attention, such as Qwen3.5.

Another benefit is that Flash Attention is now available out of the box on supported hardware. Simply pass attn_implementation="flash_attention_2" when loading a model, and Transformers will automatically fall back to the corresponding Hub kernel if the Flash Attention package is not installed.

from transformers import AutoModelForCausalLM

model = AutoModelForCausalLM.from_pretrained(
    "Qwen/Qwen3.5-4B",
    device_map="auto",
    attn_implementation="flash_attention_2",
)

No separate installation of flash-attn or kernels is required.

To restore the previous behavior, pass use_kernels=False to from_pretrained.

Breaking changes

Molmo2VideoProcessor now samples frames the same way as the Hub processor's sample_frames (e.g. 21 instead of 19 frames for a 9.72 s video at 25 fps), so video inputs and outputs may differ from earlier releases; no code changes are required, but cached results should be regenerated.

  • 🚨 Molmo2: sample video frames like the Hub processor's sample_frames (#51325) by @lucamotz

Molmo2's image and video processors now compute image_token_pooling and video_token_pooling indices per item, with no offset from earlier items in the same call, so items can be cached, split, or concatenated safely. Code that relied on batch-global offsets must be updated, because the model now applies them.

  • 🚨 Molmo2: per-image and per-video pooling indices (#51309) by @lucamotz

Kernels are now enabled by default (use_kernels defaults to True in from_pretrained), so supported layers such as RoPE, RMSNorm, activations, and Mamba/FLA may load Hub kernels automatically; this requires a compatible kernels release, and you should pass use_kernels=False to keep the previous behavior.

Sub-processor loading was reworked to resolve from the nested processor dict, which adds a public ProcessorMixin.from_dict classmethod and deprecates the old non-keyword argument passing; custom processors or remote code that relied on the old arguments should migrate to the new keyword-based flow.

The causal conv1d, Mamba scan, and Mamba2 SSD steps in linear attention layers are now exposed as three kernelizable seams, so runtimes such as vLLM can replace them with kernelize;

  • 🚨 Make the causal conv1d, Mamba scan and Mamba2 SSD of linear attention layers kernelizable (#49186) by @hmellor

  • 🚨 [modular fix] remove failing freeze_encoder (#51252) by @ebezzam

  • 🚨 [PR2] [Modular Cleanup] *Norm canonicals and renaming (#50523) by @itazap

  • 🚨 [EP/TP] Deprecate TP on MoE (#50897) by @vasqu

Kernels

This release updates the kernels integration: it removes the legacy megablocksmoe kernel and the incorrect FalconMamba mamba_inner_fn kernel, bumps the minimum kernels version, and moves the fla hub kernel to v3. It also adds ROCm support for the deformable attention kernel, loads Hub kernels set on sub-configs in set_attn_implementation, and keeps the tensor-parallel gradient all-

Vision

This release fixes a range of vision and multimodal bugs. The fixes cover multi-GPU device_map="auto" splits for nine vision models, AutoProcessor and dynamic processor lookup with remote-code or per-backend image processors, Qwen3-VL video token expansion, Glm5Next tool-result image placeholders, Inkling vision tower dtype casting, and batch-dependent output in image-text-to-text and any-to-any pip

Attention

This release improves attention across several models and backends. Linear-attention-only models can now restart generation from an existing cache, Falcon no longer adds the ALiBi bias twice in eager attention, and the SDPA position bias mask no longer overflows under autocast. Continuous batching now auto-switches to flash attention only for half-precision models. SigLIP2 gains Flash Attention support, DeepSeek-V3 attention is sharded under tensor parallelism, and

Generation

Assisted decoding is more robust: caches with recurrent states can now be rolled back, which enables assisted generation for linear-attention models such as recent Qwen variants. Cropping in older assisted decoding methods is fixed, as are a crash when output_attentions=True is used with a model that returns no attentions and a speculative-sampling bug that could accept zero-probability draft tokens. generate() now auto-compiles on MPS, the mask generation guide

  • [docs] Fix the SAM post_process_masks calls in the mask generation guide (#51256) by @AlexxRussell in [#51256]
  • Enable auto-compilation in generate() on MPS (#51499) by @Isalia20 in [#51499]
  • Fix cropping in older assisted decoding methods (#51384) by @Cyrilvallez in [#51384]
  • [cache][generate] Allow rollback on recurrent states caches! (#51180) by @Cyrilvallez in [#51180]
  • Fix assisted decoding crash when the model returns no attentions (#51244) by @ranmori in [#51244]
  • [vLLM CI] Add more language / multimodal pooling models vs transformers, keep only HF comparisons in beam search (#51163) by @ydshieh in [#51163]
  • [vLLM CI] Add engine output processing, beam search and more language models vs transformers (#51141) by @ydshieh in [#51141]
  • [vLLM CI] Test more of vLLM's use of transformers: tokenizers / configs, outputs vs transformers, Transformers-backend multimodal generation (#51113) by @ydshieh in [#51113]
  • Never accept zero-probability draft tokens in speculative sampling (#51112) by @ydshieh in [#51112]

Cache

Cache handling was extended so that recurrent-state (linear-attention) caches now support rollback and can restart generation from an existing cache, enabling assisted decoding such as MTP for models like recent Qwens. Cache layers also gained an update(..., write=False) option that returns the would-be states without modifying the cache (now used by Dory's last_loop). Backward compatibility of the cache rename was fixed for remote code, and the read-only HF cache

  • Install the read-only HF cache fallback in run_distributed workers too (#51414) by @ydshieh in [#51414]
  • [vLLM CI] Fix the KV cache memory check failures (page cache eviction), one vLLM commit for all jobs, shared setup action (#51240) by @ydshieh in [#51240]
  • Cache layers: add update(..., write=False), use it for Dory last_loop (#50993) by @ArthurZucker in [#50993]
  • Fix backward compatibility of the cache rename for remote code (#51085) by @hmellor in [#51085]

Parallelization

This release improves tensor parallelism: a new "unit sharding" plan handles layers (such as q/k/v projections) whose output dimension must split into whole units, and a fix keeps the gradient all-reduce for replicated norms like Qwen3's q_norm/k_norm correct when use_kernels=True replaces forward. It also adds page geometry prediction (orientation, shear, perspective) to PP-DocLayoutV4 and removes the de

Quantization

Quantization docs were updated: the torchao examples across 19 model pages now use Int4WeightOnlyConfig(group_size=128) instead of the deprecated "int4_weight_only" string that raised a ValueError, and the broken HQQ blog link now points to its new location. In addition, Step3p7Experts now uses the shared experts backends (grouped_mm, batched_mm) via @use_experts_implementation

Serve

The transformers serve architecture was refactored so the API server is no longer a bottleneck. It keeps the familiar design, and multiple API servers are supported only in single-model (force-model) mode. The nightly vLLM CI also gained more vLLM-vs-transformers comparison tests, covering basic correctness, prompt embeds, tensorizer, compressed-tensors, language and hybrid models, the pooling API, logprobs, and per-model multimodal

  • [serve] Refactor server and engine architecture (#50927) by @SunMarc in [#50927]
  • [vLLM CI] Compare vLLM with transformers in more areas: basic correctness, prompt embeds API, tensorizer, compressed-tensors (#51196) by @ydshieh in [#51196]
  • [vLLM CI] More vLLM vs transformers tests: language / hybrid models, pooling API, logprobs, per-model multimodal files (#51194) by @ydshieh in [#51194]

Bugfixes and improvements

Significant community contributions

The following contributors have made significant changes to the library over the last release:

  • @ydshieh
    • Fix flaky hy_v4_vl backend equivalence test with Pillow 13 (#51585)
    • Use the namespaced Salesforce/wikitext dataset in Ministral sliding-window test (#51581)
    • Fix a kernel registration leak between tests in tests/kernels (#51415)
    • [CI] Fix tests after default kernels (#47773) - part 5: flash attention with float32 (idefics2, diffllama) (#51455)
    • [CI] Fix tests after default kernels (#47773) - part 2: flash attention equivalence / padding-free tests (#51442)
    • [CI] Fix tests after default kernels (#47773) - part 7: perceiver, ministral, x_clip, t5gemma, continuous batching, glm4v_moe, exaone4 (#51457)
    • [CI] Fix tests after default kernels (#47773) - part 1: test_model_parallelism (#51439)
    • [CI] Fix tests after default kernels (#47773) - part 4: flash attention integration tests (mistral, glm_ocr, qwen3_omni) (#51447)
    • [CI] Fix tests after default kernels (#47773) - part 3: test_flash_attn_2_fp32_ln (#51445)
    • Make SSH runner "Install utilities" step resilient to apt mirror failures (#51436)
    • Install the read-only HF cache fallback in run_distributed workers too (#51414)
    • Accept remote-code sub-processors that ignore return_unused_kwargs (#51365)
    • Restore sys.modules after the auto_docstring import-time test (#51281)
    • Fix axk1 / dots3_note integration tests after fp32 router gate change (#51067)
    • PR CI: cancel superseded merge-queue runs of the same PR (#51247)
    • [vLLM CI] Fix the KV cache memory check failures (page cache eviction), one vLLM commit for all jobs, shared setup action (#51240)
    • Pre-fetch the hf-internal-testing/test-videos assets for CI (#51150)
    • Fix speecht5 name in IMPORTANT_MODELS (#51230)
    • Fix flaky OWL-ViT / OWLv2 test_eager_matches_sdpa_inference (bf16) (#51148)
    • [vLLM CI] Compare vLLM with transformers in more areas: basic correctness, prompt embeds API, tensorizer, compressed-tensors (#51196)
    • [vLLM CI] More vLLM vs transformers tests: language / hybrid models, pooling API, logprobs, per-model multimodal files (#51194)
    • [vLLM CI] Compare more multimodal models with transformers (#51186)
    • [vLLM CI] Add more language / multimodal pooling models vs transformers, keep only HF comparisons in beam search (#51163)
    • [vLLM CI] Add engine output processing, beam search and more language models vs transformers (#51141)
    • Skip test_generate_from_multimodal_encoder_outputs for models without mm_encoder_outputs support (#51111)
    • [vLLM CI] Test vLLM features built on transformers tokenizers / processors, and multimodal models vs transformers (#51130)
    • Fix flaky image processor backend equivalence tests: configurable mean tolerance (#51110)
    • Fix flaky test_load_img_url_timeout: accept any timeout exception (#51108)
    • [vLLM CI] Test more of vLLM's use of transformers: tokenizers / configs, outputs vs transformers, Transformers-backend multimodal generation (#51113)
    • Never accept zero-probability draft tokens in speculative sampling (#51112)
    • Fix order-dependent test_advisory_warnings: pin transformers' warning_advice (#51109)
    • Fix flaky VideoLlama3 padding-free tests: flip input_ids together with the attention mask (#51107)
    • [SGLang CI] Show the transformers/SGLang commits and their dates in the Slack report (#51095)
    • [vLLM CI] Show transformers/vLLM commits in the Slack report, pip freeze before pytest (#51091)
    • Restore CUDA expectation for DeepseekV2 test_batch_fa2 (#51068)
  • @molbap
    • fix fusion_config random patch embeddings and leak into later loads (#51329)
    • Fix multi-GPU splits inside blocks for 9 vision models (#51376)
    • fix multi GPU tests for pi05 (#51226)
    • Add pi05 (#50161)
  • @vasqu
    • [Kernels] Remove last remains of megablocksmoe (#51541)
    • 🚨 Kernels=True ?! (#47773)
    • [Kernels] Fix logger location after version bump (#51344)
    • [GPT Oss] Fix test (#51343)
    • [Kernels] Bump min version (#51258)
    • Packing for bidirectional models (#51243)
    • [Kolibri 1.1] Rm moe tp (#51185)
    • 🚨 [EP/TP] Deprecate TP on MoE (#50897)
  • @lucamotz
    • 🚨 Molmo2: sample video frames like the Hub processor's sample_frames (#51325)
    • 🚨 Molmo2: per-image and per-video pooling indices (#51309)
    • Molmo2: count video tokens in _get_num_multimodal_tokens (#51310)
    • Merge kwargs in _get_num_multimodal_tokens of Ovis2.5, Fuyu, MUSE and Granite-Docling (#51379)
    • Fix PEFT load report listing tied adapter weights as missing (#51265)
    • Fix AutoProcessor with a remote-code image processor (#51323)
    • Let an explicit attn_implementation override a serialized _attn_implementation (#51251)
    • Fix PEFT load report listing other adapters' weights as missing (#51199)
    • Fix Phi3Config loading legacy "su" rope type (#51200)
  • @tarekziade
    • fix small paths tests errors in CI (#51554)
    • Fix DeBERTa q_bias/v_bias staying float32 when loaded in another dtype (#50201)
    • Post the model integration contracts gate on the PR (#51311)
    • Make add_dates.py --check-only fail instead of silently passing in CI (#51334)
    • record-mic: re-record MIC expected values for a PR (#51119)
    • Fix TIPSv2 bfloat16 forward: text pooling returned float32 (#50175)
    • Remove benchmark_v2 (moved to huggingface/transformers-perf) (#51117)
    • [vLLM CI] Test transformers main instead of the latest release (#51090)
  • @cyxu0401
    • Add MiniCPM5-15B-A2.5B support (#51218)
  • @maxiaolong03
    • [PP-DocLayoutV4] Add page geometry prediction (#49551)
  • @g1050
    • Add LLaVA-OneVision-1.5 model and related configurations (#41095)
  • @ArthurZucker
    • [distributed] Add a new parallel plan for unit sharding (#48848)
    • Move YaRN mscale helpers into modeling_rope_utils (#51175)
    • Cache layers: add update(..., write=False), use it for Dory last_loop (#50993)
  • @itazap
    • step3p7 to use experts implementation, drop fp8 flag (#51238)
    • 🚨 [PR2] [Modular Cleanup] *Norm canonicals and renaming (#50523)
    • [PR1] [Modular Clean-Up] Remove No-op Overrides (#50317)
  • @mstojkovicTT
    • Use F.rms_norm in LlamaRMSNorm and the norms derived from it (#42461)
  • @sushmanthreddy
    • Add Ovis2.5 model support (#47659)

Don't miss a new transformers release

NewReleases is sending notifications on new releases.