metadata
language:
- en
license: apache-2.0
tags:
- cross-encoder
- sentence-transformers
- text-classification
- sentence-pair-classification
- semantic-similarity
- semantic-search
- retrieval
- reranking
- generated_from_trainer
- dataset_size:40015318
- loss:BinaryCrossEntropyLoss
base_model: lightonai/Reason-ModernColBERT
datasets:
- adbaral/langcache-sentencepairs-v3
pipeline_tag: text-ranking
library_name: sentence-transformers
Redis fine-tuned CrossEncoder model for semantic caching on LangCache
This is a Cross Encoder model finetuned from lightonai/Reason-ModernColBERT on the LangCache Sentence Pairs (subsets=['all'], train+val=True) dataset using the sentence-transformers library. It computes scores for pairs of texts, which can be used for sentence pair classification.
Model Details
Model Description
- Model Type: Cross Encoder
- Base model: lightonai/Reason-ModernColBERT
- Maximum Sequence Length: 127 tokens
- Number of Output Labels: 1 label
- Training Dataset:
- Language: en
- License: apache-2.0
Model Sources
- Documentation: Sentence Transformers Documentation
- Documentation: Cross Encoder Documentation
- Repository: Sentence Transformers on GitHub
- Hugging Face: Cross Encoders on Hugging Face
Usage
Direct Usage (Sentence Transformers)
First install the Sentence Transformers library:
pip install -U sentence-transformers
Then you can load this model and run inference.
from sentence_transformers import CrossEncoder
# Download from the 🤗 Hub
model = CrossEncoder("redis/langcache-reranker-v2-reasonmoderncolbert-bce-eps0.5")
# Get scores for pairs of texts
pairs = [
['The newer Punts are still very much in existence today and race in the same fleets as the older boats .', 'The newer punts are still very much in existence today and run in the same fleets as the older boats .'],
['Turner Valley , was at the Turner Valley Bar N Ranch Airport , southwest of the Turner Valley Bar N Ranch , Alberta , Canada .', 'Turner Valley Bar N Ranch Airport , , was located at Turner Valley Bar N Ranch , southwest of Turner Valley , Alberta , Canada .'],
['After losing his second election , he resigned as opposition leader and was replaced by Geoff Pearsall .', 'Max Bingham resigned as opposition leader after losing his second election , and was replaced by Geoff Pearsall .'],
['She married Peter Haygarth on 29 May 1964 in Durban . Her second marriage , to Robin Osborne , took place in 1977 .', 'She married Robin Osborne on May 29 , 1964 in Durban , and her second marriage with Peter Haygarth took place in 1977 .'],
['In 2005 she moved to Norway , settled in Geilo and worked as a rafting guide , in 2006 she started mountain biking - races .', 'In 2005 , she moved to Geilo , settling in Norway and worked as a rafting guide . She started mountain bike races in 2006 .'],
]
scores = model.predict(pairs)
print(scores.shape)
# (5,)
# Or rank different texts based on similarity to a single text
ranks = model.rank(
'The newer Punts are still very much in existence today and race in the same fleets as the older boats .',
[
'The newer punts are still very much in existence today and run in the same fleets as the older boats .',
'Turner Valley Bar N Ranch Airport , , was located at Turner Valley Bar N Ranch , southwest of Turner Valley , Alberta , Canada .',
'Max Bingham resigned as opposition leader after losing his second election , and was replaced by Geoff Pearsall .',
'She married Robin Osborne on May 29 , 1964 in Durban , and her second marriage with Peter Haygarth took place in 1977 .',
'In 2005 , she moved to Geilo , settling in Norway and worked as a rafting guide . She started mountain bike races in 2006 .',
]
)
# [{'corpus_id': ..., 'score': ...}, {'corpus_id': ..., 'score': ...}, ...]
Training Details
Training Dataset
LangCache Sentence Pairs (subsets=['all'], train+val=True)
- Dataset: LangCache Sentence Pairs (subsets=['all'], train+val=True)
- Size: 40,015,318 training samples
- Columns:
sentence1,sentence2, andlabel - Approximate statistics based on the first 1000 samples:
sentence1 sentence2 label type string string float details - min: 27 characters
- mean: 110.99 characters
- max: 199 characters
- min: 29 characters
- mean: 110.74 characters
- max: 191 characters
- min: 0.25
- mean: 0.49
- max: 0.75
- Samples:
sentence1 sentence2 label The film was remade in Telugu with the same name in 1981 by Chandra Mohan , Jayasudha , Chakravarthy and S. P. Balasubrahmanyam starring K. Vasu .The film was written in Telugu with the same name in 1981 by Chandra Mohan , Jayasudha , Chakravarthy and S. P. Balasubrahmanyam with K. Vasu .0.75The Cauchy stress tensor has therefore the following formTherefore , the cauchy tensor has the following form0.75John Jairo Culma , sometimes spelled as Jhon Jairo Culma ( born 17 March 1981 ) is a Colombian footballer .John Jairo Culma , sometimes known as Jhon Jairo Culma ( born March 17 , 1981 ) , is a Colombian footballer .0.75 - Loss:
BinaryCrossEntropyLosswith these parameters:{ "activation_fn": "torch.nn.modules.linear.Identity", "pos_weight": 0.1028856709599495 }
Evaluation Dataset
LangCache Sentence Pairs (split=test)
- Dataset: LangCache Sentence Pairs (split=test)
- Size: 74,265 evaluation samples
- Columns:
sentence1,sentence2, andlabel - Approximate statistics based on the first 1000 samples:
sentence1 sentence2 label type string string int details - min: 27 characters
- mean: 112.72 characters
- max: 197 characters
- min: 27 characters
- mean: 112.54 characters
- max: 198 characters
- 0: ~50.30%
- 1: ~49.70%
- Samples:
sentence1 sentence2 label The newer Punts are still very much in existence today and race in the same fleets as the older boats .The newer punts are still very much in existence today and run in the same fleets as the older boats .1Turner Valley , was at the Turner Valley Bar N Ranch Airport , southwest of the Turner Valley Bar N Ranch , Alberta , Canada .Turner Valley Bar N Ranch Airport , , was located at Turner Valley Bar N Ranch , southwest of Turner Valley , Alberta , Canada .0After losing his second election , he resigned as opposition leader and was replaced by Geoff Pearsall .Max Bingham resigned as opposition leader after losing his second election , and was replaced by Geoff Pearsall .1 - Loss:
BinaryCrossEntropyLosswith these parameters:{ "activation_fn": "torch.nn.modules.linear.Identity", "pos_weight": 0.1028856709599495 }
Framework Versions
- Python: 3.12.3
- Sentence Transformers: 5.1.0
- Transformers: 4.56.0
- PyTorch: 2.8.0+cu128
- Accelerate: 1.10.1
- Datasets: 4.0.0
- Tokenizers: 0.22.0
Citation
BibTeX
Sentence Transformers
@inproceedings{reimers-2019-sentence-bert,
title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
author = "Reimers, Nils and Gurevych, Iryna",
booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
month = "11",
year = "2019",
publisher = "Association for Computational Linguistics",
url = "https://arxiv.org/abs/1908.10084",
}