dataset_info:
- config_name: go-v1-hard-negatives-100k
features:
- name: query
dtype: string
- name: pos
dtype: string
- name: negs
list: string
splits:
- name: train
num_bytes: 332627048
num_examples: 87536
download_size: 152789447
dataset_size: 332627048
- config_name: go-v1-pair-2M
features:
- name: query
dtype: string
- name: pos
dtype: string
splits:
- name: train
num_bytes: 855194988
num_examples: 1532319
download_size: 371361455
dataset_size: 855194988
- config_name: java-v1-hard-negatives-100k
features:
- name: query
dtype: string
- name: pos
dtype: string
- name: negs
list: string
splits:
- name: train
num_bytes: 327677194
num_examples: 80906
download_size: 121324000
dataset_size: 327677194
- config_name: java-v1-pair-2M
features:
- name: query
dtype: string
- name: pos
dtype: string
splits:
- name: train
num_bytes: 1015086964
num_examples: 1456651
download_size: 396953392
dataset_size: 1015086964
- config_name: javascript-v1-hard-negatives-100k
features:
- name: query
dtype: string
- name: pos
dtype: string
- name: negs
list: string
splits:
- name: train
num_bytes: 408914607
num_examples: 79484
download_size: 176447985
dataset_size: 408914607
- config_name: javascript-v1-pair-2M
features:
- name: query
dtype: string
- name: pos
dtype: string
splits:
- name: train
num_bytes: 1084716629
num_examples: 1298745
download_size: 467742815
dataset_size: 1084716629
- config_name: php-v1-hard-negatives-100k
features:
- name: query
dtype: string
- name: pos
dtype: string
- name: negs
list: string
splits:
- name: train
num_bytes: 368842521
num_examples: 74945
download_size: 149769432
dataset_size: 368842521
- config_name: php-v1-pair-2M
features:
- name: query
dtype: string
- name: pos
dtype: string
splits:
- name: train
num_bytes: 993459020
num_examples: 1311302
download_size: 405251406
dataset_size: 993459020
- config_name: python-v1-hard-negatives-100k
features:
- name: query
dtype: string
- name: pos
dtype: string
- name: negs
list: string
splits:
- name: train
num_bytes: 417682840
num_examples: 96670
download_size: 181218116
dataset_size: 417682840
- config_name: python-v1-pair-2M
features:
- name: query
dtype: string
- name: pos
dtype: string
splits:
- name: train
num_bytes: 1338680922
num_examples: 1779891
download_size: 593332698
dataset_size: 1338680922
- config_name: ruby-v1-hard-negatives-100k
features:
- name: query
dtype: string
- name: pos
dtype: string
- name: negs
list: string
splits:
- name: train
num_bytes: 162232900
num_examples: 67937
download_size: 75638556
dataset_size: 162232900
- config_name: ruby-v1-pair-2M
features:
- name: query
dtype: string
- name: pos
dtype: string
splits:
- name: train
num_examples: 1175219
configs:
- config_name: go-v1-hard-negatives-100k
data_files:
- split: train
path: go-v1-hard-negatives-100k/train-*
- config_name: go-v1-pair-2M
data_files:
- split: train
path: go-v1-pair-2M/train-*
- config_name: java-v1-hard-negatives-100k
data_files:
- split: train
path: java-v1-hard-negatives-100k/train-*
- config_name: java-v1-pair-2M
data_files:
- split: train
path: java-v1-pair-2M/train-*
- config_name: javascript-v1-hard-negatives-100k
data_files:
- split: train
path: javascript-v1-hard-negatives-100k/train-*
- config_name: javascript-v1-pair-2M
data_files:
- split: train
path: javascript-v1-pair-2M/train-*
- config_name: php-v1-hard-negatives-100k
data_files:
- split: train
path: php-v1-hard-negatives-100k/train-*
- config_name: php-v1-pair-2M
data_files:
- split: train
path: php-v1-pair-2M/train-*
- config_name: python-v1-hard-negatives-100k
data_files:
- split: train
path: python-v1-hard-negatives-100k/train-*
- config_name: python-v1-pair-2M
data_files:
- split: train
path: python-v1-pair-2M/train-*
- config_name: ruby-v1-hard-negatives-100k
data_files:
- split: train
path: ruby-v1-hard-negatives-100k/train-*
- config_name: ruby-v1-pair-2M
data_files:
- split: train
path: ruby-v1-pair-2M/train-*
license: apache-2.0
cornstack-samples
🚧 This dataset is under active development and may change.
Filtered CoRNStack sample subsets for code retrieval training.
Source dataset and paper:
- CoRNStack collection: https://huggingface.co/collections/nomic-ai/cornstack
- CoRNStack paper: https://huggingface.co/papers/2412.01007
Note: the original CoRNStack collection is a much larger dataset family for code search training. If you need large-scale data (not samples), please refer to the original CoRNStack collection above.
What This Release Contains
This release keeps the original subset layout (6 languages x pair + hard-negatives) and applies deterministic rule-based filtering.
In this revision, query-level deduplication is also applied per subset: if query is duplicated, only the first row is kept.
Config Layout And Schema
Each language is published as two configs with split train:
{lang}-v1-pair-2M{lang}-v1-hard-negatives-100k
Schema:
- Pair configs:
query,pos - Hard-negative configs:
query,pos,negs(list[string])
Subsets And Row Counts (After Filter + Query Dedup)
Note: subset names keep the original 2M / 100k naming convention for compatibility, but
actual row counts vary by language and can be substantially lower after quality filtering and
query-level deduplication.
| Subset (config name) | split | num_examples |
|---|---|---|
go-v1-pair-2M |
train |
1,541,111 |
go-v1-hard-negatives-100k |
train |
87,647 |
java-v1-pair-2M |
train |
1,491,655 |
java-v1-hard-negatives-100k |
train |
81,657 |
javascript-v1-pair-2M |
train |
1,310,965 |
javascript-v1-hard-negatives-100k |
train |
79,684 |
php-v1-pair-2M |
train |
1,343,442 |
php-v1-hard-negatives-100k |
train |
75,632 |
python-v1-pair-2M |
train |
1,807,480 |
python-v1-hard-negatives-100k |
train |
97,147 |
ruby-v1-pair-2M |
train |
1,175,219 |
ruby-v1-hard-negatives-100k |
train |
68,382 |
Total rows:
- Pair: 8,669,872
- Hard-negatives: 490,149
- Overall: 9,160,021
Filter Impact (Query Dedup Stage)
The table below shows only the query-dedup impact on top of the previous rule-based filter.
| Subset | before | after | removed | removed_ratio |
|---|---|---|---|---|
go-v1-pair-2M |
1,992,985 | 1,541,111 | 451,874 | 22.67% |
go-v1-hard-negatives-100k |
99,663 | 87,647 | 12,016 | 12.06% |
java-v1-pair-2M |
1,752,593 | 1,491,655 | 260,938 | 14.89% |
java-v1-hard-negatives-100k |
87,504 | 81,657 | 5,847 | 6.68% |
javascript-v1-pair-2M |
1,960,276 | 1,310,965 | 649,311 | 33.12% |
javascript-v1-hard-negatives-100k |
98,025 | 79,684 | 18,341 | 18.71% |
php-v1-pair-2M |
1,710,537 | 1,343,442 | 367,095 | 21.46% |
php-v1-hard-negatives-100k |
85,460 | 75,632 | 9,828 | 11.50% |
python-v1-pair-2M |
1,990,051 | 1,807,480 | 182,571 | 9.17% |
python-v1-hard-negatives-100k |
99,535 | 97,147 | 2,388 | 2.40% |
ruby-v1-pair-2M |
1,583,047 | 1,175,219 | 407,828 | 25.76% |
ruby-v1-hard-negatives-100k |
79,040 | 68,382 | 10,658 | 13.48% |
Quick Usage
from datasets import load_dataset
pair_ds = load_dataset("hotchpotch/cornstack-samples", "python-v1-pair-2M", split="train")
hard_ds = load_dataset("hotchpotch/cornstack-samples", "python-v1-hard-negatives-100k", split="train")
print(pair_ds.column_names, len(pair_ds))
print(hard_ds.column_names, len(hard_ds))
License
This dataset follows CoRNStack and is released under Apache-2.0.
Citation And Attribution
If you use this dataset, please cite and attribute CoRNStack:
- Paper: https://huggingface.co/papers/2412.01007
- Collection: https://huggingface.co/collections/nomic-ai/cornstack
Noise Filtering Algorithm (Rule-based)
The following deterministic rules are applied before publishing this release.
- Prefix-based noisy query removal
A row is dropped if
querystarts with any of the following prefixes:
TODOGET /POST /PUT /DELETE /Display a listing of the resource.Store a newly created resource in storage.Show the form for editing the specified resource.Update the specified resource in storage.Show the form for creating a new resource.Remove the specified resource from storage.Display the specified resource.Transform the resource into an array.Autogenerated method stubAuto generatedthis down() migration is autogeneratedthis up() migration is autogenerated"/ renamed from:""/ access modifiers changed from:"
- Minimum positive-document length A row is dropped if the positive side text is shorter than 30 characters.
- Pair configs:
poslength >= 30 required - Hard-negative configs:
poslength >= 30 required
Hard-negative validity constraint For hard-negative configs, at least one valid negative must remain after normalization (
min_negs = 1).Query-level deduplication Within each subset split, rows are grouped by exact
querystring.
- Keep the first occurrence
- Drop all later duplicates
This filtering is purely rule-based (no model scoring), targeting high-noise templates and low-information positives while preserving broad retrieval coverage.