Overview
The Hugging Face reranker provider gives you access to thousands of reranking models available on the Hugging Face Hub. This includes popular models like BAAI’s BGE rerankers and other state-of-the-art cross-encoder models.Configuration
Basic Setup
Configuration Parameters
Parameter | Type | Default | Description |
---|---|---|---|
model | str | Required | Hugging Face model identifier |
device | str | ”cpu” | Device to run model on (“cpu”, “cuda”, “mps”) |
batch_size | int | 32 | Batch size for processing |
max_length | int | 512 | Maximum input sequence length |
trust_remote_code | bool | False | Allow remote code execution |
Advanced Configuration
Popular Models
BGE Rerankers (Recommended)
Multilingual Models
Domain-Specific Models
Usage Examples
Basic Usage
Batch Processing
Performance Optimization
GPU Acceleration
Memory Optimization
Model Comparison
Model | Size | Quality | Speed | Memory | Best For |
---|---|---|---|---|---|
bge-reranker-base | 278M | Good | Fast | Low | General use |
bge-reranker-large | 560M | Better | Medium | Medium | High quality needs |
bge-reranker-v2-m3 | 568M | Best | Medium | Medium | Latest improvements |
bge-reranker-v2-multilingual | 568M | Good | Medium | Medium | Multiple languages |
Error Handling
Custom Models
Using Private Models
Local Model Path
Best Practices
- Choose the Right Model: Balance quality vs speed based on your needs
- Use GPU: Significantly faster than CPU for larger models
- Optimize Batch Size: Tune based on your hardware capabilities
- Monitor Memory: Watch GPU/CPU memory usage with large models
- Cache Models: Download once and reuse to avoid repeated downloads