File size: 9,839 Bytes
9d92be0
 
 
 
 
d831b5d
9d92be0
d831b5d
9d92be0
d831b5d
9d92be0
d831b5d
9d92be0
 
 
dc28394
9d92be0
dc28394
9d92be0
dc28394
9d92be0
dc28394
e5f3f11
 
 
 
 
 
 
 
 
 
9d92be0
 
 
9c33518
9d92be0
9c33518
9d92be0
9c33518
9d92be0
9c33518
9d92be0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
dc28394
d831b5d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3c8bf58
dc28394
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e5f3f11
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9c33518
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3c8bf58
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
configs:
- config_name: bm25
  data_files:
  - split: NanoCodeRAGLibraryDocumentationSolutions
    path: bm25/NanoCodeRAGLibraryDocumentationSolutions-*
  - split: NanoCodeRAGOnlineTutorials
    path: bm25/NanoCodeRAGOnlineTutorials-*
  - split: NanoCodeRAGProgrammingSolutions
    path: bm25/NanoCodeRAGProgrammingSolutions-*
  - split: NanoCodeRAGStackoverflowPosts
    path: bm25/NanoCodeRAGStackoverflowPosts-*
- config_name: corpus
  data_files:
  - split: NanoCodeRAGLibraryDocumentationSolutions
    path: corpus/NanoCodeRAGLibraryDocumentationSolutions-*
  - split: NanoCodeRAGOnlineTutorials
    path: corpus/NanoCodeRAGOnlineTutorials-*
  - split: NanoCodeRAGProgrammingSolutions
    path: corpus/NanoCodeRAGProgrammingSolutions-*
  - split: NanoCodeRAGStackoverflowPosts
    path: corpus/NanoCodeRAGStackoverflowPosts-*
- config_name: harrier_oss_v1_270m
  data_files:
  - split: NanoCodeRAGLibraryDocumentationSolutions
    path: harrier_oss_v1_270m/NanoCodeRAGLibraryDocumentationSolutions-*
  - split: NanoCodeRAGOnlineTutorials
    path: harrier_oss_v1_270m/NanoCodeRAGOnlineTutorials-*
  - split: NanoCodeRAGProgrammingSolutions
    path: harrier_oss_v1_270m/NanoCodeRAGProgrammingSolutions-*
  - split: NanoCodeRAGStackoverflowPosts
    path: harrier_oss_v1_270m/NanoCodeRAGStackoverflowPosts-*
- config_name: qrels
  data_files:
  - split: NanoCodeRAGLibraryDocumentationSolutions
    path: qrels/NanoCodeRAGLibraryDocumentationSolutions-*
  - split: NanoCodeRAGOnlineTutorials
    path: qrels/NanoCodeRAGOnlineTutorials-*
  - split: NanoCodeRAGProgrammingSolutions
    path: qrels/NanoCodeRAGProgrammingSolutions-*
  - split: NanoCodeRAGStackoverflowPosts
    path: qrels/NanoCodeRAGStackoverflowPosts-*
- config_name: queries
  data_files:
  - split: NanoCodeRAGLibraryDocumentationSolutions
    path: NanoCodeRAGLibraryDocumentationSolutions/queries/test.parquet
  - split: NanoCodeRAGOnlineTutorials
    path: NanoCodeRAGOnlineTutorials/queries/test.parquet
  - split: NanoCodeRAGProgrammingSolutions
    path: NanoCodeRAGProgrammingSolutions/queries/test.parquet
  - split: NanoCodeRAGStackoverflowPosts
    path: NanoCodeRAGStackoverflowPosts/queries/test.parquet
language:
- code
tags:
- information-retrieval
- retrieval
- nano
- bm25
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
---

# NanoCodeRAG

This dataset is a Nano-style retrieval dataset. Nano-series evaluation can be run easily with the [HAKARI-Bench](https://github.com/hotchpotch/hakari-bench).

NanoCodeRAG is derived from CodeRAG. It follows the Hugging Face Datasets layout convention used by [sentence-transformers/NanoBEIR-en](https://huggingface.co/datasets/sentence-transformers/NanoBEIR-en): each Nano split has separate `corpus`, `queries`, and `qrels` tables, and BM25 candidates are provided separately in a `bm25` table. This layout follows the NanoBEIR-style evaluation approach summarized in [NanoBEIR](https://huggingface.co/blog/sionic-ai/eval-sionic-nano-beir).

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.

## 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

## Data Layout

This dataset uses four 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`

Each config uses the same Nano split names. If the actual generated dataset uses a different schema, config name, path layout, or field name, revise this section before publishing the README.

## Construction Steps

This dataset was built as follows. If the actual generation procedure differs, revise this section before publishing the README.

1. Use CodeRAG as the upstream benchmark or dataset family.
2. Load the source datasets recorded in `manifest.json` and per-split metadata files.
3. Use the source benchmark evaluation split, preferring `test` when available as the source evaluation split policy.
4. Create one Nano split for each selected source retrieval task.
5. Keep up to 200 eligible queries per Nano split.
6. Include qrels-positive documents for the selected queries.
7. Fill the corpus from source corpus order up to 10000 documents.
8. Remove exact duplicate document text within each split. If a removed duplicate was referenced by qrels, rewrite qrels to the kept document id when the generator records that policy.
9. Store document title and body as a single `text` field when the source provides both.
10. Generate BM25 top-100 candidates with the tokenization policy recorded per split.
11. If a qrels-positive document is missing from the raw BM25 result, insert it into the final `bm25` candidate list by replacing a tail non-positive candidate.

## BM25 Subset Policy

The `bm25` config is a candidate subset for first-stage retrieval and reranking. It is not a separate source dataset. Each row contains one query id and a ranked list of corpus ids.

BM25 candidates are generated from the selected corpus for each split. The configured candidate cap is top-100. When a qrels-positive document is not present in the raw BM25 result, the missing positive is forced into the final candidate list by replacing a tail candidate that is not positive for that query. Candidate ids are kept unique after replacement.

## Split Mapping

| Nano split | Source task | Source dataset | Queries | Corpus | Qrels |
|---|---|---|---:|---:|---:|
| `NanoCodeRAGLibraryDocumentationSolutions` | `CodeRAGLibraryDocumentationSolutions` | `code-rag-bench/library-documentation` | 200 | 8683 | 200 |
| `NanoCodeRAGOnlineTutorials` | `CodeRAGOnlineTutorials` | `code-rag-bench/online-tutorials` | 200 | 9997 | 200 |
| `NanoCodeRAGProgrammingSolutions` | `CodeRAGProgrammingSolutions` | `code-rag-bench/programming-solutions` | 200 | 984 | 200 |
| `NanoCodeRAGStackoverflowPosts` | `CodeRAGStackoverflowPosts` | `code-rag-bench/stackoverflow-posts` | 200 | 10000 | 200 |

## BM25 nDCG@10

`nDCG@10` is computed from the included BM25 ranking against the included qrels.

Tokenizer policy summary: `whitespace:python`.

| Nano split | Tokenizer | Forced BM25 positives | BM25 nDCG@10 |
|---|---|---:|---:|
| `NanoCodeRAGLibraryDocumentationSolutions` | `whitespace:python` | 85 | 0.2279 |
| `NanoCodeRAGOnlineTutorials` | `whitespace:python` | 17 | 0.7472 |
| `NanoCodeRAGProgrammingSolutions` | `whitespace:python` | 149 | 0.0138 |
| `NanoCodeRAGStackoverflowPosts` | `whitespace:python` | 10 | 0.6902 |

## Skipped Tasks

No source tasks were skipped.

## License

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