File size: 10,882 Bytes
9d92be0
 
7153731
9d92be0
 
e37a708
9d92be0
e37a708
9d92be0
e37a708
9d92be0
e37a708
7153731
9d92be0
 
e37a708
9d92be0
e37a708
9d92be0
e37a708
9d92be0
e37a708
7153731
 
e5f3f11
 
e37a708
e5f3f11
e37a708
e5f3f11
e37a708
e5f3f11
e37a708
7153731
9d92be0
 
e37a708
9d92be0
e37a708
9d92be0
e37a708
9d92be0
e37a708
7153731
9d92be0
 
e37a708
9d92be0
e37a708
9d92be0
e37a708
9d92be0
e37a708
9fc5f2c
 
 
e37a708
9fc5f2c
e37a708
9fc5f2c
e37a708
9fc5f2c
e37a708
9d92be0
 
 
 
 
 
 
7153731
 
 
dc28394
d831b5d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3c8bf58
dc28394
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e5f3f11
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9c33518
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3c8bf58
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9fc5f2c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9d92be0
 
 
7153731
9d92be0
 
 
7153731
9d92be0
7153731
 
 
 
 
 
 
 
 
 
 
9d92be0
 
 
7153731
9d92be0
 
 
 
 
7153731
 
9d92be0
7153731
9d92be0
7153731
9d92be0
7153731
 
 
9d92be0
7153731
9d92be0
7153731
9d92be0
7153731
9d92be0
7153731
 
 
 
 
 
9d92be0
7153731
9d92be0
7153731
9d92be0
7153731
9d92be0
7153731
 
 
 
 
 
 
9d92be0
7153731
9d92be0
7153731
 
 
9d92be0
7153731
9d92be0
7153731
 
 
 
 
9d92be0
 
 
 
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
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
---
configs:
- config_name: corpus
  data_files:
  - split: NanoCodeRAGLibraryDocumentationSolutions
    path: corpus/NanoCodeRAGLibraryDocumentationSolutions-00000-of-00001.parquet
  - split: NanoCodeRAGOnlineTutorials
    path: corpus/NanoCodeRAGOnlineTutorials-00000-of-00001.parquet
  - split: NanoCodeRAGProgrammingSolutions
    path: corpus/NanoCodeRAGProgrammingSolutions-00000-of-00001.parquet
  - split: NanoCodeRAGStackoverflowPosts
    path: corpus/NanoCodeRAGStackoverflowPosts-00000-of-00001.parquet
- config_name: queries
  data_files:
  - split: NanoCodeRAGLibraryDocumentationSolutions
    path: queries/NanoCodeRAGLibraryDocumentationSolutions-00000-of-00001.parquet
  - split: NanoCodeRAGOnlineTutorials
    path: queries/NanoCodeRAGOnlineTutorials-00000-of-00001.parquet
  - split: NanoCodeRAGProgrammingSolutions
    path: queries/NanoCodeRAGProgrammingSolutions-00000-of-00001.parquet
  - split: NanoCodeRAGStackoverflowPosts
    path: queries/NanoCodeRAGStackoverflowPosts-00000-of-00001.parquet
  default: true
- config_name: qrels
  data_files:
  - split: NanoCodeRAGLibraryDocumentationSolutions
    path: qrels/NanoCodeRAGLibraryDocumentationSolutions-00000-of-00001.parquet
  - split: NanoCodeRAGOnlineTutorials
    path: qrels/NanoCodeRAGOnlineTutorials-00000-of-00001.parquet
  - split: NanoCodeRAGProgrammingSolutions
    path: qrels/NanoCodeRAGProgrammingSolutions-00000-of-00001.parquet
  - split: NanoCodeRAGStackoverflowPosts
    path: qrels/NanoCodeRAGStackoverflowPosts-00000-of-00001.parquet
- config_name: bm25
  data_files:
  - split: NanoCodeRAGLibraryDocumentationSolutions
    path: bm25/NanoCodeRAGLibraryDocumentationSolutions-00000-of-00001.parquet
  - split: NanoCodeRAGOnlineTutorials
    path: bm25/NanoCodeRAGOnlineTutorials-00000-of-00001.parquet
  - split: NanoCodeRAGProgrammingSolutions
    path: bm25/NanoCodeRAGProgrammingSolutions-00000-of-00001.parquet
  - split: NanoCodeRAGStackoverflowPosts
    path: bm25/NanoCodeRAGStackoverflowPosts-00000-of-00001.parquet
- config_name: harrier_oss_v1_270m
  data_files:
  - split: NanoCodeRAGLibraryDocumentationSolutions
    path: harrier_oss_v1_270m/NanoCodeRAGLibraryDocumentationSolutions-00000-of-00001.parquet
  - split: NanoCodeRAGOnlineTutorials
    path: harrier_oss_v1_270m/NanoCodeRAGOnlineTutorials-00000-of-00001.parquet
  - split: NanoCodeRAGProgrammingSolutions
    path: harrier_oss_v1_270m/NanoCodeRAGProgrammingSolutions-00000-of-00001.parquet
  - split: NanoCodeRAGStackoverflowPosts
    path: harrier_oss_v1_270m/NanoCodeRAGStackoverflowPosts-00000-of-00001.parquet
