wetsoledrysoul's picture
add dataset card: creation, sources, statistics
c5b0327 verified
|
Raw
History Blame Contribute Delete
13.1 kB
---
configs:
- config_name: default
data_files:
- split: train
path: data/train-*
pretty_name: Code Generation (IQuest)
license: other
language:
- en
task_categories:
- text-generation
tags:
- code
- code-generation
- competitive-programming
- execution-feedback
- reinforcement-learning
- verl
size_categories:
- 10K<n<100K
---
# CodeGeneration-IQuest
**Execution-based Python code-generation prompts for reinforcement-learning post-training**, in the [verl](https://github.com/volcengine/verl) rule-reward schema. Each row is a single-turn competitive-programming problem whose reward is computed by **executing the model's program against a hidden test suite** — a program passes only if every case matches. The collection unifies two execution-scorable sources ([Code-Contests-O](https://huggingface.co/datasets/caijanfeng/CodeContests-O) and [DeepCoder](https://huggingface.co/datasets/agentica-org/DeepCoder-Preview-Dataset)) and then **difficulty-filters** them ("goldilocks", see below) so every kept prompt is hard for a weak model yet at least sometimes solvable by a strong one.
> **IQuest variant.** This is the [`IQuestLab/IQuest-Coder-V1-40B-Instruct`](https://huggingface.co/IQuestLab/IQuest-Coder-V1-40B-Instruct)-filtered cut. A sibling dataset, [`OctoReasoner/CodeGeneration`](https://huggingface.co/datasets/OctoReasoner/CodeGeneration), applies the identical pipeline with `Qwen/Qwen2.5-Coder-32B-Instruct` as the strong reference model instead — same candidate pool, different difficulty filter. **Note:** the sibling has *not yet* been rebuilt on the regenerated 2026-08 annotations (see [Creation pipeline](#creation-pipeline)) and still reflects the earlier, smaller selection.
| | |
|---|---:|
| **rows** | **14,927** |
| sources | 2 (Code-Contests-O, DeepCoder) |
| total test cases | 1,224,150 |
| total prompt tokens (Qwen2.5-Coder-1.5B) | ~8.61M |
<p align="center">
<img src="https://huggingface.co/datasets/OctoReasoner/CodeGeneration-IQuest/resolve/main/assets/composition.png" width="820" alt="Row composition by source">
</p>
## Schema
| column | type | notes |
|--------|------|-------|
| `data_source` | string | reward-routing key: `code_contests_o`, `code_primeintellect`, `code_taco`, `code_lcbv5`. Every value contains `code`, so the verl reward router dispatches it to the sandbox execution checker. |
| `prompt` | list[{role, content}] | chat messages. Code-Contests-O rows carry a single `user` turn; DeepCoder rows carry a `system` + `user` pair. Both instruct the model to reply with one markdown code block. |
| `ability` | string | always `code`. |
| `reward_model` | struct | `{style: "rule", ground_truth, method}`. `ground_truth` is a **JSON string** holding the test suite (see below); `method` is a legacy field (often null). |
| `extra_info` | struct | `{index, id, lower_pass_rate, lower_scores, upper_pass_rate, upper_scores}` — the goldilocks annotation (see [Difficulty filtering](#difficulty-goldilocks-filtering)). |
- **`reward_model.ground_truth`** is a JSON-encoded test suite in **one of three shapes**:
- a dict `{"inputs": [...], "outputs": [...]}` — stdin/stdout grading (all Code-Contests-O and TACO rows; 6,431 rows),
- a list of `{"type": "stdin_stdout", "input": ..., "output": ...}` case dicts — stdin/stdout grading (most PrimeIntellect and all LCB rows; 7,489 rows), or
- a list of `{"type": "function_call", "fn_name": ..., "input": [args...], "output": [return_value]}` case dicts — **call-based grading** (1,007 PrimeIntellect rows): the checker wraps the solution in a harness that calls `fn_name` with the JSON-decoded arguments and compares the returned value.
The in-tree verl reward (`sandbox_fusion` / `firejail` scorers) normalizes all three into the canonical `{"inputs", "outputs"[, "fn_name"]}` form before execution and **raises on anything else** — unknown encodings fail loudly rather than silently scoring 0.
- **`extra_info.index`** is the row's unified id (`deepcoder_{i}` / `cco_{i}`); **`extra_info.id`** preserves the original per-source id where one existed (e.g. `PRIMEINTELLECT_…`) and otherwise mirrors `index`.
- **`extra_info.lower_scores` / `upper_scores`** are the per-completion (8-sample) reward scores from the two reference models that back the goldilocks pass rates.
## Difficulty ("goldilocks") filtering
Both sources were annotated by sampling **8 completions per prompt** from two reference models and scoring each completion by executing it against the problem's test suite. A completion "passes" only if it clears **every** case, and the per-model **pass rate** is the fraction of the 8 completions that pass:
- **lower bound** — [`Qwen/Qwen2.5-Coder-1.5B-Instruct`](https://huggingface.co/Qwen/Qwen2.5-Coder-1.5B-Instruct) (weak)
- **upper bound** — [`IQuestLab/IQuest-Coder-V1-40B-Instruct`](https://huggingface.co/IQuestLab/IQuest-Coder-V1-40B-Instruct) (strong)
A row is *goldilocks* — and kept — when
```
lower_pass_rate ≤ 0.875 AND upper_pass_rate ≥ 0.125
```
i.e. the weak model does **not** already solve it every time, but the strong model solves it at least once in 8. This drops both the floor (nobody solves it — no learnable signal) and the ceiling (everybody solves it — no gradient) and concentrates training signal on learnable-but-hard problems. Overall **14,963 / 31,176 (48.0%)** of candidate rows are goldilocks; a subsequent **English-language filter** ([lingua](https://github.com/pemistahl/lingua-py) confidence ≥ 0.999) then removes 36 non-English rows, leaving the final **14,927**.
<p align="center">
<img src="https://huggingface.co/datasets/OctoReasoner/CodeGeneration-IQuest/resolve/main/assets/difficulty.png" width="960" alt="Goldilocks difficulty landscape and reference-model pass-rate distributions">
</p>
The weak model's pass rate piles up at 0 (median 0.00) while the strong model spreads across the range (median 0.50) — the two-model gap is the difficulty signal the filter selects for. (Pass rates are multiples of 1/8 because each is scored over 8 samples.)
## Statistics
### Composition
| source | rows | share | kept / candidate | provenance |
|--------|-----:|------:|:----------------:|------------|
| **Code-Contests-O** | 3,255 | 21.8% | 3,255 / 8,215 (39.6%) | competitive-programming problems (APPS / Codeforces / … via CodeContests-O) |
| **DeepCoder** | 11,672 | 78.2% | 11,672 / 22,961 (50.8%) | DeepCoder-Preview subsets |
| &nbsp;&nbsp;• PrimeIntellect | 8,302 | | | `code_primeintellect` |
| &nbsp;&nbsp;• TACO | 3,176 | | | `code_taco` |
| &nbsp;&nbsp;• LiveCodeBench v5 | 194 | | | `code_lcbv5` |
| **total** | **14,927** | 100% | 14,927 / 31,176 (47.9%) | |
The `kept / candidate` column is the combined goldilocks + English yield (English trims 36 DeepCoder rows; Code-Contests-O is fully English).
### Difficulty (kept rows)
Mean pass rate of the two reference models over the 8 samples (0 = never fully solved, 1 = always). The wide weak→strong gap is exactly the difficulty signal the filter selects for.
| slice | weak (1.5B) | strong (40B) |
|-------|:-----------:|:------------:|
| overall | 0.087 | 0.565 |
| Code-Contests-O | 0.075 | 0.561 |
| DeepCoder | 0.090 | 0.566 |
Median weak-model pass rate is **0.00** and median strong-model pass rate is **0.50** — most kept prompts are ones the weak model essentially can't solve while the strong model lands roughly half its attempts.
### Test suites
| slice | total cases | mean / problem | median | range |
|-------|-----------:|---------------:|-------:|:-----:|
| overall | 1,224,150 | 82.0 | 97 | 1 – 1,440 |
| Code-Contests-O | 118,449 | 36.4 | 34 | 1 – 168 |
| DeepCoder | 1,105,701 | 94.7 | 101 | 5 – 1,440 |
Every kept problem is graded on a real suite (min 1, typically dozens of cases), so the reward is an all-cases-must-pass verdict rather than a spot check.
### Prompt tokens
Length of the **chat-templated prompt** (including the generation prompt) under the [`Qwen/Qwen2.5-Coder-1.5B-Instruct`](https://huggingface.co/Qwen/Qwen2.5-Coder-1.5B-Instruct) tokenizer.
| metric | value |
|--------|------:|
| **total** | **8,614,855** (~8.61M) |
| mean / median | 577 / 546 |
| p95 / p99 / max | 958 / 1,284 / 3,703 |
Per-source medians are close (DeepCoder 553, Code-Contests-O 527); prompts are dominated by the problem statement plus the fixed I/O instruction block. Only 4 rows exceed 2,048 tokens (relevant when training with a 2,048-token prompt cap and `filter_overlong_prompts`).
<p align="center">
<img src="https://huggingface.co/datasets/OctoReasoner/CodeGeneration-IQuest/resolve/main/assets/distributions.png" width="960" alt="Prompt-token and test-suite-size distributions per source">
</p>
## Creation pipeline
1. **Source preparation** reshapes each upstream dataset into the verl schema, keeping rows the sandbox reward can score and, for Code-Contests-O, dropping problems with ≤5 test cases:
- **Code-Contests-O** → [`OctoReasoner/Code-Contests-O`](https://huggingface.co/datasets/OctoReasoner/Code-Contests-O), from [`caijanfeng/CodeContests-O`](https://huggingface.co/datasets/caijanfeng/CodeContests-O).
- **DeepCoder** → [`OctoReasoner/DeepCoder`](https://huggingface.co/datasets/OctoReasoner/DeepCoder), concatenating the PrimeIntellect, [TACO](https://huggingface.co/datasets/BAAI/TACO), and LiveCodeBench-v5 subsets of [`agentica-org/DeepCoder-Preview-Dataset`](https://huggingface.co/datasets/agentica-org/DeepCoder-Preview-Dataset). This includes both stdin/stdout and call-based (`function_call`) suites — the latter are gradeable via the reward's fn-call harness and are **kept** (one malformed row is excluded as unscoreable).
2. **Goldilocks annotation** samples 8 completions each from the 1.5B (weak) and 40B (strong) reference models, executes every completion against the problem's test suite on a SandboxFusion server (reusing the production `prime_code`-parity checker so scoring matches training exactly), and records `lower_pass_rate` / `upper_pass_rate` + per-completion `*_scores`. The annotations live in the lightweight sidecars [`OctoReasoner/DeepCoder-goldilocks`](https://huggingface.co/datasets/OctoReasoner/DeepCoder-goldilocks) and [`OctoReasoner/Code-Contests-O-goldilocks`](https://huggingface.co/datasets/OctoReasoner/Code-Contests-O-goldilocks) (which carry **both** the IQuest-40B and Qwen-32B uppers over the shared 1.5B lower, joined to the base datasets by `index`); this cut keeps rows where `goldilocks_iquest40` is true.
*2026-08 re-annotation:* the DeepCoder lower + IQuest-40B annotations were regenerated with a hardened pipeline after two defects were found in the original release — list-encoded ground truths were silently unscored, and the annotation cache was joined on an index that collides across DeepCoder's subsets, mis-attributing scores. The fixed pipeline uses collision-proof `data_source`-qualified join keys and normalizes every ground-truth encoding (convert-or-fail). This roughly tripled the DeepCoder goldilocks yield (3,232 → 11,708). The sidecar's *qwen32* columns still predate the fix.
3. **Consolidation** recomputes the goldilocks flag at `lower ≤ 0.875, upper ≥ 0.125`, keeps only goldilocks rows, folds the pass rates + scores into `extra_info`, re-indexes each row (`deepcoder_{i}` / `cco_{i}`), prefixes any `data_source` not already containing `code` with `code_` (so all route to the sandbox reward), and concatenates the two.
4. **English-language filter** drops rows whose problem statement is not detected as English with confidence ≥ 0.999 by the [lingua](https://github.com/pemistahl/lingua-py) detector (36 rows for this cut), giving the final dataset.
Steps 1–2 use the in-tree generation + `goldilocks.py` scoring pipeline; steps 3–4 are `tasks/rebuild_codegen_iquest.py`.
## Notes & caveats
- **`ground_truth` has three encodings** (dict `{inputs, outputs}`, list of stdin/stdout case dicts, list of `function_call` case dicts). Always `json.loads` it and branch on the shape — or use the in-tree normalizer, which canonicalizes all three and raises on anything unrecognized.
- **Call-based rows require fn-call grading**: for the 1,007 `function_call` rows a plain stdin/stdout runner would fail every case; the reward must invoke `fn_name` with the JSON-decoded arguments (the in-tree scorers do this automatically).
- **Reward is all-or-nothing per problem**: a solution scores 1.0 only if it passes every case in its suite; the goldilocks pass rate is the fraction of 8 samples that reach 1.0.
- **Sources are ~22/78 by row count and differ in test-suite size** — DeepCoder problems carry ~2.6× more cases on average, so per-rollout sandbox cost is higher there.
## Licensing & acknowledgements
This is a derived/reformatted collection; each source inherits the license and terms of its upstream (CodeContests-O and DeepMind CodeContests; DeepCoder-Preview and its constituents PrimeIntellect, BAAI/TACO, LiveCodeBench). Please consult and comply with the original licenses before use.