Transformers 5.24.0 Renames the Cache and Adds New Models

Transformers 5.24.0, released 21 November 2026, renames past_key_values to cache, adds Inkling 2 Mini and Omnilingual ASR, and needed a patch three days later.

Transformers 5.24.0 arrived on 21 November 2026 with a rename that touches nearly every generation call in the library, ten new model families, and a security change to how exported models load. Three days later, version 5.24.1 walked back part of the breaking change because vLLM broke. The release notes tell that story plainly, and the patch is the most useful part of it: it shows which corners of the rename were safe and which ones were not.

The version needs Python 3.11 or newer and PyTorch 2.6 or newer. PyPI recorded the upload on 21 November at 12:24 UTC, and the GitHub release followed minutes later. This article works from the v5.24.0 release notes, the PyPI metadata, and the v5.24.1 patch notes.

One name for the cache

The headline change is small to describe and wide to apply. past_key_values and cache_params are now both called cache, in model forward signatures, in generate, in prepare_inputs_for_generation, in the masking utilities, and in every ModelOutput. The old names still work in 5.24.0 with a one-time deprecation warning. The release notes put removal at v5.40.0 for forward and prepare_inputs_for_generation, and at v6.0.0 for generate. Passing an old name and cache together raises a ValueError, so a call site has to pick one.

The rename exists because the library had two names for one object. Attention models called their cache past_key_values. Mamba-style and linear-attention models called it cache_params. Hybrid models, which mix both kinds of layers, had to juggle both names for the same thing. One name removes that split, and it also simplifies the code that hands a cache between layers: custom Cache subclasses that override update now receive an extra kwargs argument, and the release notes ask their authors to accept it.

The same section of the notes carries a dependency change that matters more than it looks. peft 0.22.0 or newer is now required, because adapter training and loading had to follow the rename. A project that pins transformers and leaves peft floating will pick up the new floor on its next install, but a project that pins both needs the peft bump written down explicitly. The install line the release notes suggest is uv pip install -U "transformers[torch]==5.24.0" "peft>=0.22.0".

Output objects follow the same rule. outputs.past_key_values, outputs.cache_params, and outputs["past_key_values"] still return the cache, and output classes can still be built with the old field names, which is why most remote-code models keep working unchanged. The code that does break is the code that checks an output class by name. Generative multimodal models now return shared output classes, MultimodalBaseModelOutputWithPast and MultimodalCausalLMOutputWithPast plus their mixture-of-experts variants, instead of one output class per model. Anything that branches on a model-specific output class needs to switch to the shared names.

A short snippet from the release notes shows the new shape:

Python
from transformers import AutoModelForCausalLM, AutoTokenizer, StaticCache

model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2.5-1.5B", dtype=torch.bfloat16, device_map="auto")
past_cache = StaticCache(
    config=model.config, max_batch_size=1, max_cache_len=256,
    device=model.device, dtype=torch.bfloat16,
)
outputs = model.generate(**inputs, max_new_tokens=64, cache=past_cache)

The cache work goes further than the rename. Static cache now works with assisted decoding, generate with flex attention and a static cache is fixed, StaticCache allocates its values with the value states’ dtype, and the cache survives activation checkpointing when gradients are off. Two properties for hybrid models, is_linear and is_croppable, are fixed, BigBird block-sparse decoding works with a KV cache again, and KV sharing is restored for the Gemma 4 assistants. None of this changes an API. It changes how much of the cache machinery a serving setup can rely on without working around it.

The new models, in brief

Ten model families land in this release, and three of them are worth a closer look because they change what the library can run rather than adding another checkpoint to a familiar architecture.

Inkling 2 Mini, from Thinking Machines Lab, is the smaller sibling of Inkling 2 Small, which arrived in v5.23.0. It has 24 decoder layers instead of 48 and makes up the difference by looping layers 6 to 17 three times, with a learned message-passing step that mixes the previous pass’s residuals into each loop layer’s attention and expert inputs. Each token routes to 8 of 128 experts, the hidden size is 2304, and the image encoder, tokenizer, and processor are shared with Inkling 2 Small. A research checkpoint supports a variable number of loop passes, so fewer passes run faster and more passes improve quality. Both checkpoints carry NVFP4 and MXFP8 quantized layers that are dequantized at load time. The loop is the interesting part: a model that spends more compute per token on demand, on the same weights, is a different trade-off from a model that is simply bigger.

