Dataset Card for CodeForces-IRIS
CodeForces-IRIS is an evaluation test-set designed to assess Large Language Models on compiler intermediate representation (IR) translation tasks. Specifically, we use it to evaluate GIMPLE IR to LLVM IR code translation. It contains 1,192 C submissions across 487 competitive programming problems with their corresponding GIMPLE and LLVM IR representations and official test cases for functional validation.
Dataset Structure
The dataset consists of two subsets: problems and submissions.
Problems Subset (496 examples)
id: Unique problem identifierdescription: Full problem statementofficial_tests: List of test cases withinputandoutputfieldsrating: Problem difficulty ratingtags: Problem category tagstitle: Problem title
Submissions Subset (1,798 examples)
submission_id: Unique submission identifierproblem_id: Reference to problemsource: C source codeprogrammingLanguage: Programming language variant (GNU C or GNU C11)irs: Dictionary containing intermediate representations:gcc_gimple: GIMPLE IR generated by GCC v15.2.0.clang: LLVM IR generated by Clang v22.1.0.
test_results: Compilation and test execution results for both GCC and Clang
Usage
from datasets import load_dataset
import json
# Load dataset
problems = load_dataset("HPAI-BSC/CodeForces-IRIS", "problems", split="train")
submissions = load_dataset("HPAI-BSC/CodeForces-IRIS", "submissions", split="train")
problem_dict = {p["id"]: p for p in problems}
# Example evaluation
sample = submissions[0]
problem = problem_dict[sample["problem_id"]]
gimple_ir = sample["irs"]["gcc_gimple"]
# 1. Model translates GIMPLE IR to LLVM IR
llvm_ir = ...
# 2. Save and compile LLVM IR (Syntax check)
with open("main.ll", "w") as f:
f.write(llvm_ir)
!clang main.ll -o binary -O0
# 3. Run tests (Functionality check)
for i, test in enumerate(problem["official_tests"]):
with open(f"input_{i}.txt", "w") as f:
f.write(test["input"])
!./binary < input_{i}.txt > output_{i}.txt
with open(f"output_{i}.txt") as f:
actual_output = f.read().strip()
expected_output = test["output"].strip()
assert actual_output == expected_output
Dataset Creation
The dataset is derived from the Codeforces competitive programming platform, using the open-r1/codeforces and open-r1/codeforces-submissions datasets.
The dataset creation involved multiple steps:
Filtering
We curated and filtered the original dataset using a diversity-based clustering approach:
| Stage | # Submissions | Description |
|---|---|---|
| Original submissions | 10M+ | Full CodeForces submissions dataset |
| C language submissions | 110,657 | Submissions in C (GNU C or GNU C11) |
| Compile with GCC & Clang | 87,161 | Successfully compile with both GCC 15.2.0 and Clang 22.1.0 |
| Pass all tests and IR generation | 61,057 | Submissions that pass all official test cases |
| Clustering (k=3) | 1,192 (487) | Representative submissions (problems) selected via k-means |
Clustering
- Extracted 13 static features (lines, loops, conditionals, structs, pointers, etc.) and 4 dynamic features (execution time, memory, CPU, size)
- Applied k-means clustering with k=3 for each problem to group similar implementation strategies
- Selected the submission closest to each cluster centroid as the representative
- This ensures maximum code diversity while minimizing redundant submissions
Clustering Example for Problem 579/A
(Figure generated for k=5 during method exploration)
Each small dot represents a C submission. We embed a vector with 13 static features and 4 dynamic features. k=3 groups are formed for each. To build our final evaluation set, we sample 3 submissions from different centroids for each problem.
For a more detailed explanation, refer to our paper "LLM Translation of Compiler Intermediate Representation".
Citation
If you use this dataset, please cite:
@article{ramirez2026llm,
title={LLM Translation of Compiler Intermediate Representation},
author={Valenzuela-Ramirez, Andrea and Gutierrez-Gomez, Cristian and Barroso, Marta and Garcia-Gasulla, Dario and Royuela, Sara},
journal={arXiv preprint arXiv:2605.08247},
year={2026}
}
And the original CodeForces datasets:
@misc{openr1codeforces2025,
title={CodeForces Dataset Collection},
author={Penedo, Guilherme and Lozhkov, Anton and Kydlíček, Hynek and Ben Allal, Loubna and Beeching, Edward and Piqueres Lajarín, Agustín and Gallouédec, Quentin and Habib, Nathan and Tunstall, Lewis and von Werra, Leandro},
year={2025},
publisher={Hugging Face},
howpublished={\url{https://huggingface.co/datasets/open-r1/codeforces}}
}
- Downloads last month
- 6