The `rerankers` subsystem provides a modular framework for various transformer-based reranking models. At its core, the `TransformerRanker` serves as a generic base, handling common operations like tokenization and the overall ranking process. Specialized rerankers, such as `ColBERTRanker`, `MonoVLMRanker`, `MXBAIV2Ranker`, `T5Ranker`, and `UPRRanker`, extend this functionality by implementing their unique model-specific inference and scoring mechanisms. For instance, `ColBERTRanker` delegates its primary `rank` operation to an internal `_colbert_rank` method, which then orchestrates the distinct encoding of queries and documents, followed by interaction-based scoring. Similarly, `MXBAIV2Ranker` relies on an internal `_predict` method, which in turn prepares batches for efficient processing. This design ensures that each reranker component encapsulates its specific logic while leveraging a common interface for integration.
Components
TransformerRanker
Implements a generic reranking strategy for transformer models (e.g., CrossEncoder). It handles the core logic for model loading, tokenization, and inference common to many transformer-based rerankers.
Referenced Source Code
ColBERTRanker
Provides a specific reranking strategy based on the ColBERT architecture, including distinct query and document encoding, and interaction-based scoring.
Referenced Source Code
MonoVLMRanker
Implements the reranking strategy for MonoVLM models, focusing on their specific inference and scoring mechanisms.
Referenced Source Code
MXBAIV2Ranker
Encapsulates the reranking logic for MXBAI V2 models, managing batch preparation and prediction.
Referenced Source Code
T5Ranker
Implements the reranking strategy specific to T5 models, including their unique scoring mechanism via decoding.
Referenced Source Code
UPRRanker
Implements the reranking strategy for UPR (Unsupervised Passage Reranking) models, focusing on their distinct scoring methodology.