OpenCodeReasoning
The largest open reasoning dataset for code: 735,255 Python samples distilled from DeepSeek R1 across 28,319 unique competitive-programming problems from CodeForces, LeetCode, AtCoder, and more. SFT-only training on it reached 61.8% on LiveCodeBench — beating RL-trained alternatives. Predominantly CC BY 4.0 with some Apache 2.0/MIT-sourced subsets.
from datasets import load_dataset
ds = load_dataset("nvidia/OpenCodeReasoning")Preview a sample row
{
"input": "Given an array of n integers, find the length of the longest strictly increasing subsequence. n ≤ 2500.",
"output": "<think>O(n log n) with patience sorting: keep tails array, binary search each element...</think>\nimport bisect\ndef lis(a):\n tails = []\n for x in a:\n i = bisect.bisect_left(tails, x)\n if i == len(tails): tails.append(x)\n else: tails[i] = x\n return len(tails)",
"source": "codeforces",
"difficulty": "medium"
}Fine-tune with this dataset
Estimated VRAM to fine-tune with QLoRA (4-bit base model + LoRA adapters), using conservative defaults:
New to fine-tuning? Follow the step-by-step walkthrough: Fine-Tune Your First LLM in 1 Hour
Frequently asked questions
Can I use OpenCodeReasoning commercially?
Yes — OpenCodeReasoning is released under CC BY 4.0, a permissive license that allows commercial use, including training models you ship in a product. Check the dataset card for attribution requirements before release.
How much data does OpenCodeReasoning contain, and do I need all of it?
OpenCodeReasoning contains 735k Samples. You rarely need all of it: for style and format fine-tuning, a few hundred to a few thousand examples are enough — load a slice (e.g. split="train[:1000]") and scale up only if quality plateaus.
What is OpenCodeReasoning best used for?
Fine-tuning coding models that show their reasoning before writing the solution. It belongs to the Reasoning section of our dataset hub, where you'll find alternatives and complementary sets.