Hugging Face released Transformers v5.25.0 on 1 December 2026. The release notes add a long list of new architectures. But the change most likely to affect existing code is that Hub kernels are now on by default. The kernels package is a required dependency, and from_pretrained() loads optimised kernels for operations like RMSNorm and RoPE automatically.

This guide covers what the kernels change means, how to use Flash Attention without installing flash-attn, how to turn kernels off when you need to, and the breaking changes to check before upgrading.

Upgrade

pip install -U "transformers==5.25.0"
pip show kernels   # now installed automatically

We checked the published wheel. Its metadata lists kernels>=0.19.1,<0.20 as a base requirement next to huggingface-hub, tokenizers and safetensors. You don’t need an extra to get it.

What “kernels by default” means

Hub kernels (from the kernels project) are pre-compiled, optimised implementations of common layers, downloaded from the Hugging Face Hub. Before 5.25 you had to opt in. Now use_kernels effectively defaults to True. The notes say this gives “out-of-the-box performance improvements to operations such as RMSNorm and RoPE”, with the most noticeable gains on models that use linear attention, such as Qwen3.5. Supported layers can include RoPE, RMSNorm, activations and Mamba/FLA blocks.

We also read the logic in the 5.25.0 from_pretrained() code:

  • If you don’t pass use_kernels, it becomes True.
  • If the environment variable USE_HUB_KERNELS disables kernels, they’re turned off. If you also pass use_kernels=True, you get a warning that the environment variable wins.

Flash Attention without installing flash-attn

A nice side effect: Flash Attention now works out of the box on supported hardware. Ask for it, and if the flash-attn package isn’t installed, Transformers falls back to the matching Hub kernel:

from transformers import AutoModelForCausalLM, AutoTokenizer

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

inputs = tokenizer("Explain KV caching in one paragraph.", return_tensors="pt").to(model.device)
out = model.generate(**inputs, max_new_tokens=120)
print(tokenizer.decode(out[0], skip_special_tokens=True))

The release says: “No separate installation of flash-attn or kernels is required.” That saves the long, error-prone flash-attn compile on many machines.

How to turn kernels off

There are good reasons to turn kernels off: an air-gapped cluster that can’t reach the Hub, a strict reproducibility requirement, or hunting down a numerical difference. You have two switches.

Per model:

model = AutoModelForCausalLM.from_pretrained(model_id, use_kernels=False)

For the whole process (handy in CI or containers):

export USE_HUB_KERNELS=NO
python train.py

In a test suite, set it in the job’s environment so every model load behaves the same way.

Comparing outputs before and after

Optimised kernels can change floating-point results slightly. If you have golden-output tests, compare the two modes on the same prompt instead of expecting exact equality:

import torch
from transformers import AutoModelForCausalLM, AutoTokenizer

model_id = "Qwen/Qwen3.5-4B"
tok = AutoTokenizer.from_pretrained(model_id)
batch = tok(["The capital of France is"], return_tensors="pt")

def logits(use_kernels: bool):
    m = AutoModelForCausalLM.from_pretrained(model_id, use_kernels=use_kernels,
                                             dtype=torch.bfloat16, device_map="auto")
    with torch.no_grad():
        return m(**batch.to(m.device)).logits.float().cpu()

a, b = logits(True), logits(False)
print("max abs diff:", (a - b).abs().max().item())
print("same top token:", torch.equal(a[0, -1].argmax(), b[0, -1].argmax()))

Small differences are expected. A different top token on simple prompts is worth reporting.

Breaking changes to check

The release lists several changes marked 🚨. The ones most likely to matter:

  • Molmo2 video frames: Molmo2VideoProcessor now samples frames the same way as the Hub processor. The notes give an example of 21 frames instead of 19 for a 9.72 s video at 25 fps. No code change is needed, but regenerate any cached results.
  • Molmo2 pooling indices: image and video processors now compute image_token_pooling and video_token_pooling per item, with no offset from earlier items. Code that relied on batch-wide offsets must be updated.
  • Sub-processor loading: reworked to resolve from the nested processor dict. It adds a public ProcessorMixin.from_dict class method and deprecates passing old arguments by position. Custom processors and remote code should move to keyword arguments.
  • Linear attention seams: the causal conv1d, Mamba scan and Mamba2 SSD steps can now be swapped out by runtimes such as vLLM.
  • Tensor parallelism on MoE is deprecated.

The kernels integration was also cleaned up. The legacy megablocksmoe kernel and an incorrect FalconMamba kernel were removed, the minimum kernels version went up, and ROCm support was added for the deformable attention kernel.

New models in 5.25

The release adds several architectures. A few from the notes:

  • Ergo (Amazon): open-weights mixture-of-experts for software engineering and agent work, with 1.1 trillion total and 55 billion active parameters and a 1M-token context, according to the release notes
  • Kolibri 1.1 (Aleph Alpha): a reference implementation supporting eager and SDPA attention
  • MiniCPM5-15B-A2.5B: 15B total and 2.5B active parameters per token
  • PI0.5 (Physical Intelligence): a vision-language-action model for robot manipulation
  • Param2Moe: the architecture behind BharatGen AI’s Param-2-17B-MoE-A2.4B, which supports English, Hindi and other Indian languages
  • Ovis2.5 (AIDC-AI): multimodal image, video and text understanding

Upgrade checklist

  1. Pin transformers==5.25.0 in a branch and run your test suite.
  2. If your servers can’t reach the Hub, set USE_HUB_KERNELS=NO or pass use_kernels=False.
  3. Replace separate flash-attn installs with attn_implementation="flash_attention_2" where the Hub fallback works for your hardware.
  4. Regenerate Molmo2 video caches and update pooling-index code.
  5. Move custom processors to keyword-based loading.

Takeaway

Transformers 5.25 makes fast paths the default. For most people that means quicker models and painless Flash Attention, with no extra installs. For teams with locked-down networks or strict numerical tests, it means adding one environment variable. Upgrade in a branch, compare outputs, and read the full v5.25.0 notes if you use Molmo2 or custom processors.