Skip to main content

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

Advanced Configuration

TypeScript (self-hosted)

The TypeScript OSS SDK (mem0ai/oss) runs this reranker locally with Transformers.js, the same cross-encoder path as sentence_transformer, just a different default model. It executes ONNX weights, so the default is the ONNX mirror Xenova/bge-reranker-base. Point model at any ONNX-exported reranker on the Hub (a raw BAAI/bge-reranker-* PyTorch checkpoint will not load in this runtime).
batchSize and showProgressBar are accepted for parity with the Python SDK but are no-ops in the TypeScript runtime. trust_remote_code and model_kwargs are Python-only.

Multilingual Models

Domain-Specific Models

Usage Examples

Basic Usage

Batch Processing

Performance Optimization

GPU Acceleration

Memory Optimization

Model Comparison

Error Handling

Custom Models

Using Private Models

Local Model Path

Best Practices

  1. Choose the Right Model: Balance quality vs speed based on your needs
  2. Use GPU: Significantly faster than CPU for larger models
  3. Optimize Batch Size: Tune based on your hardware capabilities
  4. Monitor Memory: Watch GPU/CPU memory usage with large models
  5. Cache Models: Download once and reuse to avoid repeated downloads

Troubleshooting

Common Issues

Out of Memory Error
Model Download Issues
CUDA Not Available

Next Steps

Reranker Overview

Learn about reranking concepts

Configuration Guide

Detailed configuration options