File size: 5,683 Bytes
ac26e05 1022964 ac26e05 1022964 cf44385 ac26e05 1022964 ac26e05 1022964 25fdd45 1022964 ac26e05 1022964 ac26e05 1022964 25fdd45 1022964 25fdd45 1022964 ac26e05 1022964 25fdd45 1022964 25fdd45 1022964 ac26e05 1022964 ac26e05 1022964 ac26e05 1022964 ac26e05 1022964 ac26e05 1022964 ac26e05 1022964 ac26e05 1022964 ac26e05 1022964 ac26e05 1022964 ac26e05 1022964 ac26e05 1022964 ac26e05 1022964 ac26e05 1022964 ac26e05 1022964 ac26e05 1022964 ac26e05 1022964 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 | ---
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
---
<div align="center">
# Verifiable Code Reasoning
### Execution-verified Python problems with chain-of-thought
**Sandbox-checked solutions · Multi-test unit checks · Deduplicated instances · Training-ready `sft_text`**
[](https://opensource.org/licenses/MIT)
[](https://huggingface.co/datasets/smshahbaj/verifiable-code-reasoning)
</div>
---
## 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
```python
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`)
```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}
}
```
---
<div align="center">
**Verified or it does not ship.**
</div>
|