update readme.md
Browse files
README.md
CHANGED
|
@@ -14,11 +14,75 @@ tags:
|
|
| 14 |
**For more info please refer to this blog: [ARM | Arabic Reranker Model](www.omarai.me).**
|
| 15 |
|
| 16 |
✨ This model is designed specifically for Arabic language reranking tasks, optimized to handle queries and passages with precision.
|
| 17 |
-
|
|
|
|
|
|
|
| 18 |
✨ Trained on a combination of positive and hard negative query-passage pairs, it excels in identifying the most relevant results.
|
|
|
|
| 19 |
✨ The output score can be transformed into a [0, 1] range using a sigmoid function, providing a clear and interpretable measure of relevance.
|
| 20 |
|
| 21 |
|
| 22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
|
| 24 |
|
|
|
|
| 14 |
**For more info please refer to this blog: [ARM | Arabic Reranker Model](www.omarai.me).**
|
| 15 |
|
| 16 |
✨ This model is designed specifically for Arabic language reranking tasks, optimized to handle queries and passages with precision.
|
| 17 |
+
|
| 18 |
+
✨ Unlike embedding models, which generate vector representations, this reranker directly evaluates the similarity between a question and a document, outputting a relevance score.
|
| 19 |
+
|
| 20 |
✨ Trained on a combination of positive and hard negative query-passage pairs, it excels in identifying the most relevant results.
|
| 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 installsentence-transformers
|
| 31 |
+
```
|
| 32 |
+
```python
|
| 33 |
+
from sentence_transformers import CrossEncoder
|
| 34 |
+
|
| 35 |
+
# Load the cross-encoder model
|
| 36 |
+
|
| 37 |
+
# Define a query and a set of candidates with varying degrees of relevance
|
| 38 |
+
query = "تطبيقات الذكاء الاصطناعي تُستخدم في مختلف المجالات لتحسين الكفاءة."
|
| 39 |
+
|
| 40 |
+
# Candidates with varying relevance to the query
|
| 41 |
+
candidates = [
|
| 42 |
+
"الذكاء الاصطناعي يساهم في تحسين الإنتاجية في الصناعات المختلفة.", # Highly relevant
|
| 43 |
+
"نماذج التعلم الآلي يمكنها التعرف على الأنماط في مجموعات البيانات الكبيرة.", # Moderately relevant
|
| 44 |
+
"الذكاء الاصطناعي يساعد الأطباء في تحليل الصور الطبية بشكل أفضل.", # Somewhat relevant
|
| 45 |
+
"تستخدم الحيوانات التمويه كوسيلة للهروب من الحيوانات المفترسة.", # Irrelevant
|
| 46 |
+
]
|
| 47 |
+
|
| 48 |
+
# Create pairs of (query, candidate) for each candidate
|
| 49 |
+
query_candidate_pairs = [(query, candidate) for candidate in candidates]
|
| 50 |
+
|
| 51 |
+
# Get relevance scores from the model
|
| 52 |
+
scores = model.predict(query_candidate_pairs)
|
| 53 |
+
|
| 54 |
+
# Combine candidates with their scores and sort them by score in descending order (higher score = higher relevance)
|
| 55 |
+
ranked_candidates = sorted(zip(candidates, scores), key=lambda x: x[1], reverse=True)
|
| 56 |
+
|
| 57 |
+
# Output the ranked candidates with their scores
|
| 58 |
+
print("Ranked candidates based on relevance to the query:")
|
| 59 |
+
for i, (candidate, score) in enumerate(ranked_candidates, 1):
|
| 60 |
+
print(f"Rank {i}:")
|
| 61 |
+
print(f"Candidate: {candidate}")
|
| 62 |
+
print(f"Score: {score}\n")
|
| 63 |
+
```
|
| 64 |
+
## Evaluation
|
| 65 |
+
|
| 66 |
+
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
## <span style="color:blue">Acknowledgments</span>
|
| 70 |
+
|
| 71 |
+
The author would like to thank Prince Sultan University for their invaluable support in this project. Their contributions and resources have been instrumental in the development and fine-tuning of these models.
|
| 72 |
+
|
| 73 |
+
|
| 74 |
+
```markdown
|
| 75 |
+
## Citation
|
| 76 |
+
|
| 77 |
+
If you use the GATE, please cite it as follows:
|
| 78 |
+
|
| 79 |
+
@misc{nacar2025ARM,
|
| 80 |
+
title={ARM, Arabic Reranker Model},
|
| 81 |
+
author={Omer Nacar},
|
| 82 |
+
year={2025},
|
| 83 |
+
url={https://huggingface.co/Omartificial-Intelligence-Space/ARA-Reranker-V1},
|
| 84 |
+
}
|
| 85 |
+
|
| 86 |
+
|
| 87 |
|
| 88 |
|