---
tags:
- sentence-transformers
- cross-encoder
- generated_from_trainer
- dataset_size:82744
- loss:MultipleNegativesRankingLoss
base_model: BAAI/bge-reranker-base
pipeline_tag: text-ranking
library_name: sentence-transformers
---
# CrossEncoder based on BAAI/bge-reranker-base
This is a [Cross Encoder](https://www.sbert.net/docs/cross_encoder/usage/usage.html) model finetuned from [BAAI/bge-reranker-base](https://huggingface.co/BAAI/bge-reranker-base) 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:** [BAAI/bge-reranker-base](https://huggingface.co/BAAI/bge-reranker-base)
- **Maximum Sequence Length:** 512 tokens
- **Number of Output Labels:** 1 label
### 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("foochun/bge-reranker-ft")
# Get scores for pairs of texts
pairs = [
['quinn toh heng yi', 'heng yi toh quinn'],
['mohd iskandi bin hassan', 'muhd iskandi hassan'],
['quinn ng ee siu', 'quinn ee siu ng'],
['malini doraisamy', 'malini doraisamy'],
['see shan fui', 'shanfui see'],
]
scores = model.predict(pairs)
print(scores.shape)
# (5,)
# Or rank different texts based on similarity to a single text
ranks = model.rank(
'quinn toh heng yi',
[
'heng yi toh quinn',
'muhd iskandi hassan',
'quinn ee siu ng',
'malini doraisamy',
'shanfui see',
]
)
# [{'corpus_id': ..., 'score': ...}, {'corpus_id': ..., 'score': ...}, ...]
```
## Training Details
### Training Dataset
#### Unnamed Dataset
* Size: 82,744 training samples
* Columns: query, pos, and neg
* Approximate statistics based on the first 1000 samples:
| | query | pos | neg |
|:--------|:----------------------------------------------------------------------------------------------|:----------------------------------------------------------------------------------------------|:---------------------------------------------------------------------------------------------|
| type | string | string | string |
| details |
brandon teh min jun | jun teh min | brandon min teh jun |
| suling anak peroi | suling anak peroi | suling anak rahim |
| chin sze tian | szetian chin | chin sze tian wong |
* Loss: [MultipleNegativesRankingLoss](https://sbert.net/docs/package_reference/cross_encoder/losses.html#multiplenegativesrankingloss) with these parameters:
```json
{
"scale": 10.0,
"num_negatives": 4,
"activation_fn": "torch.nn.modules.activation.Sigmoid"
}
```
### Evaluation Dataset
#### Unnamed Dataset
* Size: 11,820 evaluation samples
* Columns: query, pos, and neg
* Approximate statistics based on the first 1000 samples:
| | query | pos | neg |
|:--------|:-----------------------------------------------------------------------------------------------|:----------------------------------------------------------------------------------------------|:----------------------------------------------------------------------------------------------|
| type | string | string | string |
| details | quinn toh heng yi | heng yi toh quinn | toh yi heng |
| mohd iskandi bin hassan | muhd iskandi hassan | puteri balqis binti megat sulaiman |
| quinn ng ee siu | quinn ee siu ng | quinn ee ng siu |
* Loss: [MultipleNegativesRankingLoss](https://sbert.net/docs/package_reference/cross_encoder/losses.html#multiplenegativesrankingloss) with these parameters:
```json
{
"scale": 10.0,
"num_negatives": 4,
"activation_fn": "torch.nn.modules.activation.Sigmoid"
}
```
### Training Hyperparameters
#### Non-Default Hyperparameters
- `eval_strategy`: steps
- `per_device_train_batch_size`: 64
- `per_device_eval_batch_size`: 64
- `learning_rate`: 1e-05
- `warmup_ratio`: 0.1
- `seed`: 12
- `fp16`: True
- `dataloader_num_workers`: 4
- `load_best_model_at_end`: True
- `batch_sampler`: no_duplicates
#### All Hyperparameters