- config_name: reranking_hybrid
  data_files:
  - split: NanoCodeRAGLibraryDocumentationSolutions
    path: reranking_hybrid/NanoCodeRAGLibraryDocumentationSolutions-00000-of-00001.parquet
  - split: NanoCodeRAGOnlineTutorials
    path: reranking_hybrid/NanoCodeRAGOnlineTutorials-00000-of-00001.parquet
  - split: NanoCodeRAGProgrammingSolutions
    path: reranking_hybrid/NanoCodeRAGProgrammingSolutions-00000-of-00001.parquet
  - split: NanoCodeRAGStackoverflowPosts
    path: reranking_hybrid/NanoCodeRAGStackoverflowPosts-00000-of-00001.parquet
language:
- code
tags:
- information-retrieval
- retrieval
- nano
- bm25
- dense-retrieval
- reranking
- hakari-bench
dataset_info:
- config_name: bm25
  features:
  - name: query-id
    dtype: string
  - name: corpus-ids
    list: string
  splits:
  - name: NanoCodeRAGLibraryDocumentationSolutions
    num_bytes: 1180757
    num_examples: 200
  - name: NanoCodeRAGOnlineTutorials
    num_bytes: 1191012
    num_examples: 200
  - name: NanoCodeRAGProgrammingSolutions
    num_bytes: 1110671
    num_examples: 200
  - name: NanoCodeRAGStackoverflowPosts
    num_bytes: 1188297
    num_examples: 200
  download_size: 4676749
  dataset_size: 4670737
- config_name: corpus
  features:
  - name: _id
    dtype: string
  - name: text
    dtype: string
  splits:
  - name: NanoCodeRAGLibraryDocumentationSolutions
    num_bytes: 17956921
    num_examples: 8683
  - name: NanoCodeRAGOnlineTutorials
    num_bytes: 57578239
    num_examples: 9997
  - name: NanoCodeRAGProgrammingSolutions
    num_bytes: 200886
    num_examples: 984
  - name: NanoCodeRAGStackoverflowPosts
    num_bytes: 47533159
    num_examples: 10000
  download_size: 56258007
  dataset_size: 123269205
- config_name: harrier_oss_v1_270m
  features:
  - name: query-id
    dtype: string
  - name: corpus-ids
    list: string
  splits:
  - name: NanoCodeRAGLibraryDocumentationSolutions
    num_bytes: 1179425
    num_examples: 200
  - name: NanoCodeRAGOnlineTutorials
    num_bytes: 1190640
    num_examples: 200
  - name: NanoCodeRAGProgrammingSolutions
    num_bytes: 1112088
    num_examples: 200
  - name: NanoCodeRAGStackoverflowPosts
    num_bytes: 1189868
    num_examples: 200
  download_size: 4678100
  dataset_size: 4672021
- config_name: qrels
  features:
  - name: query-id
    dtype: string
  - name: corpus-id
    dtype: string
  splits:
  - name: NanoCodeRAGLibraryDocumentationSolutions
    num_bytes: 3407
    num_examples: 200
  - name: NanoCodeRAGOnlineTutorials
    num_bytes: 3384
    num_examples: 200
  - name: NanoCodeRAGProgrammingSolutions
    num_bytes: 3547
    num_examples: 200
  - name: NanoCodeRAGStackoverflowPosts
    num_bytes: 3380
    num_examples: 200
  download_size: 13196
  dataset_size: 13718
- config_name: queries
  features:
  - name: _id
    dtype: string
  - name: text
    dtype: string
  splits:
  - name: NanoCodeRAGLibraryDocumentationSolutions
    num_bytes: 81590
    num_examples: 200
  - name: NanoCodeRAGOnlineTutorials
    num_bytes: 12499
    num_examples: 200
  - name: NanoCodeRAGProgrammingSolutions
    num_bytes: 17812
    num_examples: 200
  - name: NanoCodeRAGStackoverflowPosts
    num_bytes: 44059
    num_examples: 200
  download_size: 81432
  dataset_size: 155960
- config_name: reranking_hybrid
  features:
  - name: query-id
    dtype: string
  - name: corpus-ids
    list: string
  splits:
  - name: NanoCodeRAGLibraryDocumentationSolutions
    num_bytes: 236212
    num_examples: 200
  - name: NanoCodeRAGOnlineTutorials
    num_bytes: 239489
    num_examples: 200
  - name: NanoCodeRAGProgrammingSolutions
    num_bytes: 219840
    num_examples: 200
  - name: NanoCodeRAGStackoverflowPosts
    num_bytes: 239067
    num_examples: 200
  download_size: 940041
  dataset_size: 934608
---
# NanoCodeRAG

