A Guth Labs publication ↗
Back to News

Hugging Face Transformers unifies its model cache API

Hugging Face released Transformers 5.24.0 on November 21, giving developers a single name for the cache that models pass between steps of text generation. The version is available on PyPI.

The change replaces two names, past_key_values and cache_params, with cache in model calls and outputs. The cache holds state from earlier steps so the model can reuse it rather than compute it again. The older names still work during a transition, but their use now triggers a deprecation warning. Support for them in model calls is scheduled to end in version 5.40.0; the old names in generation and model outputs are scheduled to go away in version 6.

A Hugging Face compatibility note points out one immediate exception: code that inspects a model’s function signature to look for the old name will no longer find it. That distinction matters for developers maintaining wrappers or integrations. Ordinary calls have a grace period, but code that automatically detects a model’s arguments may need updating sooner.

Sources and citations

Revision history

Published . No corrections recorded.

Related stories