Omnilingual ASR, from Meta FAIR, is a speech-recognition suite covering more than 1,600 languages. Each model pairs a Wav2Vec2-style audio encoder with one of two heads: a CTC head decoded non-autoregressively, or an audio language-model head that projects audio embeddings into a Llama decoder and generates the transcription, optionally taking a language code such as eng_Latn. Both variants come in 300M, 1B, 3B, and 7B sizes. The language count is the headline, but the two-head design is the practical detail: the CTC head is the fast path, the language-model head is the accurate one, and a pipeline can pick between them per use case.

Dory, from NVIDIA, is a looped language model built on a normalized-GPT architecture with interleaved sliding-window and full attention layers. A shared block of layers is applied repeatedly, and the loop count can be changed at inference time on the same checkpoint to trade speed against quality. Dory and Inkling 2 Mini point in the same direction from different labs: depth as a runtime dial instead of a fixed property of the weights.

The rest of the list fills out the multimodal and multilingual coverage. Apertus 1.5, from the Swiss AI Initiative, takes text, images, and audio and generates text, using the EMU3.5 vision tokenizer and WavTokenizer for audio. WavTokenizer itself is now a standalone model in the library: it encodes 24 kHz mono audio into discrete tokens with a single codebook at 40 or 75 tokens per second. HY4-VL is Hunyuan’s vision-language model with dynamic-resolution visual inputs and multimodal rotary position embeddings. Lara Mini, from Translated, is a 7.2B total, 0.6B active multilingual base model mixing linear-time recurrent layers, sliding-window attention, and a few global attention layers; its weights are under CC BY-NC-SA 4.0 in a gated repository, so it is non-commercial use only. Sarvam AI contributes two models: Sarvam-105B, a mixture-of-experts model with multi-head latent attention, 128 routed experts with 8 active per token, and a 131K context window, and Sarvam-30B, which reuses the GLM-4-MoE architecture. LG’s EXAONE 3.0, 3.5, and Deep load through the Llama implementation now, which means they no longer need trust_remote_code=True. Ling 3.1 Flash loads natively through BailingHybrid, and the Beam model gains a token-classification head.

Readers who followed the GGUF work in September will recognise the pattern. Our earlier piece on Transformers loading GGUF files covered the library absorbing a format people already used. This release does the same for architectures: EXAONE drops its remote-code requirement, Sarvam-30B reuses an existing implementation, and the model list grows by wiring familiar pieces together rather than by inventing new ones.

A tighter security default

Two changes in this release tighten the boundary around code that the library executes on a user’s behalf. Pickled .pt2 exports now require trust_remote_code=True to load. A pickle file can run arbitrary code during deserialization, so loading one from an untrusted Hub artifact used to be a silent risk. It is now an explicit choice, and the flag belongs only on vetted, pinned model revisions. ONNX, OpenVINO, and ExecuTorch exports load without the flag, because those formats do not carry executable code the same way.

The second change is the removal of modeling_attn_mask_utils.py. Every function in it had been deprecated in favour of transformers.masking_utils, and the module is gone in 5.24.0. Remote-code models that still import _prepare_4d_causal_attention_mask or AttentionMaskConverter from it have to move their imports. That sentence in the release notes looks like routine cleanup. The patch three days later shows it was not.

Three days later, a patch walked some of it back

Version 5.24.1 was published on 24 November, and its notes are short enough to quote in full in spirit: a patch to fix a bunch of stuff for vLLM, a few distributed issues, and some model fixes. The vLLM items are the ones that matter. The patch fixes backward compatibility of the cache rename for remote code, restores modeling_attn_mask_utils for remote code as a one-off to unblock vLLM, and exposes past_key_values in MBartDecoderLayer.forward for remote code. In other words, the module that 5.24.0 removed is back, for remote code, because a serving engine that loads other people’s model code could not move as fast as the library did.

