Redis fine-tuned CrossEncoder model for semantic caching on LangCache
This is a Cross Encoder model finetuned from Alibaba-NLP/gte-reranker-modernbert-base 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: Alibaba-NLP/gte-reranker-modernbert-base
- Maximum Sequence Length: 8192 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-softmnrl-triplet")
# Get scores for pairs of texts
pairs = [
[' What high potential jobs are there other than computer science?', ' What high potential jobs are there other than computer science?'],
[' Would India ever be able to develop a missile system like S300 or S400 missile?', ' Would India ever be able to develop a missile system like S300 or S400 missile?'],
[' water from the faucet is being drunk by a yellow dog', 'A yellow dog is drinking water from the faucet'],
[' water from the faucet is being drunk by a yellow dog', 'The yellow dog is drinking water from a bottle'],
['! colspan = `` 14 `` `` Players who appeared for Colchester who left during the season ``', '! colspan = `` 14 `` `` Players who appeared for Colchester who left during the season ``'],
]
scores = model.predict(pairs)
print(scores.shape)
# (5,)
# Or rank different texts based on similarity to a single text
ranks = model.rank(
' What high potential jobs are there other than computer science?',
[
' What high potential jobs are there other than computer science?',
' Would India ever be able to develop a missile system like S300 or S400 missile?',
'A yellow dog is drinking water from the faucet',
'The yellow dog is drinking water from a bottle',
'! colspan = `` 14 `` `` Players who appeared for Colchester who left during the season ``',
]
)
# [{'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: 76,348,209 training samples
- Columns:
anchor,positive, andnegative_1 - Approximate statistics based on the first 1000 samples:
anchor positive negative_1 type string string string details - min: 6 characters
- mean: 55.35 characters
- max: 1131 characters
- min: 5 characters
- mean: 55.02 characters
- max: 1131 characters
- min: 8 characters
- mean: 76.33 characters
- max: 560 characters
- Samples:
anchor positive negative_1
"There aren't many places in Gold Coast where you can find a wide variety of wedding dresses."
"There aren't many places in Gold Coast where you can find a wide variety of wedding dresses."Where can I get a wide variety of wedding dresses in Gold Coast?
It's easy to say it's good having siblings, but people often suggest it as a universal truth without considering that not everyone enjoys sibling relationships. Having siblings can lead to conflicts, competition, and stress, which might overshadow any potential benefits like companionship or support. Additionally, individual experiences with siblings can vary greatly depending on personality, family dynamics, and cultural background.
It's easy to say it's good having siblings, but people often suggest it as a universal truth without considering that not everyone enjoys sibling relationships. Having siblings can lead to conflicts, competition, and stress, which might overshadow any potential benefits like companionship or support. Additionally, individual experiences with siblings can vary greatly depending on personality, family dynamics, and cultural background.What's it like having siblings?
To reconcile the idea that 'Education is the Key to Success' with the presence of underemployed graduates and successful criminals, it's important to emphasize that education is one among many factors that contribute to success. Education equips individuals with knowledge, critical thinking skills, and problem-solving abilities, which are essential tools for navigating life's challenges and seizing opportunities. However, success is also influenced by other elements such as personal drive, social connections, opportunities presented, and sometimes sheer luck. Education does not guarantee success on its own; rather, it provides a foundation upon which individuals can build their careers and personal lives. Additionally, the definition of success can be subjective and varies across different cultures and individuals. It's crucial to address practical considerations like ensuring that educational curricula are relevant to the current job market and fostering environments where both hard ...
To reconcile the idea that 'Education is the Key to Success' with the presence of underemployed graduates and successful criminals, it's important to emphasize that education is one among many factors that contribute to success. Education equips individuals with knowledge, critical thinking skills, and problem-solving abilities, which are essential tools for navigating life's challenges and seizing opportunities. However, success is also influenced by other elements such as personal drive, social connections, opportunities presented, and sometimes sheer luck. Education does not guarantee success on its own; rather, it provides a foundation upon which individuals can build their careers and personal lives. Additionally, the definition of success can be subjective and varies across different cultures and individuals. It's crucial to address practical considerations like ensuring that educational curricula are relevant to the current job market and fostering environments where both hard ...How do you convince the upcoming generation that "Education is The Key of Success " when we are surrounded by poor graduates and rich criminals? - Loss:
MultipleNegativesRankingLosswith these parameters:{ "scale": 20.0, "num_negatives": 1, "activation_fn": "torch.nn.modules.activation.Sigmoid" }
Evaluation Dataset
LangCache Sentence Pairs (split=test)
- Dataset: LangCache Sentence Pairs (split=test)
- Size: 132,354 evaluation samples
- Columns:
anchor,positive, andnegative_1 - Approximate statistics based on the first 1000 samples:
anchor positive negative_1 type string string string details - min: 3 characters
- mean: 96.44 characters
- max: 314 characters
- min: 3 characters
- mean: 95.52 characters
- max: 314 characters
- min: 10 characters
- mean: 72.75 characters
- max: 244 characters
- Samples:
anchor positive negative_1 What high potential jobs are there other than computer science?What high potential jobs are there other than computer science?Why IT or Computer Science jobs are being over rated than other Engineering jobs?Would India ever be able to develop a missile system like S300 or S400 missile?Would India ever be able to develop a missile system like S300 or S400 missile?Should India buy the Russian S400 air defence missile system?water from the faucet is being drunk by a yellow dogA yellow dog is drinking water from the faucetChildlessness is low in Eastern European countries. - Loss:
MultipleNegativesRankingLosswith these parameters:{ "scale": 20.0, "num_negatives": 1, "activation_fn": "torch.nn.modules.activation.Sigmoid" }
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",
}
- Downloads last month
- -
Inference Providers
NEW
This model isn't deployed by any Inference Provider.
🙋
Ask for provider support
Model tree for redis/langcache-reranker-v2-softmnrl-triplet
Base model
answerdotai/ModernBERT-base
Finetuned
Alibaba-NLP/gte-reranker-modernbert-base