File size: 7,762 Bytes
721c635 1e97b1e 721c635 a43eb48 544a30a c1a1cee fad21e3 046ae0f fbd0698 0082e35 9294012 3bfdddc 643e34a 6dde7e0 1e97b1e 70eff3c 9dc042e cc4726e 24ec4fb 3fc3b74 721c635 a43eb48 544a30a c1a1cee fad21e3 046ae0f fbd0698 0082e35 9294012 3bfdddc 643e34a 6dde7e0 1e97b1e 70eff3c 9dc042e cc4726e 24ec4fb 3fc3b74 721c635 cc2fafe 94da748 cc2fafe 0293c9e cc2fafe f63c263 cc2fafe |
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 |
---
dataset_info:
- config_name: corpus
features:
- name: _id
dtype: string
- name: text
dtype: string
splits:
- name: NanoCodeSearchNetGo
num_bytes: 5866161
num_examples: 10000
- name: NanoCodeSearchNetJava
num_bytes: 8383266
num_examples: 10000
- name: NanoCodeSearchNetJavaScript
num_bytes: 6817497
num_examples: 6483
- name: NanoCodeSearchNetPHP
num_bytes: 8308232
num_examples: 10000
- name: NanoCodeSearchNetPython
num_bytes: 12057318
num_examples: 10000
- name: NanoCodeSearchNetRuby
num_bytes: 1456896
num_examples: 2279
download_size: 17919374
dataset_size: 42889370
- config_name: qrels
features:
- name: query-id
dtype: string
- name: corpus-id
dtype: string
splits:
- name: NanoCodeSearchNetGo
num_bytes: 11666
num_examples: 50
- name: NanoCodeSearchNetJava
num_bytes: 17154
num_examples: 50
- name: NanoCodeSearchNetJavaScript
num_bytes: 12376
num_examples: 50
- name: NanoCodeSearchNetPHP
num_bytes: 13456
num_examples: 50
- name: NanoCodeSearchNetPython
num_bytes: 13454
num_examples: 50
- name: NanoCodeSearchNetRuby
num_bytes: 12948
num_examples: 50
download_size: 61488
dataset_size: 81054
- config_name: queries
features:
- name: _id
dtype: string
- name: text
dtype: string
splits:
- name: NanoCodeSearchNetGo
num_bytes: 11803
num_examples: 50
- name: NanoCodeSearchNetJava
num_bytes: 19923
num_examples: 50
- name: NanoCodeSearchNetJavaScript
num_bytes: 15444
num_examples: 50
- name: NanoCodeSearchNetPHP
num_bytes: 19306
num_examples: 50
- name: NanoCodeSearchNetPython
num_bytes: 22227
num_examples: 50
- name: NanoCodeSearchNetRuby
num_bytes: 30739
num_examples: 50
download_size: 82419
dataset_size: 119442
configs:
- config_name: corpus
data_files:
- split: NanoCodeSearchNetGo
path: corpus/NanoCodeSearchNetGo-*
- split: NanoCodeSearchNetJava
path: corpus/NanoCodeSearchNetJava-*
- split: NanoCodeSearchNetJavaScript
path: corpus/NanoCodeSearchNetJavaScript-*
- split: NanoCodeSearchNetPHP
path: corpus/NanoCodeSearchNetPHP-*
- split: NanoCodeSearchNetPython
path: corpus/NanoCodeSearchNetPython-*
- split: NanoCodeSearchNetRuby
path: corpus/NanoCodeSearchNetRuby-*
- config_name: qrels
data_files:
- split: NanoCodeSearchNetGo
path: qrels/NanoCodeSearchNetGo-*
- split: NanoCodeSearchNetJava
path: qrels/NanoCodeSearchNetJava-*
- split: NanoCodeSearchNetJavaScript
path: qrels/NanoCodeSearchNetJavaScript-*
- split: NanoCodeSearchNetPHP
path: qrels/NanoCodeSearchNetPHP-*
- split: NanoCodeSearchNetPython
path: qrels/NanoCodeSearchNetPython-*
- split: NanoCodeSearchNetRuby
path: qrels/NanoCodeSearchNetRuby-*
- config_name: queries
data_files:
- split: NanoCodeSearchNetGo
path: queries/NanoCodeSearchNetGo-*
- split: NanoCodeSearchNetJava
path: queries/NanoCodeSearchNetJava-*
- split: NanoCodeSearchNetJavaScript
path: queries/NanoCodeSearchNetJavaScript-*
- split: NanoCodeSearchNetPHP
path: queries/NanoCodeSearchNetPHP-*
- split: NanoCodeSearchNetPython
path: queries/NanoCodeSearchNetPython-*
- split: NanoCodeSearchNetRuby
path: queries/NanoCodeSearchNetRuby-*
---
# NanoCodeSearchNet
A tiny, evaluation-ready slice of [CodeSearchNet](https://huggingface.co/datasets/code-search-net/code_search_net) (test set) that mirrors the spirit of [NanoBEIR](https://huggingface.co/collections/zeta-alpha-ai/nanobeir): same task, same style, but dramatically smaller so you can iterate and benchmark in minutes instead of hours.
Evaluation can be performed during and after training by integrating with Sentence Transformer's Evaluation module (InformationRetrievalEvaluator).
## NanoCodeSearchNet Evaluation (NDCG@10)
| Model | Avg | Go | Java | JavaScript | PHP | Python | Ruby |
|---|---:|---:|---:|---:|---:|---:|---:|
| [multilingual-e5-small](https://huggingface.co/intfloat/multilingual-e5-small) | **0.7351** | 0.6706 | 0.7899 | 0.6582 | 0.6651 | 0.9258 | 0.7008 |
| [multilingual-e5-large](https://huggingface.co/intfloat/multilingual-e5-large) | **0.7769** | 0.7459 | 0.8304 | 0.7016 | 0.7069 | 0.9513 | 0.7251 |
| [e5-small-v2](https://huggingface.co/intfloat/e5-small-v2) | **0.7371** | 0.7137 | 0.7758 | 0.6126 | 0.6561 | 0.9582 | 0.7060 |
| [e5-large-v2](https://huggingface.co/intfloat/e5-large-v2) | **0.7541** | 0.7097 | 0.8124 | 0.6715 | 0.7065 | 0.9386 | 0.6860 |
| [bge-m3](https://huggingface.co/BAAI/bge-m3) | **0.7094** | 0.6680 | 0.7050 | 0.6154 | 0.6238 | 0.9779 | 0.6662 |
| [gte-multilingual-base](https://huggingface.co/Alibaba-NLP/gte-multilingual-base) | **0.8112** | 0.7789 | 0.8666 | 0.7344 | 0.7991 | 0.9652 | 0.7231 |
| [nomic-embed-text-v2-moe](https://huggingface.co/nomic-ai/nomic-embed-text-v2-moe) | **0.7824** | 0.7635 | 0.8343 | 0.6519 | 0.7470 | 0.9852 | 0.7122 |
| [paraphrase-multilingual-MiniLM-L12-v2](https://huggingface.co/sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2) | **0.4651** | 0.3978 | 0.4608 | 0.3269 | 0.2183 | 0.9236 | 0.4631 |
Notes:
- The above results were computed with `nano_code_search_net_eval.py`.
- https://huggingface.co/datasets/hotchpotch/NanoCodeSearchNet/blob/main/nano_code_search_net_eval.py
## What this dataset is
- A collection of 6 programming-language subsets (`corpus`, `queries`, `qrels`) published on the Hugging Face Hub under `hotchpotch/NanoCodeSearchNet`.
- Each subset contains **50 test queries** and a **corpus of up to 10,000 code snippets**.
- Queries are function docstrings, and positives are the corresponding function bodies from the same source row.
- Query IDs are `q-<docid>`, where `docid` is the `func_code_url` when available.
- Built from the CodeSearchNet `test` split (`refs/convert/parquet`) with deterministic sampling (seed=42).
- License: **Other** (see CodeSearchNet and upstream repository licenses).
## Subset names
- Split names:
- `NanoCodeSearchNetGo`
- `NanoCodeSearchNetJava`
- `NanoCodeSearchNetJavaScript`
- `NanoCodeSearchNetPHP`
- `NanoCodeSearchNetPython`
- `NanoCodeSearchNetRuby`
- Config names: `corpus`, `queries`, `qrels`
## Usage
```python
from datasets import load_dataset
split = "NanoCodeSearchNetPython"
queries = load_dataset("hotchpotch/NanoCodeSearchNet", "queries", split=split)
corpus = load_dataset("hotchpotch/NanoCodeSearchNet", "corpus", split=split)
qrels = load_dataset("hotchpotch/NanoCodeSearchNet", "qrels", split=split)
print(queries[0]["text"])
```
### Example eval code
```bash
python ./nano_code_search_net_eval.py \
--model-path intfloat/multilingual-e5-small \
--query-prompt "query: " \
--corpus-prompt "passage: "
```
For models that require `trust_remote_code`, add `--trust-remote-code` (e.g., `BAAI/bge-m3`).
## Why Nano?
- **Fast eval loops**: 50 queries × 10k docs fits comfortably on a single GPU/CPU run.
- **Reproducible**: deterministic sampling and stable IDs.
- **Drop-in**: BEIR/NanoBEIR-style schemas, so existing IR loaders need minimal tweaks.
### Upstream sources
- Original data: **CodeSearchNet** — [CodeSearchNet Challenge: Evaluating the State of Semantic Code Search: 1909.09436](https://huggingface.co/papers/1909.09436).
- Base dataset: [code-search-net/code_search_net](https://huggingface.co/datasets/code-search-net/code_search_net) (Hugging Face Hub).
- Inspiration: **NanoBEIR** (lightweight evaluation subsets).
## License
Other. This dataset is derived from CodeSearchNet and ultimately from open-source GitHub repositories. Please respect original repository licenses and attribution requirements.
## Author
- Yuichi Tateno
|