Heuristic:Deepset ai Haystack Warning Deprecated TransformersSimilarityRanker
| Knowledge Sources | |
|---|---|
| Domains | Ranking, Deprecation |
| Last Updated | 2026-02-11 20:00 GMT |
Overview
Deprecation warning: TransformersSimilarityRanker is considered legacy by Haystack maintainers and will no longer receive updates. Use SentenceTransformersSimilarityRanker instead.
Description
The TransformersSimilarityRanker component logs a soft deprecation warning on every instantiation. The Haystack maintainers have marked it as legacy code that may be deprecated in a future release, with removal following after a deprecation period. The recommended replacement is SentenceTransformersSimilarityRanker, which provides the same cross-encoder reranking functionality along with additional features.
Usage
Apply this heuristic when selecting a reranking component for new pipelines. Avoid TransformersSimilarityRanker for new projects. If you have existing pipelines using it, plan a migration to SentenceTransformersSimilarityRanker before the next major Haystack release.
The Insight (Rule of Thumb)
- Action: Replace
TransformersSimilarityRankerwithSentenceTransformersSimilarityRankerin all new and existing pipelines. - Value: Drop-in replacement; same cross-encoder models are supported.
- Trade-off: Migration effort is minimal since the API surface is similar. SentenceTransformersSimilarityRanker has additional features not available in the legacy component.
Reasoning
The source code at haystack/components/rankers/transformers_similarity.py:114-120 emits a warning on every instantiation:
soft_deprecation_message = (
"TransformersSimilarityRanker is considered legacy and will no longer receive updates. "
"It may be deprecated in a future release, with removal following after a deprecation period. "
"Consider using SentenceTransformersSimilarityRanker instead, which provides the same functionality "
"along with additional features."
)
logger.warning(soft_deprecation_message)
This is not yet a formal @deprecated decorator, but it signals the maintainers' intent to phase out this component.