smshahbaj's picture
Upload dataset
cf44385 verified
|
Raw History Blame Contribute Delete
5.68 kB
metadata
license: mit
task_categories:
  - text-generation
language:
  - en
tags:
  - code
  - reasoning
  - chain-of-thought
  - verifiable
  - execution-verified
  - python
  - sft
  - synthetic
pretty_name: Verifiable Code Reasoning
size_categories:
  - 1M<n<10M
configs:
  - config_name: default
    data_files:
      - split: train
        path: data/train-*
      - split: validation
        path: data/validation-*
dataset_info:
  features:
    - name: id
      dtype: string
    - name: difficulty
      dtype: string
    - name: category
      dtype: string
    - name: problem
      dtype: string
    - name: signature
      dtype: string
    - name: reasoning
      dtype: string
    - name: code
      dtype: string
    - name: tests
      dtype: string
    - name: verified
      dtype: bool
    - name: language
      dtype: string
    - name: code_hash
      dtype: string
    - name: sft_text
      dtype: string
    - name: meta
      dtype: string
  splits:
    - name: train
      num_bytes: 1622807453
      num_examples: 1470000
    - name: validation
      num_bytes: 33093634
      num_examples: 30000
  download_size: 171472600
  dataset_size: 1655901087

Verifiable Code Reasoning

Execution-verified Python problems with chain-of-thought

Sandbox-checked solutions · Multi-test unit checks · Deduplicated instances · Training-ready sft_text

License: MIT Examples


Overview

Verifiable Code Reasoning is a large-scale dataset of Python coding problems where every kept solution has passed sandboxed unit tests.

Unlike scraped contest dumps or unverified LLM traces, an example enters this release only if:

  1. a reference implementation exists,
  2. it runs under a time-limited sandbox, and
  3. it matches expected outputs on at least 3 tests.

Failed executions are discarded. Near-duplicate instances are filtered by content fingerprint (signature + tests), so shared solution templates across different inputs are allowed, but repeated test instances are not.

Property Detail
Verification Multiprocess sandbox, timeout, ≥3 tests
Dedup Unique id + instance content hash (signature + tests)
Balance Category & difficulty quotas during generation
Resume Hub checkpoints: train.jsonl, progress.json
License MIT

Current release size: 1,500,000 verified examples (generation target 1,500,000).


Dataset statistics

Difficulty

Difficulty Count
easy 783,088
medium 698,789
hard 18,123

Category

Category Count
array 313,191
hashmap 240,984
two_pointers 218,129
greedy 144,377
binary_search 134,400
dp 134,400
string 133,673
bit 132,948
math 46,941
stack 702
matrix 255

Schema

Field Type Description
id string Stable example id
problem string Natural-language problem statement
signature string Python function signature
reasoning string Numbered chain-of-thought
code string Reference Python solution
tests string JSON list of {"input": ..., "output": ...} (≥3)
category string array, hashmap, dp, binary_search, ...
difficulty string easy / medium / hard
sft_text string Ready-to-train prompt block
verified bool Always true in this release
code_hash string Hash of solution source (audit)
language string python

tests is stored as a JSON string so Arrow/HF can keep one schema while outputs may be int, bool, or list.


Quick start

from datasets import load_dataset
import json

ds = load_dataset("smshahbaj/verifiable-code-reasoning")
row = ds["train"][0]
print(row["sft_text"][:500])
tests = json.loads(row["tests"])
print(tests[0])

SFT format (sft_text)

### Problem
...

### Reasoning
1) ...
2) ...

### Solution
```python
...

---

## How it was built

1. **25** algorithmic generator families (arrays, strings, math, DP, greedy, binary search, bits, matrices, …)
2. Each example gets **≥3** unit tests (including varied inputs)
3. Solution is executed in a **sandbox**; mismatch / timeout / exception → drop
4. **Quotas** limit over-representation of a single category or difficulty
5. **Instance dedup** on signature+tests fingerprint (unrepeatable test cases)
6. Multi-session scale via Hugging Face checkpoints every 2000 new verifies

---

## Intended uses

- Supervised fine-tuning on **code + reasoning**
- Process / outcome supervision signals (execution as ground truth)
- Filtering or ranking other synthetic coding traces

## Out of scope / limitations

- Coverage is bounded by the **generator bank** (not full competitive-programming breadth)
- **Python only** in this release
- Synthetic style can still be distributionally narrow — always evaluate models on real benchmarks (HumanEval, MBPP, LiveCodeBench, etc.)
- Not a substitute for human-written contest editorials

---

## Citation

```bibtex
@misc{verifiable_code_reasoning,
  title        = {Verifiable Code Reasoning},
  author       = {smshahbaj},
  year         = {2026},
  howpublished = {\url{https://huggingface.co/datasets/smshahbaj/verifiable-code-reasoning}},
  note         = {Execution-verified Python coding CoT dataset}
}

Verified or it does not ship.