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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: cc-by-4.0
|
| 3 |
+
task_categories:
|
| 4 |
+
- text-generation
|
| 5 |
+
language:
|
| 6 |
+
- en
|
| 7 |
+
tags:
|
| 8 |
+
- code
|
| 9 |
+
- reinforcement-learning
|
| 10 |
+
- rlvr
|
| 11 |
+
- test-cases
|
| 12 |
+
- code-generation
|
| 13 |
+
- competitive-programming
|
| 14 |
+
size_categories:
|
| 15 |
+
- 10K<n<100K
|
| 16 |
---
|
| 17 |
+
|
| 18 |
+
# RobustTests
|
| 19 |
+
|
| 20 |
+
## Dataset Description
|
| 21 |
+
|
| 22 |
+
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.
|
| 23 |
+
|
| 24 |
+
📄 **Paper**: [Robust Code RL via Faulty-Code-Driven Test Case Synthesis and Dense Reward Shaping](https://arxiv.org/abs/2608.24135) — Findings of EMNLP 2026
|
| 25 |
+
|
| 26 |
+
**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.
|
| 27 |
+
|
| 28 |
+
## Key Features
|
| 29 |
+
|
| 30 |
+
- **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.
|
| 31 |
+
- **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.
|
| 32 |
+
- **RLVR-Ready**: Designed specifically for reinforcement learning from verifiable rewards, the test cases serve as reliable verification oracles for code generation tasks.
|
| 33 |
+
- **Compact Encoding**: Test cases are encoded using a multi-layer compression scheme (Base64 → Zlib → Pickle) to keep storage efficient while preserving all data fidelity.
|
| 34 |
+
|
| 35 |
+
## Dataset Statistics
|
| 36 |
+
|
| 37 |
+
| Metric | Value |
|
| 38 |
+
|--------|-------|
|
| 39 |
+
| Total problems | 11,636 |
|
| 40 |
+
| Number of files | 4 (sharded parquet) |
|
| 41 |
+
| License | CC-BY-4.0 |
|
| 42 |
+
|
| 43 |
+
### Source Distribution
|
| 44 |
+
|
| 45 |
+
| Source | Count | Percentage |
|
| 46 |
+
|--------|-------|------------|
|
| 47 |
+
| Codeforces | 7,525 | 64.7% |
|
| 48 |
+
| AIZU | 2,028 | 17.4% |
|
| 49 |
+
| AtCoder | 1,318 | 11.3% |
|
| 50 |
+
| CodeChef | 765 | 6.6% |
|
| 51 |
+
|
| 52 |
+
## Dataset Structure
|
| 53 |
+
|
| 54 |
+
### Data Fields
|
| 55 |
+
|
| 56 |
+
| Field | Type | Description |
|
| 57 |
+
|-------|------|-------------|
|
| 58 |
+
| `source` | `string` | The competitive programming platform the problem originates from (e.g., Codeforces, AIZU, AtCoder, CodeChef) |
|
| 59 |
+
| `id` | `string` | Unique identifier for the problem, which can be used to match with the corresponding problem in Code-Contests-Plus |
|
| 60 |
+
| `testcase` | `struct` | Test case container with the following sub-fields: |
|
| 61 |
+
| `testcase.inputs` | `list<string>` | List of encoded input strings for each test case (Base64 → Zlib → Pickle compressed) |
|
| 62 |
+
| `testcase.outputs` | `list<string>` | List of encoded expected output strings for each test case (Base64 → Zlib → Pickle compressed) |
|
| 63 |
+
|
| 64 |
+
### Data Format
|
| 65 |
+
|
| 66 |
+
The dataset is stored in Parquet format, sharded across 4 files:
|
| 67 |
+
- `part-00000-of-00004.parquet` (2,909 rows)
|
| 68 |
+
- `part-00001-of-00004.parquet` (2,909 rows)
|
| 69 |
+
- `part-00002-of-00004.parquet` (2,909 rows)
|
| 70 |
+
- `part-00003-of-00004.parquet` (2,909 rows)
|
| 71 |
+
|
| 72 |
+
## How to Use
|
| 73 |
+
|
| 74 |
+
### Installation
|
| 75 |
+
|
| 76 |
+
```bash
|
| 77 |
+
pip install datasets
|
| 78 |
+
```
|
| 79 |
+
|
| 80 |
+
### Loading the Dataset
|
| 81 |
+
|
| 82 |
+
```python
|
| 83 |
+
from datasets import load_dataset
|
| 84 |
+
|
| 85 |
+
# Load the complete dataset
|
| 86 |
+
dataset = load_dataset("Anonymous/robusttests")
|
| 87 |
+
|
| 88 |
+
# Access a specific problem
|
| 89 |
+
problem = dataset['train'][0]
|
| 90 |
+
print(f"Source: {problem['source']}")
|
| 91 |
+
print(f"ID: {problem['id']}")
|
| 92 |
+
print(f"Number of test cases: {len(problem['testcase']['inputs'])}")
|
| 93 |
+
```
|
| 94 |
+
|
| 95 |
+
### Decoding Test Cases
|
| 96 |
+
|
| 97 |
+
Test cases are stored using a multi-layer compression encoding. Use the following code to decode:
|
| 98 |
+
|
| 99 |
+
```python
|
| 100 |
+
import base64
|
| 101 |
+
import zlib
|
| 102 |
+
import pickle
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
def decode_testcase(encoded_testcase):
|
| 106 |
+
"""Decode a single encoded test case.
|
| 107 |
+
|
| 108 |
+
Decoding chain: Base64 → Zlib → Pickle → UTF-8 string
|
| 109 |
+
|
| 110 |
+
Args:
|
| 111 |
+
encoded_testcase: Base64-encoded compressed test case string
|
| 112 |
+
|
| 113 |
+
Returns:
|
| 114 |
+
str: Decoded raw input/output text
|
| 115 |
+
"""
|
| 116 |
+
# Step 1: Base64 decode - convert the encoded string back to binary data
|
| 117 |
+
decoded = base64.b64decode(encoded_testcase)
|
| 118 |
+
|
| 119 |
+
# Step 2: Zlib decompress - restore the compressed binary data
|
| 120 |
+
decompressed = zlib.decompress(decoded)
|
| 121 |
+
|
| 122 |
+
# Step 3: Pickle deserialize - reconstruct Python object from binary
|
| 123 |
+
data = pickle.loads(decompressed)
|
| 124 |
+
|
| 125 |
+
# Step 4: Decode bytes to UTF-8 string
|
| 126 |
+
if isinstance(data, bytes):
|
| 127 |
+
data = data.decode('utf-8')
|
| 128 |
+
|
| 129 |
+
return data
|
| 130 |
+
|
| 131 |
+
|
| 132 |
+
def parse_testcase(testcase):
|
| 133 |
+
"""Parse the entire testcase field by decoding all inputs and outputs.
|
| 134 |
+
|
| 135 |
+
Args:
|
| 136 |
+
testcase: A dict with 'inputs' and 'outputs' fields,
|
| 137 |
+
where each element is a Base64-encoded compressed string
|
| 138 |
+
|
| 139 |
+
Returns:
|
| 140 |
+
dict: Decoded testcase in the format:
|
| 141 |
+
{'inputs': [str, ...], 'outputs': [str, ...]}
|
| 142 |
+
"""
|
| 143 |
+
return {
|
| 144 |
+
'inputs': [decode_testcase(x) for x in testcase['inputs']],
|
| 145 |
+
'outputs': [decode_testcase(x) for x in testcase['outputs']]
|
| 146 |
+
}
|
| 147 |
+
```
|
| 148 |
+
|
| 149 |
+
### Usage Example
|
| 150 |
+
|
| 151 |
+
```python
|
| 152 |
+
from datasets import load_dataset
|
| 153 |
+
|
| 154 |
+
dataset = load_dataset("Anonymous/robusttests")
|
| 155 |
+
problem = dataset['train'][0]
|
| 156 |
+
|
| 157 |
+
# Decode all test cases
|
| 158 |
+
decoded = parse_testcase(problem['testcase'])
|
| 159 |
+
|
| 160 |
+
# Inspect test cases
|
| 161 |
+
for i, (inp, out) in enumerate(zip(decoded['inputs'], decoded['outputs'])):
|
| 162 |
+
print(f"--- Test Case {i+1} ---")
|
| 163 |
+
print(f"Input:\n{inp}")
|
| 164 |
+
print(f"Expected Output:\n{out}")
|
| 165 |
+
```
|
| 166 |
+
|
| 167 |
+
## Evaluation
|
| 168 |
+
|
| 169 |
+
### Benchmark Results
|
| 170 |
+
|
| 171 |
+
When used to train **Qwen3-32B** via **GRPO**, replacing the original test cases with RobustTests leads to consistent improvements across benchmarks:
|
| 172 |
+
|
| 173 |
+
| Benchmark | Metric | CodeContests+ | RobustTests | Gain |
|
| 174 |
+
|-----------|--------|---------------|-------------|------|
|
| 175 |
+
| LiveCodeBench (2024.08–2025.01) | Score | 65.41 | 68.39 | +2.98 |
|
| 176 |
+
| Codeforces | Score | 35.56 | 38.50 | +2.94 |
|
| 177 |
+
| Codeforces | Rating | 83.96 | 85.99 | +2.03 |
|
| 178 |
+
| Codeforces | Percentile | 91.45 | 94.67 | +3.22 |
|
| 179 |
+
|
| 180 |
+
### Dense Reward Function
|
| 181 |
+
|
| 182 |
+
The dataset is designed to work with a stepwise dense reward function:
|
| 183 |
+
|
| 184 |
+
```python
|
| 185 |
+
def compute_reward(pass_count, total_count):
|
| 186 |
+
"""
|
| 187 |
+
Stepwise dense reward based on pass rate.
|
| 188 |
+
|
| 189 |
+
Args:
|
| 190 |
+
pass_count: Number of test cases passed
|
| 191 |
+
total_count: Total number of test cases
|
| 192 |
+
|
| 193 |
+
Returns:
|
| 194 |
+
float: Reward value
|
| 195 |
+
"""
|
| 196 |
+
if pass_count == total_count:
|
| 197 |
+
return 1.1 # All tests passed
|
| 198 |
+
elif pass_count == 0:
|
| 199 |
+
return -0.1 # All tests failed
|
| 200 |
+
else:
|
| 201 |
+
return 0.1 * (pass_count / total_count) # Partial credit
|
| 202 |
+
```
|
| 203 |
+
|
| 204 |
+
## Intended Uses
|
| 205 |
+
|
| 206 |
+
- **RLVR Training**: Serve as high-quality verification oracles for reinforcement learning from verifiable rewards in code generation.
|
| 207 |
+
- **Code Generation Evaluation**: Provide comprehensive test cases for evaluating code generation models on competitive programming problems.
|
| 208 |
+
- **Anti-Reward-Hacking Research**: Enable research into mitigating reward hacking in RL-based code training.
|
| 209 |
+
|
| 210 |
+
## Limitations
|
| 211 |
+
|
| 212 |
+
- 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.
|
| 213 |
+
- The dataset covers competitive programming problems, which may not represent the full diversity of real-world software engineering tasks.
|
| 214 |
+
- While test coverage is significantly enhanced compared to the original problems, it may still not be exhaustive for all possible edge cases.
|
| 215 |
+
- The test cases are designed for programs that read from stdin and write to stdout, following the competitive programming convention.
|
| 216 |
+
|
| 217 |
+
## Source Data
|
| 218 |
+
|
| 219 |
+
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.
|
| 220 |
+
|
| 221 |
+
## Citation
|
| 222 |
+
|
| 223 |
+
If you find RobustTests useful in your research, please cite our paper:
|
| 224 |
+
|
| 225 |
+
```bibtex
|
| 226 |
+
@article{zhang2026robust,
|
| 227 |
+
title={Robust Code RL via Faulty-Code-Driven Test Case Synthesis and Dense Reward Shaping},
|
| 228 |
+
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},
|
| 229 |
+
journal={arXiv preprint arXiv:2608.24135},
|
| 230 |
+
year={2026}
|
| 231 |
+
}
|
| 232 |
+
|
| 233 |
+
## License
|
| 234 |
+
|
| 235 |
+
This project is licensed under **CC-BY-4.0**. See the [LICENSE](LICENSE) file for details.
|
| 236 |
+
|
| 237 |
+
## Acknowledgements
|
| 238 |
+
|
| 239 |
+
- [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.
|
| 240 |
+
- The competitive programming platforms (Codeforces, AIZU, AtCoder, CodeChef) that originally host these problems.
|