File size: 6,383 Bytes
3455cf8
f9568d1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3455cf8
 
 
 
 
05fb3b8
 
 
 
38afe31
 
 
 
3455cf8
f9568d1
 
 
 
 
 
 
 
 
 
 
c0a573d
f9568d1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
---
language:
- az
- en
license: ms-pl
task_categories:
- text-retrieval
tags:
- retrieval
- azerbaijani
- information-retrieval
- hard-negatives
- reranker
- ms-marco
- dense-retrieval
- colbert
- bi-encoder
- translated
size_categories:
- 1M<n<10M
configs:
- config_name: corpus
  data_files:
  - split: train
    path: corpus/train-*
- config_name: queries
  data_files:
  - split: train
    path: queries/train-*
- config_name: triplets
  data_files:
  - split: train
    path: triplets/train-*
---

# MS MARCO Azerbaijani — Reranked Retrieval Training Dataset

A large-scale passage retrieval training dataset in Azerbaijani, built by translating a 3.2M subset of the [MS MARCO](https://microsoft.github.io/msmarco/) passage ranking dataset and rescoring all query-passage pairs with a multilingual cross-encoder reranker.

## Overview

| | Count |
|---|---|
| Passages | 8,473,865 |
| Queries | ~800,000 |
| Triplets | ~3,200,000 |
| Negatives per triplet | up to 31 |
| Total pairs scored | 41,746,530 |

## Dataset Configs

The dataset consists of three configs:

### `corpus`

The full translated passage collection.

| Column | Type | Description |
|---|---|---|
| `pid` | int | Passage ID (original MS MARCO pid) |
| `passage` | string | Passage text translated to Azerbaijani |

### `queries`

Translated queries.

| Column | Type | Description |
|---|---|---|
| `qid` | int | Query ID (original MS MARCO qid) |
| `query` | string | Query text translated to Azerbaijani |

### `triplets`

Training triplets with both original MS MARCO scores and reranker scores computed on the Azerbaijani translations.

| Column | Type | Description |
|---|---|---|
| `qid` | int | Query ID (links to `queries`) |
| `pos_pid` | int | Positive passage ID (links to `corpus`) |
| `pos_score_original` | float | Original MS MARCO cross-encoder score (English) |
| `pos_score_reranker` | float | Reranker score on Azerbaijani translation |
| `neg_count` | int | Number of valid negatives for this triplet |
| `neg_{k}_pid` | int | Passage ID of the k-th hard negative |
| `neg_{k}_score_original` | float | Original MS MARCO score of the k-th negative |
| `neg_{k}_score_reranker` | float | Reranker score of the k-th negative (Azerbaijani) |

Negatives are sorted by `score_reranker` descending (hardest first). Columns run from `neg_1_*` to `neg_31_*`.

## Construction Pipeline

1. **Sampling**: 3.2M triplets were sampled from the MS MARCO `examples.json` using reservoir sampling, with 31 negatives selected per query
2. **Translation**: All queries and passages were translated from English to Azerbaijani
3. **Reranking**: Every query-passage pair (positive + all negatives) was scored with [BAAI/bge-reranker-v2-m3](https://huggingface.co/BAAI/bge-reranker-v2-m3) on the Azerbaijani translations (~14 hours, 41.7M pairs scored)
4. **Output**: Triplets with dual scores (original English + Azerbaijani reranker) to enable flexible filtering during training

## Why Reranker Scores?

The original MS MARCO scores were computed on English text. After translation, semantic relationships between queries and passages can shift — some negatives become closer to the positive, and some positives become weaker. The reranker scores on Azerbaijani text reflect what the model will actually see during training.

This also enables **false negative filtering**: negatives with `score_reranker > threshold * pos_score_reranker` are likely correct answers that MS MARCO did not annotate. These can be filtered out during training to avoid noisy supervision signals.

## Usage

```python
from datasets import load_dataset

corpus = load_dataset("LocalDoc/msmarco-az-reranked", "corpus")["train"]
queries = load_dataset("LocalDoc/msmarco-az-reranked", "queries")["train"]
triplets = load_dataset("LocalDoc/msmarco-az-reranked", "triplets")["train"]

# Build lookups
passage_lookup = {row["pid"]: row["passage"] for row in corpus}
query_lookup = {row["qid"]: row["query"] for row in queries}

# Inspect a triplet
t = triplets[0]
print(f"Query: {query_lookup[t['qid']]}")
print(f"Positive [reranker={t['pos_score_reranker']:.4f}]: {passage_lookup[t['pos_pid']][:200]}")

for k in range(1, 4):
    neg_pid = t[f"neg_{k}_pid"]
    neg_score = t[f"neg_{k}_score_reranker"]
    if neg_pid:
        print(f"Neg-{k} [reranker={neg_score:.4f}]: {passage_lookup[neg_pid][:200]}")
```

### Training with False Negative Filtering

```python
# Filter out false negatives where negative score > 95% of positive score
FN_THRESHOLD = 0.95

t = triplets[0]
pos_score = t["pos_score_reranker"]
cutoff = FN_THRESHOLD * pos_score

clean_negs = []
for k in range(1, 32):
    neg_pid = t[f"neg_{k}_pid"]
    neg_score = t[f"neg_{k}_score_reranker"]
    if neg_pid and neg_score < cutoff:
        clean_negs.append((neg_pid, neg_score))

print(f"Original negatives: {t['neg_count']}")
print(f"After FN filtering: {len(clean_negs)}")
```

## Example Output

```
Query: Dişi aslanlar nə qədər doğurur

Positive [original=10.41, reranker=5.64]:
Dişi şir normalda hər 18-26 aydan bir doğur. Təxminən 100-119 günlük
hamiləlik dövründən sonra bir-altı bala doğur. Lakin, balaların sayı
adətən üç və ya dörd olur və hər birinin çəkisi təxminən 3 funt olur.

Neg-1 [original=9.26, reranker=7.41]:  ← false negative (reranker > positive)
Dişi aslanlar adətən hər iki ildən bir bala doğurlar. Dişilər hamilə
və ya əmizdirən deyillərsə, ildə bir neçə dəfə cütləşməyə hazırdırlar.

Neg-2 [original=9.35, reranker=5.41]:
Pride-ın dişi hissəsi bütün yetkinlik həyatlarını birlikdə yaşayır,
lakin erkəklər gəlib-gedir. Dişi aslanın hamiləliyi təxminən dörd ay
davam edir.

Neg-3 [original=3.27, reranker=2.77]:  ← true negative
At: Dişilərin hamiləliyi adətən 11-12 ay çəkir. Dəniz aslanı: Dəniz
şirləri də balalarını 11-12 aylıq hamiləlik dövründən sonra dünyaya
gətirirlər.
```


## Limitations

- Passages and queries are machine-translated; translation artifacts (lexical mismatch, semantic drift) may affect quality
- Reranker scores are from a multilingual model that may underperform on Azerbaijani compared to English
- Original MS MARCO annotations are incomplete — some "negatives" are actually relevant (false negatives)



## Contact

For questions or issues, please contact LocalDoc at [v.resad.89@gmail.com].