---
tags:
- sentence-transformers
- cross-encoder
- reranker
- generated_from_trainer
- dataset_size:42906
- loss:BinaryCrossEntropyLoss
base_model: cross-encoder/ms-marco-MiniLM-L6-v2
pipeline_tag: text-ranking
library_name: sentence-transformers
---
# CrossEncoder based on cross-encoder/ms-marco-MiniLM-L6-v2
This is a [Cross Encoder](https://www.sbert.net/docs/cross_encoder/usage/usage.html) model finetuned from [cross-encoder/ms-marco-MiniLM-L6-v2](https://huggingface.co/cross-encoder/ms-marco-MiniLM-L6-v2) 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:** [cross-encoder/ms-marco-MiniLM-L6-v2](https://huggingface.co/cross-encoder/ms-marco-MiniLM-L6-v2)
- **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/huggingface/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("cross_encoder_model_id")
# Get scores for pairs of texts
pairs = [
['TA2541 has used process hollowing to execute CyberGate malware.', 'Woody RAT can create a suspended notepad process and write shellcode to delete a file into the suspended process using `NtWriteVirtualMemory`.'],
['Attackers concealed command and control communications by hiding encoded data in the metadata of PNG files.', 'TA551 has hidden encoded data for malware DLLs in a PNG.'],
['The cybercriminal created a deceptive Facebook account impersonating a tech support representative to establish initial contact with potential victims.', 'The adversary used klist.exe to view Kerberos ticket expiration times and session keys.'],
['APT32 used GetPassword_x64 to harvest credentials.', 'Spyware updated TCC.db to grant full disk access to the malicious application.'],
['APT1 uses two utilities, GETMAIL and MAPIGET, to steal email. GETMAIL extracts emails from archived Outlook .pst files.', 'During Frankenstein, the threat actors used MSbuild to execute an actor-created file.'],
]
scores = model.predict(pairs)
print(scores.shape)
# (5,)
# Or rank different texts based on similarity to a single text
ranks = model.rank(
'TA2541 has used process hollowing to execute CyberGate malware.',
[
'Woody RAT can create a suspended notepad process and write shellcode to delete a file into the suspended process using `NtWriteVirtualMemory`.',
'TA551 has hidden encoded data for malware DLLs in a PNG.',
'The adversary used klist.exe to view Kerberos ticket expiration times and session keys.',
'Spyware updated TCC.db to grant full disk access to the malicious application.',
'During Frankenstein, the threat actors used MSbuild to execute an actor-created file.',
]
)
# [{'corpus_id': ..., 'score': ...}, {'corpus_id': ..., 'score': ...}, ...]
```
## Training Details
### Training Dataset
#### Unnamed Dataset
* Size: 42,906 training samples
* Columns: sentence_0, sentence_1, and label
* Approximate statistics based on the first 1000 samples:
| | sentence_0 | sentence_1 | label |
|:--------|:-------------------------------------------------------------------------------------------------|:-------------------------------------------------------------------------------------------------|:---------------------------------------------------------------|
| type | string | string | float |
| details |
TA2541 has used process hollowing to execute CyberGate malware. | Woody RAT can create a suspended notepad process and write shellcode to delete a file into the suspended process using `NtWriteVirtualMemory`. | 1.0 |
| Attackers concealed command and control communications by hiding encoded data in the metadata of PNG files. | TA551 has hidden encoded data for malware DLLs in a PNG. | 1.0 |
| The cybercriminal created a deceptive Facebook account impersonating a tech support representative to establish initial contact with potential victims. | The adversary used klist.exe to view Kerberos ticket expiration times and session keys. | 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
- `per_device_train_batch_size`: 16
- `per_device_eval_batch_size`: 16
#### All Hyperparameters