--- license: cc-by-4.0 task_categories: - text-generation language: - en tags: - code - reinforcement-learning - rlvr - test-cases - code-generation - competitive-programming size_categories: - 10K

Robust Code RL via Faulty-Code-Driven Test Case Synthesis and Dense Reward Shaping

[![arXiv](https://img.shields.io/badge/arXiv-2608.24135-b31b1b.svg?logo=arxiv)](https://arxiv.org/abs/2608.24135) [![Venue](https://img.shields.io/badge/Venue-Findings%20of%20EMNLP%202026-4c6ef5.svg)](https://arxiv.org/abs/2608.24135) [![Dataset License](https://img.shields.io/badge/Dataset%20License-CC--BY--4.0-f1df61.svg)](https://creativecommons.org/licenses/by/4.0/) ## Dataset Description RobustTests is a high-quality test case dataset specifically designed for **reinforcement learning from verifiable rewards (RLVR)** in code generation tasks. It addresses the fundamental limitation of insufficient test coverage that often causes **false positives** and **reward hacking** in RL-based code training. **Important**: To avoid copyright issues, this dataset only provides the test case collections — it does not include the original problem descriptions. Each problem is identified by its `id` and `source`, which can be used to match with the corresponding problems in [Code-Contests-Plus](https://huggingface.co/datasets/ByteDance-Seed/Code-Contests-Plus) or the original competitive programming platforms. ## Key Features - **High-Coverage Test Cases**: Each problem is equipped with a rich set of test cases covering various edge cases, boundary conditions, and corner cases, significantly reducing false positives in reward computation. - **Anti-Reward-Hacking**: By providing thorough test coverage, RobustTests mitigates reward hacking — a common failure mode where models learn to pass a small number of visible test cases without producing genuinely correct solutions. - **RLVR-Ready**: Designed specifically for reinforcement learning from verifiable rewards, the test cases serve as reliable verification oracles for code generation tasks. - **Compact Encoding**: Test cases are encoded using a multi-layer compression scheme (Base64 → Zlib → Pickle) to keep storage efficient while preserving all data fidelity. ## Dataset Statistics | Metric | Value | |--------|-------| | Total problems | 11,636 | | Number of files | 4 (sharded parquet) | | License | CC-BY-4.0 | ### Source Distribution | Source | Count | Percentage | |--------|-------|------------| | Codeforces | 7,525 | 64.7% | | AIZU | 2,028 | 17.4% | | AtCoder | 1,318 | 11.3% | | CodeChef | 765 | 6.6% | ## Dataset Structure ### Data Fields | Field | Type | Description | |-------|------|-------------| | `source` | `string` | The competitive programming platform the problem originates from (e.g., Codeforces, AIZU, AtCoder, CodeChef) | | `id` | `string` | Unique identifier for the problem, which can be used to match with the corresponding problem in Code-Contests-Plus | | `testcase` | `struct` | Test case container with the following sub-fields: | | `testcase.inputs` | `list` | List of encoded input strings for each test case (Base64 → Zlib → Pickle compressed) | | `testcase.outputs` | `list` | List of encoded expected output strings for each test case (Base64 → Zlib → Pickle compressed) | ### Data Format The dataset is stored in Parquet format, sharded across 4 files: - `part-00000-of-00004.parquet` (2,909 rows) - `part-00001-of-00004.parquet` (2,909 rows) - `part-00002-of-00004.parquet` (2,909 rows) - `part-00003-of-00004.parquet` (2,909 rows) ## How to Use ### Installation ```bash pip install datasets ``` ### Loading the Dataset ```python from datasets import load_dataset # Load the complete dataset dataset = load_dataset("sid6/RobustTests") # Access a specific problem problem = dataset['train'][0] print(f"Source: {problem['source']}") print(f"ID: {problem['id']}") print(f"Number of test cases: {len(problem['testcase']['inputs'])}") ``` ### Decoding Test Cases Test cases are stored using a multi-layer compression encoding. Use the following code to decode: ```python import base64 import zlib import pickle def decode_testcase(encoded_testcase): """Decode a single encoded test case. Decoding chain: Base64 → Zlib → Pickle → UTF-8 string Args: encoded_testcase: Base64-encoded compressed test case string Returns: str: Decoded raw input/output text """ # Step 1: Base64 decode - convert the encoded string back to binary data decoded = base64.b64decode(encoded_testcase) # Step 2: Zlib decompress - restore the compressed binary data decompressed = zlib.decompress(decoded) # Step 3: Pickle deserialize - reconstruct Python object from binary data = pickle.loads(decompressed) # Step 4: Decode bytes to UTF-8 string if isinstance(data, bytes): data = data.decode('utf-8') return data def parse_testcase(testcase): """Parse the entire testcase field by decoding all inputs and outputs. Args: testcase: A dict with 'inputs' and 'outputs' fields, where each element is a Base64-encoded compressed string Returns: dict: Decoded testcase in the format: {'inputs': [str, ...], 'outputs': [str, ...]} """ return { 'inputs': [decode_testcase(x) for x in testcase['inputs']], 'outputs': [decode_testcase(x) for x in testcase['outputs']] } ``` ### Usage Example ```python from datasets import load_dataset dataset = load_dataset("sid6/RobustTests") problem = dataset['train'][0] # Decode all test cases decoded = parse_testcase(problem['testcase']) # Inspect test cases for i, (inp, out) in enumerate(zip(decoded['inputs'], decoded['outputs'])): print(f"--- Test Case {i+1} ---") print(f"Input:\n{inp}") print(f"Expected Output:\n{out}") ``` ## Evaluation ### Benchmark Results When used to train **Qwen3-32B** via **GRPO**, replacing the original test cases with RobustTests leads to consistent improvements across benchmarks: | Benchmark | Metric | CodeContests+ | RobustTests | Gain | |-----------|--------|---------------|-------------|------| | LiveCodeBench (2024.08–2025.01) | Score | 65.41 | 68.39 | +2.98 | | Codeforces | Score | 35.56 | 38.50 | +2.94 | | Codeforces | Rating | 83.96 | 85.99 | +2.03 | | Codeforces | Percentile | 91.45 | 94.67 | +3.22 | ### Dense Reward Function The dataset is designed to work with a stepwise dense reward function: ```python def compute_reward(pass_count, total_count): """ Stepwise dense reward based on pass rate. Args: pass_count: Number of test cases passed total_count: Total number of test cases Returns: float: Reward value """ if pass_count == total_count: return 1.1 # All tests passed elif pass_count == 0: return -0.1 # All tests failed else: return 0.1 * (pass_count / total_count) # Partial credit ``` ## Intended Uses - **RLVR Training**: Serve as high-quality verification oracles for reinforcement learning from verifiable rewards in code generation. - **Code Generation Evaluation**: Provide comprehensive test cases for evaluating code generation models on competitive programming problems. - **Anti-Reward-Hacking Research**: Enable research into mitigating reward hacking in RL-based code training. ## Limitations - The dataset only provides test cases — problem descriptions must be obtained from [Code-Contests-Plus](https://huggingface.co/datasets/ByteDance-Seed/Code-Contests-Plus) or the original platforms. - The dataset covers competitive programming problems, which may not represent the full diversity of real-world software engineering tasks. - While test coverage is significantly enhanced compared to the original problems, it may still not be exhaustive for all possible edge cases. - The test cases are designed for programs that read from stdin and write to stdout, following the competitive programming convention. ## Source Data The test cases in this dataset are designed for problems from [Code-Contests-Plus](https://huggingface.co/datasets/ByteDance-Seed/Code-Contests-Plus), a dataset published by ByteDance Seed that aggregates competitive programming problems from platforms including Codeforces, AIZU, AtCoder, and CodeChef. ## Citation If you find RobustTests useful in your research, please cite our paper: ```bibtex @article{zhang2026robust, title={Robust Code RL via Faulty-Code-Driven Test Case Synthesis and Dense Reward Shaping}, author={Zhang, Yiwen and Yan, Xiaodong and Huang, Zhenyu and Zhao, Deng and Jiang, Liang and Cui, Qing and Wen, Zujie and Zhang, Zhiqiang and Zhou, Jun}, journal={arXiv preprint arXiv:2608.24135}, year={2026} } ``` ## License This project is licensed under **CC-BY-4.0**. See the [LICENSE](LICENSE) file for details. ## Acknowledgements - [Code-Contests-Plus](https://huggingface.co/datasets/ByteDance-Seed/Code-Contests-Plus) — the ByteDance Seed dataset that provides the problems these test cases are designed for. - The competitive programming platforms (Codeforces, AIZU, AtCoder, CodeChef) that originally host these problems.