Text Ranking
sentence-transformers
Safetensors
Transformers
Arabic
xlm-roberta
text-classification
text-embeddings-inference
Instructions to use Omartificial-Intelligence-Space/ARA-Reranker-V1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use Omartificial-Intelligence-Space/ARA-Reranker-V1 with sentence-transformers:
from sentence_transformers import CrossEncoder model = CrossEncoder("Omartificial-Intelligence-Space/ARA-Reranker-V1") query = "Which planet is known as the Red Planet?" passages = [ "Venus is often called Earth's twin because of its similar size and proximity.", "Mars, known for its reddish appearance, is often referred to as the Red Planet.", "Jupiter, the largest planet in our solar system, has a prominent red spot.", "Saturn, famous for its rings, is sometimes mistaken for the Red Planet." ] scores = model.predict([(query, passage) for passage in passages]) print(scores) - Transformers
How to use Omartificial-Intelligence-Space/ARA-Reranker-V1 with Transformers:
# Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("Omartificial-Intelligence-Space/ARA-Reranker-V1") model = AutoModelForSequenceClassification.from_pretrained("Omartificial-Intelligence-Space/ARA-Reranker-V1") - Notebooks
- Google Colab
- Kaggle
update readme.md
Browse files
README.md
CHANGED
|
@@ -21,13 +21,18 @@ tags:
|
|
| 21 |
|
| 22 |
✨ The output score can be transformed into a [0, 1] range using a sigmoid function, providing a clear and interpretable measure of relevance.
|
| 23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
|
| 26 |
## Usage
|
| 27 |
### Using sentence-transformers
|
| 28 |
|
| 29 |
```
|
| 30 |
-
pip
|
| 31 |
```
|
| 32 |
```python
|
| 33 |
from sentence_transformers import CrossEncoder
|
|
@@ -62,7 +67,31 @@ for i, (candidate, score) in enumerate(ranked_candidates, 1):
|
|
| 62 |
print(f"Score: {score}\n")
|
| 63 |
```
|
| 64 |
## Evaluation
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 65 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
|
| 67 |
|
| 68 |
|
|
|
|
| 21 |
|
| 22 |
✨ The output score can be transformed into a [0, 1] range using a sigmoid function, providing a clear and interpretable measure of relevance.
|
| 23 |
|
| 24 |
+
## Arabic RAG Pipeline
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+

|
| 28 |
+
|
| 29 |
|
| 30 |
|
| 31 |
## Usage
|
| 32 |
### Using sentence-transformers
|
| 33 |
|
| 34 |
```
|
| 35 |
+
pip install sentence-transformers
|
| 36 |
```
|
| 37 |
```python
|
| 38 |
from sentence_transformers import CrossEncoder
|
|
|
|
| 67 |
print(f"Score: {score}\n")
|
| 68 |
```
|
| 69 |
## Evaluation
|
| 70 |
+
### Dataset
|
| 71 |
+
|
| 72 |
+
Size: 3000 samples.
|
| 73 |
+
|
| 74 |
+
### Structure:
|
| 75 |
+
🔸 Query: A string representing the user's question.
|
| 76 |
+
|
| 77 |
+
🔸 Candidate Document: A candidate passage to answer the query.
|
| 78 |
+
|
| 79 |
+
🔸 Relevance Label: Binary label (1 for relevant, 0 for irrelevant).
|
| 80 |
+
|
| 81 |
+
### Evaluation Process
|
| 82 |
+
|
| 83 |
+
🔸 Query Grouping: Queries are grouped to evaluate the model's ability to rank candidate documents correctly for each query.
|
| 84 |
+
|
| 85 |
+
🔸 Model Prediction: Each model predicts relevance scores for all candidate documents corresponding to a query.
|
| 86 |
+
|
| 87 |
+
🔸 Metrics Calculation: Metrics are computed to measure how well the model ranks relevant documents higher than irrelevant ones.
|
| 88 |
|
| 89 |
+
| Model | MRR | MAP | nDCG@10 |
|
| 90 |
+
|-------------------------------------------|------------------|------------------|------------------|
|
| 91 |
+
| cross-encoder/ms-marco-MiniLM-L-6-v2 | 0.6313333333333334 | 0.6313333333333334 | 0.725444959171438 |
|
| 92 |
+
| cross-encoder/ms-marco-MiniLM-L-12-v2 | 0.6643333333333332 | 0.6643333333333332 | 0.7500407855785803 |
|
| 93 |
+
| BAAI/bge-reranker-v2-m3 | 0.9023333333333332 | 0.9023333333333332 | 0.9274971489500038 |
|
| 94 |
+
| Omartificial-Intelligence-Space/ARA-Reranker-V1 | 0.9335 | 0.9335 | 0.9507001860964314 |
|
| 95 |
|
| 96 |
|
| 97 |
|