This dataset is a Nano-style retrieval dataset for [HAKARI-bench](https://github.com/hakari-bench/hakari-bench).

NanoCodeRAG contains 4 Nano retrieval splits derived from CodeRAG. Each split keeps up to 200 eligible queries and up to 10000 corpus documents, with exact duplicate query and document text removed where the generator records that policy.

## Usage

```python
from datasets import load_dataset

dataset_id = "hakari-bench/NanoCodeRAG"
split = "NanoCodeRAGLibraryDocumentationSolutions"

queries = load_dataset(dataset_id, "queries", split=split)
corpus = load_dataset(dataset_id, "corpus", split=split)
qrels = load_dataset(dataset_id, "qrels", split=split)
reranking_candidates = load_dataset(dataset_id, "reranking_hybrid", split=split)
```

## Data Layout

This dataset uses six Hugging Face Datasets configs:

- `corpus`: documents with `_id` and `text`
- `queries`: queries with `_id` and `text`
- `qrels`: positive relevance labels with `query-id` and `corpus-id`
- `bm25`: BM25 candidate lists with `query-id` and `corpus-ids`
- `harrier_oss_v1_270m`: dense candidate lists from `microsoft/harrier-oss-v1-270m`
- `reranking_hybrid`: RRF candidate lists built from `bm25` and `harrier_oss_v1_270m`

Each config has the same Nano split names.

## Candidate Construction

- `bm25`: local BM25 top-500 with automatic language-aware tokenization. The resolved tokenizer is shown in the Candidate Quality table, for example `wordseg@ja`.
- `harrier_oss_v1_270m`: dense top-500 from `microsoft/harrier-oss-v1-270m`. In tables this is shown as `Dense`; Dense means `microsoft/harrier-oss-v1-270m` with the `web_search_query` prompt for queries and cosine similarity over normalized embeddings.
- `reranking_hybrid`: RRF over `bm25` and `harrier_oss_v1_270m` using `rrf_k=100`, keeping the RRF top-100.

Safeguard means rank 101 is appended only when RRF top-100 contains no qrels-positive document.

## Split Statistics

Length statistics are character counts computed with `len(str(text))`.

| Nano split | Queries | Corpus | Qrels | Query chars avg | Query chars p50 | Query chars p75 | Doc chars avg | Doc chars p50 | Doc chars p75 |
|---|---:|---:|---:|---:|---:|---:|---:|---:|---:|
| NanoCodeRAGLibraryDocumentationSolutions | 200 | 8683 | 200 | 397.4 | 110.0 | 127.2 | 2045.7 | 765.0 | 1842.5 |
| NanoCodeRAGOnlineTutorials | 200 | 9997 | 200 | 51.9 | 47.0 | 63.0 | 5722.5 | 3419.0 | 6795.0 |
| NanoCodeRAGProgrammingSolutions | 200 | 984 | 200 | 78.3 | 78.0 | 89.2 | 189.1 | 148.5 | 227.2 |
| NanoCodeRAGStackoverflowPosts | 200 | 10000 | 200 | 209.8 | 185.5 | 269.0 | 4735.0 | 2864.5 | 5301.0 |

## Candidate Quality

`nDCG@10` and `Recall@100` are computed from the included candidate rankings against the included qrels, then reported as 0-100 scores such as `52.45`. `Recall@100` uses only the top 100 candidates; an optional rank-101 safeguard positive is not counted in `Recall@100`.

Dense means `microsoft/harrier-oss-v1-270m` with the `web_search_query` prompt and cosine similarity.

| Nano split | BM25 tokenizer | BM25 nDCG@10 | Dense nDCG@10 | Hybrid nDCG@10 | BM25 Recall@100 | Dense Recall@100 | Hybrid Recall@100 | Hybrid candidates | Safeguard positives |
|---|---|---:|---:|---:|---:|---:|---:|---:|---:|
| Mean | - | 58.23 | 82.96 | 66.85 | 80.50 | 95.12 | 97.75 | - | 18 |
| NanoCodeRAGLibraryDocumentationSolutions | regex | 68.67 | 76.45 | 75.44 | 92.00 | 92.50 | 94.50 | 100-101 | 11 |
| NanoCodeRAGOnlineTutorials | regex | 81.75 | 90.27 | 86.73 | 97.00 | 95.50 | 100.00 | 100 | 0 |
| NanoCodeRAGProgrammingSolutions | regex | 5.12 | 76.46 | 21.51 | 36.50 | 96.50 | 96.50 | 100-101 | 7 |
| NanoCodeRAGStackoverflowPosts | regex | 77.37 | 88.65 | 83.73 | 96.50 | 96.00 | 100.00 | 100 | 0 |

## Hybrid Safeguard Summary

- Safeguard positives: 18
- Rows limited by corpus size: 0
- Metadata file: `reranking_hybrid_metadata.json`

## Source Links

- Source benchmark: `CodeRAG`
- `code-rag-bench/library-documentation`: https://huggingface.co/datasets/code-rag-bench/library-documentation
- `code-rag-bench/online-tutorials`: https://huggingface.co/datasets/code-rag-bench/online-tutorials
- `code-rag-bench/programming-solutions`: https://huggingface.co/datasets/code-rag-bench/programming-solutions
- `code-rag-bench/stackoverflow-posts`: https://huggingface.co/datasets/code-rag-bench/stackoverflow-posts

## License

NanoCodeRAG is a derived dataset. Users must comply with the licenses, terms, and attribution requirements of the upstream datasets and benchmarks.