The remaining fixes are narrower: a Llama4 forward crash on missing image outputs, a Dory static-cache fix, expert parallelism on its own with an empty tensor-parallel plan, and strided checkpoint reads on PyTorch 2.9. None of them changes the advice for most users, but together they set the version to pin. Anyone upgrading should go straight to 5.24.1. The 5.24.0 release is the one with the features; 5.24.1 is the one that runs in production next to vLLM.

The patch also frames the rename honestly. A rename with a deprecation period is safe for code the library owns. It is not safe for code the library loads from the Hub, written by strangers, on a schedule the library does not control. The three-day gap between the two releases is the cost of finding that out in production rather than in review.

How to upgrade without breaking your pipeline

Method first, because the claims above come from different kinds of evidence and the reader should be able to tell them apart. Version numbers, dates, API names, and removal deadlines come from the v5.24.0 and v5.24.1 release notes and the PyPI metadata, all linked above. The three generation and data fixes named below are listed in the v5.24.0 notes under their pull-request numbers. Nothing in this article comes from running the release on our own hardware, and no benchmark number here is ours. A reader can verify the version facts from the linked release pages and reproduce the upgrade checks with a fresh virtual environment and the pinned versions.

The release notes record three fixes in generation and data handling. Constrained sampling now preserves batch IDs (pull request 50883). DataCollatorWithFlattening no longer throws a label-length error on mixed empty and non-empty batches, and an all-empty batch raises an explicit error instead (pull request 50984). UMT5 output scaling is separated from word-embedding tying, so an untied setting no longer loses decoder-output scaling (pull request 50950). The notes list these fixes without claiming the surrounding edge cases are closed, which is why the checklist below still asks for regression checks on tensor-parallel gradient accumulation and beam-search padding before an upgrade.

The upgrade checklist follows from the release notes:

  1. Pin transformers==5.24.1, not 5.24.0, and peft>=0.22.0 in the same change.
  2. Search the codebase and any custom Hub models for past_key_values, cache_params, and modeling_attn_mask_utils before upgrading. The grep is the migration: grep -rn "past_key_values\|cache_params\|modeling_attn_mask_utils" --include="*.py" . finds every call site that needs the new name.
  3. Audit .pt2 loaders. Any intentional pickle deserialization needs an explicit trust_remote_code=True, and only for vetted, pinned revisions.
  4. Check output-class assertions. Code that checks for a model-specific multimodal output class should switch to the shared MultimodalCausalLMOutputWithPast family.
  5. If the pipeline uses tensor parallelism with gradient accumulation, or beam search with pad_token_id=0, add a regression check that compares microbatch gradients against a single-rank baseline and inspects raw output token IDs after EOS.

The PyTorch side of the stack is moving on a similar schedule. PyTorch 2.14 changed the clamp gradient to zero in October, and the 2.15 release that followed it is the version Transformers 5.24.0 was tested against in the forum thread. Pinning the framework and the library together, and upgrading them together, is the boring advice that keeps a serving setup out of the patch notes. The vLLM angle is covered in our earlier comparison of vLLM, TensorRT-LLM, and ONNX Runtime; the 5.24.1 patch is a reminder that the serving engine and the model library upgrade as a pair, not as separate steps.

What the weekly cadence means

The v5.x line has shipped a minor release almost every week since mid-October: 5.20.0 in mid-October, 5.21.0 and 5.22.2 by early November, 5.23.0 on 13 November, 5.24.0 on 21 November, and a patch three days after that. A weekly rhythm makes a rename like this one survivable, because the deprecation window is measured in versions rather than in quarters, and a bad removal gets a patch instead of a quarter-long wait. It also makes pinning non-optional. A project that floats transformers will absorb a rename, a dependency floor, and a removed module in a routine install, and the failure will arrive as a serving error rather than a changelog entry. Pin the version, read the notes, and run the grep before upgrading, because the release notes for 5.24.0 name the deadline for every old name, and the patch three days later names the cost of getting one of them wrong.

Share this article

X Facebook LinkedIn Reddit Telegram

Your notes on this article

Your name or initials, note and date stay in this browser profile. Anyone using the profile can read them. Delete a note below or clear this site’s browser data. To reach the editors, report a correction.

No notes saved here