---
language:
- en
tags:
- sentence-transformers
- cross-encoder
- reranker
- generated_from_trainer
- dataset_size:9960000
- loss:BinaryCrossEntropyLoss
base_model: jhu-clsp/ettin-encoder-1b
datasets:
- sentence-transformers/msmarco
pipeline_tag: text-ranking
library_name: sentence-transformers
metrics:
- map
- mrr@10
- ndcg@10
model-index:
- name: CrossEncoder based on jhu-clsp/ettin-encoder-1b
results:
- task:
type: cross-encoder-reranking
name: Cross Encoder Reranking
dataset:
name: NanoMSMARCO R100
type: NanoMSMARCO_R100
metrics:
- type: map
value: 0.6418
name: Map
- type: mrr@10
value: 0.6372
name: Mrr@10
- type: ndcg@10
value: 0.7051
name: Ndcg@10
- task:
type: cross-encoder-reranking
name: Cross Encoder Reranking
dataset:
name: NanoNFCorpus R100
type: NanoNFCorpus_R100
metrics:
- type: map
value: 0.3816
name: Map
- type: mrr@10
value: 0.5641
name: Mrr@10
- type: ndcg@10
value: 0.4148
name: Ndcg@10
- task:
type: cross-encoder-reranking
name: Cross Encoder Reranking
dataset:
name: NanoNQ R100
type: NanoNQ_R100
metrics:
- type: map
value: 0.724
name: Map
- type: mrr@10
value: 0.7315
name: Mrr@10
- type: ndcg@10
value: 0.7717
name: Ndcg@10
- task:
type: cross-encoder-nano-beir
name: Cross Encoder Nano BEIR
dataset:
name: NanoBEIR R100 mean
type: NanoBEIR_R100_mean
metrics:
- type: map
value: 0.5824
name: Map
- type: mrr@10
value: 0.6443
name: Mrr@10
- type: ndcg@10
value: 0.6305
name: Ndcg@10
---
# CrossEncoder based on jhu-clsp/ettin-encoder-1b
This is a [Cross Encoder](https://www.sbert.net/docs/cross_encoder/usage/usage.html) model finetuned from [jhu-clsp/ettin-encoder-1b](https://huggingface.co/jhu-clsp/ettin-encoder-1b) on the [msmarco](https://huggingface.co/datasets/sentence-transformers/msmarco) dataset using the [sentence-transformers](https://www.SBERT.net) library. It computes scores for pairs of texts, which can be used for text reranking and semantic search.
## Model Details
### Model Description
- **Model Type:** Cross Encoder
- **Base model:** [jhu-clsp/ettin-encoder-1b](https://huggingface.co/jhu-clsp/ettin-encoder-1b)
- **Maximum Sequence Length:** 7999 tokens
- **Number of Output Labels:** 1 label
- **Training Dataset:**
- [msmarco](https://huggingface.co/datasets/sentence-transformers/msmarco)
- **Language:** en
### Model Sources
- **Documentation:** [Sentence Transformers Documentation](https://sbert.net)
- **Documentation:** [Cross Encoder Documentation](https://www.sbert.net/docs/cross_encoder/usage/usage.html)
- **Repository:** [Sentence Transformers on GitHub](https://github.com/UKPLab/sentence-transformers)
- **Hugging Face:** [Cross Encoders on Hugging Face](https://huggingface.co/models?library=sentence-transformers&other=cross-encoder)
## Usage
### Direct Usage (Sentence Transformers)
First install the Sentence Transformers library:
```bash
pip install -U sentence-transformers
```
Then you can load this model and run inference.
```python
from sentence_transformers import CrossEncoder
# Download from the 🤗 Hub
model = CrossEncoder("kdhole/reranker-ettin-encoder-1b-msmarco-bce-10m")
# Get scores for pairs of texts
pairs = [
['what is the zip code for hamilton nj', 'Stats and Demographics for the 21227 ZIP Code. ZIP code 21227 is located in Maryland and covers a slightly less than average land area compared to other ZIP codes in the United States. It also has a slightly larger than average population density.n addition to the primary city for a ZIP code, USPS also publishes a list of other acceptable cities that can be used with ZIP code 21227. However, if you are mailing something to ZIP code 21227, you should not use any of the cities listed as unacceptable.'],
['which cooking oil is healthy', "Photo Credit bgfoto126/iStock/Getty Images. Olive oil may get all the press, but safflower oil is emerging as a health superstar in its own right. Made from the seeds of safflowers, which are similar to sunflowers, this oil contains healthy fats and may even help prevent cardiovascular disease.All oils are pure fat, however, which means they're high in calories.hoto Credit bgfoto126/iStock/Getty Images. Olive oil may get all the press, but safflower oil is emerging as a health superstar in its own right. Made from the seeds of safflowers, which are similar to sunflowers, this oil contains healthy fats and may even help prevent cardiovascular disease."],
['what canadian cities have the highest crime rates?', 'Saginaw, TX Tarrant County crime report and crime data. Compare the rate to other cities, state average, and national average.'],
['how to delete bcc', 'How to delete the CC/BCC rule. 1 Open Auto BCC dialog box. 2 Select the rule you need in the list and click the Delete button on the top toolbar or the Delete key on your keyboard. 3 Confirm deletion and click Ok to save changes.'],
['what county is waukegan illinois in?', 'Downtown Waukegan is the urban center of Lake County. Many restaurants, bars, shops, the Waukegan Public Library, the College of Lake County, the Lake County Courthouse (including the William D. Block Memorial Law Library), and much more call Downtown Waukegan their home.'],
]
scores = model.predict(pairs)
print(scores.shape)
# (5,)
# Or rank different texts based on similarity to a single text
ranks = model.rank(
'what is the zip code for hamilton nj',
[
'Stats and Demographics for the 21227 ZIP Code. ZIP code 21227 is located in Maryland and covers a slightly less than average land area compared to other ZIP codes in the United States. It also has a slightly larger than average population density.n addition to the primary city for a ZIP code, USPS also publishes a list of other acceptable cities that can be used with ZIP code 21227. However, if you are mailing something to ZIP code 21227, you should not use any of the cities listed as unacceptable.',
"Photo Credit bgfoto126/iStock/Getty Images. Olive oil may get all the press, but safflower oil is emerging as a health superstar in its own right. Made from the seeds of safflowers, which are similar to sunflowers, this oil contains healthy fats and may even help prevent cardiovascular disease.All oils are pure fat, however, which means they're high in calories.hoto Credit bgfoto126/iStock/Getty Images. Olive oil may get all the press, but safflower oil is emerging as a health superstar in its own right. Made from the seeds of safflowers, which are similar to sunflowers, this oil contains healthy fats and may even help prevent cardiovascular disease.",
'Saginaw, TX Tarrant County crime report and crime data. Compare the rate to other cities, state average, and national average.',
'How to delete the CC/BCC rule. 1 Open Auto BCC dialog box. 2 Select the rule you need in the list and click the Delete button on the top toolbar or the Delete key on your keyboard. 3 Confirm deletion and click Ok to save changes.',
'Downtown Waukegan is the urban center of Lake County. Many restaurants, bars, shops, the Waukegan Public Library, the College of Lake County, the Lake County Courthouse (including the William D. Block Memorial Law Library), and much more call Downtown Waukegan their home.',
]
)
# [{'corpus_id': ..., 'score': ...}, {'corpus_id': ..., 'score': ...}, ...]
```
## Evaluation
### Metrics
#### Cross Encoder Reranking
* Datasets: `NanoMSMARCO_R100`, `NanoNFCorpus_R100` and `NanoNQ_R100`
* Evaluated with [CrossEncoderRerankingEvaluator](https://sbert.net/docs/package_reference/cross_encoder/evaluation.html#sentence_transformers.cross_encoder.evaluation.CrossEncoderRerankingEvaluator) with these parameters:
```json
{
"at_k": 10,
"always_rerank_positives": true
}
```
| Metric | NanoMSMARCO_R100 | NanoNFCorpus_R100 | NanoNQ_R100 |
|:------------|:---------------------|:---------------------|:---------------------|
| map | 0.6418 (+0.1522) | 0.3816 (+0.1206) | 0.7240 (+0.3044) |
| mrr@10 | 0.6372 (+0.1597) | 0.5641 (+0.0642) | 0.7315 (+0.3048) |
| **ndcg@10** | **0.7051 (+0.1647)** | **0.4148 (+0.0898)** | **0.7717 (+0.2710)** |
#### Cross Encoder Nano BEIR
* Dataset: `NanoBEIR_R100_mean`
* Evaluated with [CrossEncoderNanoBEIREvaluator](https://sbert.net/docs/package_reference/cross_encoder/evaluation.html#sentence_transformers.cross_encoder.evaluation.CrossEncoderNanoBEIREvaluator) with these parameters:
```json
{
"dataset_names": [
"msmarco",
"nfcorpus",
"nq"
],
"rerank_k": 100,
"at_k": 10,
"always_rerank_positives": true
}
```
| Metric | Value |
|:------------|:---------------------|
| map | 0.5824 (+0.1924) |
| mrr@10 | 0.6443 (+0.1763) |
| **ndcg@10** | **0.6305 (+0.1752)** |
## Training Details
### Training Dataset
#### msmarco
* Dataset: [msmarco](https://huggingface.co/datasets/sentence-transformers/msmarco) at [9e329ed](https://huggingface.co/datasets/sentence-transformers/msmarco/tree/9e329ed2e649c9d37b0d91dd6b764ff6fe671d83)
* Size: 9,960,000 training samples
* Columns: query, passage, and score
* Approximate statistics based on the first 1000 samples:
| | query | passage | score |
|:--------|:------------------------------------------------------------------------------------------------|:--------------------------------------------------------------------------------------------------|:---------------------------------------------------------------|
| type | string | string | float |
| details |
what is liquid resources | Renewable Resources. Renewable resources are resources that are replenished by the environment over relatively short periods of time. This type of resource is much more desirable to use because often a resource renews so fast that it will have regenerated by the time you've used it up.n contrast to renewable resources, non-renewable resources are resources that are not easily replenished by the environment. Let's think about this in terms of that ice cube maker again. | 0.0 |
| halo laser treatment | Laser surgery (photocoagulation) With laser surgery, your ophthalmologist uses a laser to make small burns around the retinal tear. The scarring that results seals the retina to the underlying tissue, helping to prevent a retinal detachment. Freezing treatment (cryopexy) | 0.0 |
| three motorcycle car | Can-Am Spyder roadster: three wheeled motorcycle. February 20, 2007 BRP has unveiled its first on-road vehicle, the 2008 Can-Am Spyder roadster. This three-wheel vehicle, with two wheels in the front and one in the rear, offers a completely new and stunning look. Powered by a proven 990cc V Twin engine designed and manufactured by BRP-Rotax, Spyder roadster, with its unique Y-architecture, can be described as part motorcycle and part convertible sports car. | 1.0 |
* Loss: [BinaryCrossEntropyLoss](https://sbert.net/docs/package_reference/cross_encoder/losses.html#binarycrossentropyloss) with these parameters:
```json
{
"activation_fn": "torch.nn.modules.linear.Identity",
"pos_weight": null
}
```
### Evaluation Dataset
#### msmarco
* Dataset: [msmarco](https://huggingface.co/datasets/sentence-transformers/msmarco) at [9e329ed](https://huggingface.co/datasets/sentence-transformers/msmarco/tree/9e329ed2e649c9d37b0d91dd6b764ff6fe671d83)
* Size: 40,000 evaluation samples
* Columns: query, passage, and score
* Approximate statistics based on the first 1000 samples:
| | query | passage | score |
|:--------|:------------------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------------------|:---------------------------------------------------------------|
| type | string | string | float |
| details | what is the zip code for hamilton nj | Stats and Demographics for the 21227 ZIP Code. ZIP code 21227 is located in Maryland and covers a slightly less than average land area compared to other ZIP codes in the United States. It also has a slightly larger than average population density.n addition to the primary city for a ZIP code, USPS also publishes a list of other acceptable cities that can be used with ZIP code 21227. However, if you are mailing something to ZIP code 21227, you should not use any of the cities listed as unacceptable. | 0.0 |
| which cooking oil is healthy | Photo Credit bgfoto126/iStock/Getty Images. Olive oil may get all the press, but safflower oil is emerging as a health superstar in its own right. Made from the seeds of safflowers, which are similar to sunflowers, this oil contains healthy fats and may even help prevent cardiovascular disease.All oils are pure fat, however, which means they're high in calories.hoto Credit bgfoto126/iStock/Getty Images. Olive oil may get all the press, but safflower oil is emerging as a health superstar in its own right. Made from the seeds of safflowers, which are similar to sunflowers, this oil contains healthy fats and may even help prevent cardiovascular disease. | 0.0 |
| what canadian cities have the highest crime rates? | Saginaw, TX Tarrant County crime report and crime data. Compare the rate to other cities, state average, and national average. | 0.0 |
* Loss: [BinaryCrossEntropyLoss](https://sbert.net/docs/package_reference/cross_encoder/losses.html#binarycrossentropyloss) with these parameters:
```json
{
"activation_fn": "torch.nn.modules.linear.Identity",
"pos_weight": null
}
```
### Training Hyperparameters
#### Non-Default Hyperparameters
- `eval_strategy`: steps
- `per_device_train_batch_size`: 64
- `per_device_eval_batch_size`: 64
- `learning_rate`: 2e-05
- `num_train_epochs`: 1
- `warmup_ratio`: 0.1
- `seed`: 12
- `bf16`: True
- `dataloader_num_workers`: 4
- `load_best_model_at_end`: True
#### All Hyperparameters