Datasets:

Modalities:
Tabular
Text
Formats:
parquet
Languages:
English
ArXiv:
License:
CodeLens / README.md
William-Li's picture
Clarify dataset curation, annotations, and usage
28a5abc verified
|
Raw History Blame
6.76 kB
---
pretty_name: Code Generalization
language:
- en
task_categories:
- text-generation
tags:
- code
- sft
- reinforcement-learning
- code-generalization
- category-annotation
- ablation
license: other
license_name: source-specific-licenses
license_link: LICENSE
size_categories:
- 10K<n<100K
configs:
- config_name: kodcode_sft
default: true
data_files:
- split: train
path: data/kodcode/sft/train.parquet
- split: validation
path: data/kodcode/sft/validation.parquet
- config_name: kodcode_rl
data_files:
- split: train
path: data/kodcode/rl/train.parquet
- split: validation
path: data/kodcode/rl/validation.parquet
- config_name: taco_leetcode_sft
data_files:
- split: train
path: data/taco_leetcode/sft/train.parquet
- split: validation
path: data/taco_leetcode/sft/validation.parquet
- config_name: taco_leetcode_rl
data_files:
- split: train
path: data/taco_leetcode/rl/train.parquet
- split: validation
path: data/taco_leetcode/rl/validation.parquet
---
# Code Generalization
Code Generalization brings together curated data from **KodCode, TACO, and
LeetCodeDataset** for studying how code training affects generalization across
tasks and algorithmic categories. We clean and organize the source data, add
LLM-assisted category annotations to the KodCode portion, and provide SFT and RL
configurations with reproducible category-ablation subsets.
## What we contribute
- **Data curation.** We select and prepare source problems for training. For
KodCode, this includes deduplication by original question, interface repair,
static checks, and reference-solution execution checks, yielding 36,074 problems.
- **Category annotation and organization.** We use an LLM API to classify
KodCode problems, retain the classification reasons and review records, and
map the reviewed labels into ten categories. For TACO and LeetCodeDataset, we
organize the existing upstream tags into seven ablation groups; these are
not new API annotations.
- **Support for controlled experiments.** We provide SFT examples, RL prompts
and execution-based reward tests, validation splits, and the recorded sample
IDs used for category-removal experiments. This lets users compare training
on the full corpus with training on a specified ablation subset.
The underlying problems, reference answers, and tests come from the credited
upstream datasets. Our work is the curation, additional annotation, category
mapping, and preparation of these research configurations.
## Data configurations
| Configuration | Train | Validation |
|---|---:|---:|
| `kodcode_sft` | 35,974 | 100 |
| `kodcode_rl` | 35,974 | 100 |
| `taco_leetcode_sft` | 21,779 | 100 |
| `taco_leetcode_rl` | 17,249 | 100 |
Choose an **SFT** configuration for supervised training on reference answers, or
an **RL** configuration for training with execution-based rewards. KodCode SFT
and RL share the same problems and split membership; their row counts should
not be added together as distinct problems. The two data families retain their
own category systems.
## Quick start
After downloading this repository to a folder named `dataset`:
```python
from datasets import load_dataset
train = load_dataset("./dataset", "kodcode_sft", split="train")
print(train[0]["messages"])
# Select problems with a particular primary category.
dp = train.filter(lambda row: row["primary_category"] == "dynamic_programming")
```
To load from Hugging Face directly, replace `./dataset` with the repository ID
shown on the dataset page (`owner/Code-generalization`).
| Use | Main fields |
|---|---|
| SFT | `messages`, or the text pair `prompt` and `response` |
| RL | `prompt` (a list of messages) and `reward_model.ground_truth` (tests for the scorer) |
| Category analysis | `primary_category`; KodCode annotation fields or TACO/LeetCode `overlap_categories` |
Apply the target model's template at training time. Classification reasons and
reward tests are not SFT targets and should not be appended to training prompts.
## Category annotations
KodCode records include a primary category, auxiliary techniques, a short
classification reason, and annotation provenance. Across its 36,074 problems,
7,564 records are marked as reviewed and 1,677 as changed during review.
The released ten-category labels are a deterministic mapping of the reviewed
earlier labels. See [KodCode notes](docs/kodcode.md) for the model records and
field definitions.
A real annotation, showing selected fields:
```json
{
"problem_id": "Algorithm_12700_C",
"primary_category": "dynamic_programming",
"techniques": ["dp_table", "lcs_reconstruction", "backtracking"],
"rationale": "Builds an LCS length table and backtracks to reconstruct the subsequence."
}
```
KodCode's main ablations remove the selected **primary category**. TACO/LeetCode
ablations remove problems when **any mapped category** matches the removed
group. Use the recorded memberships to reproduce the experimental subsets;
a simple category filter does not reproduce their additional sampling.
Export commands are in the [KodCode](docs/kodcode.md) and
[TACO/LeetCode](docs/taco_leetcode.md) notes.
## Quality and usage notes
- All released KodCode problems carry a historical reference-execution-pass
flag. In TACO/LeetCode RL training data, 11,587 records are marked as
reference-execution-verified and 5,662 as structural-only. Passing the
supplied tests does not establish correctness on every possible input.
- KodCode's fixed 100-problem validation set comes from Light-RL-10K, whereas
its training set combines two KodCode sources. TACO SFT's 100-problem holdout
was added for this release; the other splits preserve the historical setup.
- TACO SFT and RL were separate experiments, not a shared SFT-to-RL partition.
There are cross-configuration overlaps; see the
[split notes](docs/taco_leetcode.md#splits-and-verification) before combining them.
- Reward execution requires Linux and an isolated environment. See
[verification notes](docs/rl_verification.md) for the two reward rules and
execution limits. Loading the dataset does not execute the problem code.
To check the local release, run these commands from the repository root:
```bash
pip install -r requirements.txt
python scripts/validate_release.py --hf
```
## Sources and license
Please credit the original [KodCode](https://arxiv.org/abs/2503.02951),
[TACO](https://arxiv.org/abs/2312.14852), and
[LeetCodeDataset](https://arxiv.org/abs/2504.14655) work when using their data.
Source repositories and attribution are listed in [NOTICE](NOTICE.md).
Source-specific terms remain in effect; see [LICENSE](LICENSE), including the
non-commercial condition on the KodCode-derived portion.