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