Text Ranking
sentence-transformers
ONNX
Safetensors
modernbert
cross-encoder
reranker
multilingual
text-embeddings-inference
hindsight
Instructions to use hindsight-ai/hs-rerank-1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use hindsight-ai/hs-rerank-1 with sentence-transformers:
from sentence_transformers import CrossEncoder model = CrossEncoder("hindsight-ai/hs-rerank-1") query = "Which planet is known as the Red Planet?" passages = [ "Venus is often called Earth's twin because of its similar size and proximity.", "Mars, known for its reddish appearance, is often referred to as the Red Planet.", "Jupiter, the largest planet in our solar system, has a prominent red spot.", "Saturn, famous for its rings, is sometimes mistaken for the Red Planet." ] scores = model.predict([(query, passage) for passage in passages]) print(scores) - Notebooks
- Google Colab
- Kaggle
hs-rerank-1
hs-rerank-1 is a multilingual cross-encoder reranker built for Hindsight. It reads a query and a document together and returns a relevance score.
Highlights
- Multilingual: English, Spanish, French, German, Portuguese, Japanese, Korean and Chinese (Simplified and Traditional).
- Long inputs: up to 8,192 tokens per query and document pair.
- Small: 114M parameters. 98M of them are the token embedding table, so each forward pass runs a 15M-parameter transformer.
- CPU and GPU: ships an int8 ONNX export for CPU, and safetensors for GPU in FP16.
- Serves on TEI: CPU and GPU images.
Model overview
| Model type | Cross-encoder reranker |
| Base model | jhu-clsp/mmBERT-small |
| Parameters | 114M |
| Languages | en, es, fr, de, pt, ja, ko, zh |
| Context length | 8,192 tokens |
| Output | One relevance score per query and document pair |
| Formats | safetensors stored in FP16 (FP32 copy on the fp32 branch), ONNX (onnx/model.onnx, int8 vocabulary table) |
Evaluation
Usage
Sentence Transformers
pip install -U sentence-transformers
from sentence_transformers import CrossEncoder
model = CrossEncoder("hindsight-ai/hs-rerank-1")
query = "¿Qué app de presupuesto estoy creando?"
documents = [
"El usuario quiere tooltips en su app de presupuesto.",
"El usuario corre los domingos por la mañana.",
]
print(model.rank(query, documents))
# [{'corpus_id': 0, 'score': 0.9647}, {'corpus_id': 1, 'score': 0.0003}]
predict and rank return scores between 0 and 1. Pass activation_fn=torch.nn.Identity()
for raw logits.
Text Embeddings Inference
CPU (uses onnx/model.onnx):
docker run -p 8080:80 \
ghcr.io/huggingface/text-embeddings-inference:cpu-1.9.3 \
--model-id hindsight-ai/hs-rerank-1 --auto-truncate \
--max-client-batch-size 128
GPU:
docker run --gpus all -p 8080:80 \
ghcr.io/huggingface/text-embeddings-inference:89-1.9.3 \
--model-id hindsight-ai/hs-rerank-1 --auto-truncate \
--max-client-batch-size 128
Use the GPU image tag for your GPU: 89-1.9.3 for L4 and other Ada GPUs, 1.9.3 for A100
and H100.
curl 127.0.0.1:8080/rerank \
-H 'Content-Type: application/json' \
-d '{
"query": "¿Qué app de presupuesto estoy creando?",
"texts": [
"El usuario quiere tooltips en su app de presupuesto.",
"El usuario corre los domingos por la mañana."
]
}'
Hindsight
HINDSIGHT_API_RERANKER_PROVIDER=local
HINDSIGHT_API_RERANKER_LOCAL_MODEL=hindsight-ai/hs-rerank-1
Or point Hindsight at a TEI server:
HINDSIGHT_API_RERANKER_PROVIDER=tei
HINDSIGHT_API_RERANKER_TEI_URL=http://localhost:8080
Hindsight Inference
hs-rerank-1 is also served at https://inference.hindsight.vectorize.io. To use it from
Hindsight:
HINDSIGHT_API_RERANKER_PROVIDER=hindsight
HINDSIGHT_API_RERANKER_HINDSIGHT_API_KEY=<your Hindsight Inference API key>
License
MIT
Citation
@misc{hindsightai2026hsrerank1,
title = {hs-rerank-1},
author = {{Hindsight AI}},
year = {2026},
url = {https://huggingface.co/hindsight-ai/hs-rerank-1}
}
- Downloads last month
- 56
Model tree for hindsight-ai/hs-rerank-1
Base model
jhu-clsp/mmBERT-small
