Views
No views yet
xlm-roberta-large that has been fine-tuned for relevance ranking of Persian scientific texts. It takes a question and a document (an abstract) as input and outputs a score from 0 to 1 indicating their relevance.xlm-roberta-largesentence-transformerssentence-transformers library:1pip install -U sentence-transformers
2from sentence_transformers import CrossEncoder
3
4# Load the model from the Hugging Face Hub
5model_name = 'YOUR_HF_USERNAME/reranker-xlm-roberta-large' #<-- IMPORTANT: Replace with your model name!
6model = CrossEncoder(model_name)
7
8# Prepare your query and document pairs
9query = "روش های ارزیابی در بازیابی اطلاعات چیست؟" # "What are the evaluation methods in information retrieval?"
10documents = [
11 "بازیابی اطلاعات یک فرآیند پیچیده است که شامل شاخص گذاری و جستجوی اسناد می شود. ارزیابی آن اغلب با معیارهایی مانند دقت و بازیابی انجام می شود.", # "Information retrieval is a complex process involving indexing and searching documents. Its evaluation is often done with metrics like precision and recall."
12 "یادگیری عمیق در سال های اخیر پیشرفت های چشمگیری در پردازش زبان طبیعی داشته است.", # "Deep learning has made significant progress in natural language processing in recent years."
13 "این مقاله به بررسی روش های جدید برای ارزیابی سیستم های بازیابی اطلاعات معنایی می پردازد و معیارهای نوینی را معرفی می کند." # "This paper examines new methods for evaluating semantic information retrieval systems and introduces novel metrics."
14]
15
16# Create pairs for scoring
17sentence_pairs = [[query, doc] for doc in documents]
18
19# Predict the scores
20scores = model.predict(sentence_pairs, convert_to_numpy=True)
21
22# Print results
23for i in range(len(scores)):
24 print(f"Score: {scores[i]:.4f}\t Document: {documents[i]}")
25
26# Expected output (scores will vary but should follow this trend):
27# Score: 0.9123 Document: This paper examines new methods for evaluating semantic information retrieval systems and introduces novel metrics.
28# Score: 0.7543 Document: Information retrieval is a complex process involving indexing and searching documents. Its evaluation is often done with metrics like precision and recall.
29# Score: 0.0123 Document: Deep learning has made significant progress in natural language processing in recent years.
30This model was fine-tuned on the
31
32PersianSciQA dataset.
33
34
35
36
37Description: PersianSciQA is a large-scale dataset containing 39,809 Persian scientific question-answer pairs. It was generated using a two-stage process with
38
39
40
41gpt-4o-mini on a corpus of scientific abstracts from IranDoc's 'Ganj' repository.
42
43
44
45
46
47Content: The dataset consists of questions paired with scientific abstracts, primarily from engineering fields.
48
49
50
51Labels: Each pair has a relevance score from 0 (Not Relevant) to 3 (Highly Relevant), which was normalized to a 0-1 float for training.
52
53
54Training Procedure
55The model was trained using the provided train_reranker.py script with the following configuration:
56
57Epochs: 2
58
59Batch Size: 16
60
61Learning Rate: 2e-5
62
63Loss Function: MSELoss (default for regression in sentence-transformers)
64
65Evaluator: CECorrelationEvaluator was used to save the best model based on Spearman's rank correlation on the validation set.
66
67Evaluation
68The
69
70PersianSciQA paper reports substantial agreement between the LLM-assigned labels used for training and human expert judgments (Cohen's Kappa of 0.6642). The human validation study confirmed the high quality of the generated questions (88.60% acceptable) and the relevance assessments.
71
72
73
74Citation
75If you use this model or the PersianSciQA dataset in your research, please cite the original paper.
76
77(Note: The provided paper is a pre-print. Please update the citation information once it is officially published.)
78
79@misc{jolfaei_reranker_xlmr,
80 title = "{R}eranker {XLM}-{R}o{BERT}a-{L}arge for {P}ersian {S}cientific {R}etrieval",
81 author = "Aghadavoud Jolfaei, Safoura",
82 year = "2025",
83 publisher = "Hugging Face",
84 howpublished = "Hugging Face Models",
85 note = "[Model]",
86 doi = "10.57967/hf/9162",
87 url = "https://doi.org/10.57967/hf/9162",
88}