cublya/OpenCodeReasoning-2
OpenCodeReasoning-2: A Large-scale Dataset for Reasoning in Code Generation and Critique Dataset Description OpenCodeReasoning-2 is the largest reasoning-based synthetic dataset to date for coding, comprising 1.4M samples in Python and 1.1M samples in C++ across 34,799 unique competitive programming questions. OpenCodeReasoning-2 is designed for supervised fine-tuning (SFT) tasks of code completion and code critique. Github Repo - Access the complete pipeline… See the full description on the dataset page: https://huggingface.co/datasets/cublya/OpenCodeReasoning-2.
OpenCodeReasoning-2: A Large-scale Dataset for Reasoning in Code Generation and Critique
Dataset Description
OpenCodeReasoning-2 is the largest reasoning-based synthetic dataset to date for coding, comprising 1.4M samples in Python and 1.1M samples in C++ across 34,799 unique competitive programming questions. OpenCodeReasoning-2 is designed for supervised fine-tuning (SFT) tasks of code completion and code critique.
- Github Repo - Access the complete pipeline used to perform SFT.
This dataset is ready for commercial/non-commercial use.
Data distribution
- The CodeForces problems are sourced from http://codeforces.com.
- The question collections are gathered from TACO (https://huggingface.co/datasets/BAAI/TACO), APPS (https://huggingface.co/datasets/codeparrot/apps), CodeContests (https://huggingface.co/datasets/deepmind/code_contests), and open-r1/codeforces (https://huggingface.co/datasets/open-r1/codeforces).
- We do not include the test split of CodeContests and open-r1/codeforces.
- The solution responses are generated by R1 and critique responses are generated by QwQ.
Python
C++
Data Fields
How to use it
from tqdm import tqdm
from datasets import load_dataset
hf_datasets = {
"taco": load_dataset("BAAI/TACO", trust_remote_code=True),
"apps": load_dataset("codeparrot/apps", trust_remote_code=True),
"code_contests": load_dataset("deepmind/code_contests"),
"open-r1/codeforces": load_dataset("open-r1/codeforces")
}
def get_question(ds_name, split, index):
benchmark = hf_datasets[ds_name][split][int(index)]
if ds_name == "code_contests":
if not benchmark["description"]:
return None
return benchmark["description"]
elif ds_name in ["taco", "apps"]:
return benchmark["question"]
elif ds_name == "open-r1/codeforces":
if not benchmark["description"]:
return None
question = benchmark["description"]
if benchmark["input_format"]:
question += "\n\nInput\n\n" + benchmark["input_format"]
if benchmark["output_format"]:
question += "\n\nOutput\n\n" + benchmark["output_format"]
if benchmark["examples"]:
question += "\n\nExamples"
for example in benchmark["examples"]:
if "input" in example:
question += "\n\nInput\n\n" + example["input"]
if "output" in example:
question += "\n\nOutput\n\n" + example["output"]
if benchmark["note"]:
question += "\n\nNote\n\n" + benchmark["note"]
return question
return None
ocr2_dataset = load_dataset("nvidia/OpenCodeReasoning-2")
for ocr2_ds in [ocr2_dataset["python"], ocr2_dataset["cpp"]]:
for ocr2_ds_item in tqdm(ocr2_ds):
assert ocr2_ds_item["dataset"] in ["taco", "apps", "code_contests", "open-r1/codeforces"]
ds_name, ds_split, ds_index = ocr2_ds_item["dataset"], ocr2_ds_item["split"], int(ocr2_ds_item["index"])
question = get_question(ds_name, ds_split, ds_index)
assert question is not None
assert ocr2_ds_item["question"] == "-"
ocr2_ds_item["question"] = questionDataset Owner(s)
NVIDIA Corporation
Dataset Creation Date
March 2025 - May 2025
License/Terms of Use
GOVERNING TERMS: GOVERNING TERMS: This dataset is licensed under the Creative Commons Attribution 4.0 International License (CC BY 4.0) available at https://creativecommons.org/licenses/by/4.0/legalcode.
NOTICE FOR SCRIPTS: You may run the scripts below to pull datasets from their original source. The underlying datasets are available from the original sources subject to their own license terms.
Data Developer: NVIDIA
Use Case: <br>
Developers training Large Language Models (LLMs) to specialize LLMs in code generation and code critique. <br>
Release Date: <br>
05/15/2025 <br>
Data Version
1.0 (05/15/2025)
Dataset Characterization
** Data Collection Method<br>
- [Hybrid: Automated, Synthetic] <br>
** Labeling Method<be>
- [Hybrid: Automated, Synthetic] <br>
Intended Usage
The OpenCodeReasoning-2 Dataset is intended to be used by the community to continue to improve open models. The data may be freely used to train models. However, for each dataset a user elects to use, the user is responsible for checking if the dataset license is fit for the intended purpose.
Ethical Considerations:
NVIDIA believes Trustworthy AI is a shared responsibility and we have established policies and practices to enable development for a wide array of AI applications. When downloaded or used in accordance with our terms of service, developers should work with their internal model team to ensure this model meets requirements for the relevant industry and use case and addresses unforeseen product misuse.
Please report security vulnerabilities or NVIDIA AI Concerns here.
