| --- |
| 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: 332880779 |
| num_examples: 87647 |
| download_size: 152886043 |
| dataset_size: 332880779 |
| - config_name: go-v1-pair-2M |
| features: |
| - name: query |
| dtype: string |
| - name: pos |
| dtype: string |
| splits: |
| - name: train |
| num_bytes: 857307308 |
| num_examples: 1541111 |
| download_size: 372370345 |
| dataset_size: 857307308 |
| - 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: 329489331 |
| num_examples: 81657 |
| download_size: 121982790 |
| dataset_size: 329489331 |
| - config_name: java-v1-pair-2M |
| features: |
| - name: query |
| dtype: string |
| - name: pos |
| dtype: string |
| splits: |
| - name: train |
| num_bytes: 1021079487 |
| num_examples: 1491655 |
| download_size: 399345274 |
| dataset_size: 1021079487 |
| - 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: 505829400 |
| num_examples: 98025 |
| download_size: 212768692 |
| dataset_size: 505829400 |
| - config_name: javascript-v1-pair-2M |
| features: |
| - name: query |
| dtype: string |
| - name: pos |
| dtype: string |
| splits: |
| - name: train |
| num_bytes: 1625855840 |
| num_examples: 1960276 |
| download_size: 704045988 |
| dataset_size: 1625855840 |
| - 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: 409600818 |
| num_examples: 85460 |
| download_size: 163986468 |
| dataset_size: 409600818 |
| - config_name: php-v1-pair-2M |
| features: |
| - name: query |
| dtype: string |
| - name: pos |
| dtype: string |
| splits: |
| - name: train |
| num_bytes: 1379318420 |
| num_examples: 1710537 |
| download_size: 522306657 |
| dataset_size: 1379318420 |
| - 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: 426330409 |
| num_examples: 99535 |
| download_size: 184706464 |
| dataset_size: 426330409 |
| - config_name: python-v1-pair-2M |
| features: |
| - name: query |
| dtype: string |
| - name: pos |
| dtype: string |
| splits: |
| - name: train |
| num_bytes: 1460994357 |
| num_examples: 1990051 |
| download_size: 644195658 |
| dataset_size: 1460994357 |
| - 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: 180626329 |
| num_examples: 79040 |
| download_size: 83095960 |
| dataset_size: 180626329 |
| - config_name: ruby-v1-pair-2M |
| features: |
| - name: query |
| dtype: string |
| - name: pos |
| dtype: string |
| splits: |
| - name: train |
| num_bytes: 713529581 |
| num_examples: 1583047 |
| download_size: 304652631 |
| dataset_size: 713529581 |
| 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 |
|
|
| 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 |
|
|
| ## What This Release Contains |
|
|
| This release keeps the original subset layout (6 languages x pair + hard-negatives) and applies a deterministic rule-based noise filter. |
|
|
| Important: |
| - Counts are post-filter counts, so they are slightly smaller than the nominal 2M / 100k targets. |
| - Data is published in normalized IR format. |
|
|
| ## 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 (Post-filter) |
|
|
| | Subset (config name) | split | num_examples | |
| | --- | --- | ---: | |
| | `go-v1-pair-2M` | `train` | 1,992,985 | |
| | `go-v1-hard-negatives-100k` | `train` | 99,663 | |
| | `java-v1-pair-2M` | `train` | 1,752,593 | |
| | `java-v1-hard-negatives-100k` | `train` | 87,504 | |
| | `javascript-v1-pair-2M` | `train` | 1,960,276 | |
| | `javascript-v1-hard-negatives-100k` | `train` | 98,025 | |
| | `php-v1-pair-2M` | `train` | 1,710,537 | |
| | `php-v1-hard-negatives-100k` | `train` | 85,460 | |
| | `python-v1-pair-2M` | `train` | 1,990,051 | |
| | `python-v1-hard-negatives-100k` | `train` | 99,535 | |
| | `ruby-v1-pair-2M` | `train` | 1,583,047 | |
| | `ruby-v1-hard-negatives-100k` | `train` | 79,040 | |
| |
| ## Quick Usage |
| |
| ```python |
| 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. |
| |
| 1. Prefix-based noisy query removal |
| A row is dropped if `query` starts with any of the following prefixes: |
| - `TODO` |
| - `GET /` |
| - `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 stub` |
| - `Auto generated` |
| - `this down() migration is autogenerated` |
| - `this up() migration is autogenerated` |
| - `"/ renamed from:"` |
| - `"/ access modifiers changed from:"` |
| |
| 2. Minimum positive-document length |
| A row is dropped if the positive side is shorter than 30 characters. |
| - Pair task: `document` length >= 30 required |
| - Hard-negatives task: `positive` length >= 30 required |
| |
| 3. Hard-negative validity constraint |
| For hard-negative configs, at least one valid negative must remain after normalization (`min_negs = 1`). |
| |
| This filtering is purely rule-based (no model scoring), targeting high-noise templates and low-information positives while preserving broad retrieval coverage. |
| |