Datasets:

CodeForces-IRIS / README.md
aandvalenzuela's picture
Remove licensing for now
c103a56 verified
|
Raw History Blame Contribute Delete
6.87 kB
---
task_categories:
- translation
- text-generation
language:
- en
tags:
- llvm
- gimple
- gcc
- clang
- compiler
- intermediate-representation
- compiler-ir
- ir
- competitive-programming
- codeforces
pretty_name: CodeForces-IRIS
size_categories:
- 1K<n<10K
configs:
- config_name: problems
data_files:
- split: train
path: fancy_iris_c_v4_clustering_test_max5/problems/*
features:
- name: id
dtype: string
- name: description
dtype: string
- name: official_tests
list:
- name: input
dtype: string
- name: output
dtype: string
- name: rating
dtype: int64
- name: tags
sequence: string
- name: title
dtype: string
- config_name: submissions
data_files:
- split: train
path: fancy_iris_c_v4_clustering_test_max5/submissions/*
features:
- name: submission_id
dtype: string
- name: problem_id
dtype: string
- name: source
dtype: string
- name: programmingLanguage
dtype: string
- name: irs
struct:
- name: gcc_gimple
dtype: string
- name: clang
dtype: string
- name: test_results
struct:
- name: gcc
struct:
- name: compile_success
dtype: bool
- name: passed
dtype: int64
- name: failed
dtype: int64
- name: total
dtype: int64
- name: status
dtype: string
- name: clang
struct:
- name: compile_success
dtype: bool
- name: passed
dtype: int64
- name: failed
dtype: int64
- name: total
dtype: int64
- name: status
dtype: string
dataset_info:
- config_name: problems
splits:
- name: train
num_examples: 487
- config_name: submissions
splits:
- name: train
num_examples: 1192
---
# 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 identifier
- `description`: Full problem statement
- `official_tests`: List of test cases with `input` and `output` fields
- `rating`: Problem difficulty rating
- `tags`: Problem category tags
- `title`: Problem title
### Submissions Subset (1,798 examples)
- `submission_id`: Unique submission identifier
- `problem_id`: Reference to problem
- `source`: C source code
- `programmingLanguage`: 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
```python
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](https://huggingface.co/datasets/open-r1/codeforces) and [open-r1/codeforces-submissions](https://huggingface.co/datasets/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
1. Extracted 13 static features (lines, loops, conditionals, structs, pointers, etc.) and 4 dynamic features (execution time, memory, CPU, size)
2. Applied k-means clustering with k=3 for each problem to group similar implementation strategies
3. Selected the submission closest to each cluster centroid as the representative
4. This ensures maximum code diversity while minimizing redundant submissions
**Clustering Example for Problem 579/A**
<img src="https://cdn-uploads.huggingface.co/production/uploads/64da082a79c87e13ca232042/iZNdnatHTNKmef9k376Zu.png" width="500px" />
_(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:
```bibtex
@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:
```bibtex
@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}}
}
```