Reinforcement learning with verifiable rewards (RLVR) is a promising approach for improving code generation in large language models, but its effectiveness is limited by weak and static verification signals in existing coding RL datasets. In this paper, we propose a solution-conditioned and adversarial verification framework that iteratively refines test cases based on the execution behaviors of candidate solutions, with the goal of increasing difficulty, improving discriminative power, and reducing redundancy. Based on this framework, we introduce EvolveCoder-22k, a large-scale coding reinforcement learning dataset constructed through multiple rounds of adversarial test case evolution. Empirical analysis shows that iterative refinement substantially strengthens verification, with pass@1 decreasing from 43.80 to 31.22. Reinforcement learning on EvolveCoder-22k yields stable optimization and consistent performance gains, improving Qwen3-4B by an average of 4.2 points across four downstream benchmarks and outperforming strong 4B-scale baselines. Our results highlight the importance of adversarial, solution-conditioned verification for effective and scalable reinforcement learning in code generation.
Figures & tables
Dataset
Before filtering
After filtering
EvolveCoder-22k
TACO
26,433
13,776
9,099
APPS
8,765
2,295
1,925
PrimeIntellect
16,252
5,021
3,702
Contests
13,610
4,386
3,060
Codeforces
10,024
4,959
3,856
Overall
75,084
30,437
21,642
Table 1: Statistics of seed datasets before and after filtering, and the final dataset EvolveCoder-22k . Filtering removes highly similar problem instances based on embedding similarity.
Figure 1: Semantic duplication across dataset sources.
Figure 2: Distribution of mean cosine similarity to the 10 nearest neighbors before and after filtering.
Figure 3: EvolveCoder-22k Construction Pipeline
Round
Metric
Overall
TACO
APPS
PrimeIntellect
CodeContests
Codeforces
0
#Problems
18,803
7,919
1,691
3,281
2,679
3,233
#Avg. Tests
10.76
10.70
10.78
10.49
10.77
11.20
1
#Problems
20,867
8,768
1,850
3,572
2,960
3,717
#Avg. Tests
20.87
20.43
20.13
19.45
21.17
23.39
2
#Problems
21,412
8,981
1,898
3,676
3,032
3,825
#Avg. Tests
28.39
27.58
26.70
25.84
29.16
32.96
Table 2: Dataset statistics across iterative construction rounds. For each round, we report the number of problems and the average number of test cases per problem for each subset.
Figure 4: Difficulty evolution across rounds.
Figure 5: Generated and retained test cases across rounds for two generation strategies: Method 1 (Adversarial) and Method 2 (Discriminative).
Figure 6: Pass@ k performance of diverse candidate solution models on the final dataset.
Model
EvalPlus
BCB-Full
BCB-Hard
Aider-Polyglot
LCB-v5
AVG
Δ
AceCoder-7B
82.7
43.3
19.6
-
-
-
-
DeepSeek-R1-Distill-14B
82.4
38.1
20.9
18.6
53.0
42.6
↑ 15%
DeepCoder-14B
85.3
38.2
18.2
18.4
60.6
44.1
↑ 11%
DeepSeek-V2.5-238B
83.8
48.9
27.0
17.8
42.6
44.0
↑ 11%
Qwen3-4B (Thinking)
85.2
42.0
20.9
21.8
54.2
44.8
↑ 9%
Critique-Coder-4B
86.5
43.1
23.0
24.4
59.0
47.2
↑ 4%
Table 3: Performance across rounds. Pass@1 results for models trained from Qwen3-4B (Thinking) using data from different refinement rounds, compared with strong reference models. We visualize gains of EvolveCoder-4B (r3) to each baseline in the Δ column . Abbreviations: BCB=BigCodeBench-Instruct, LCB=LiveCodeBench.
Reinforcement learning for code generation trains models to write, repair, and optimize programs using execution-based and other task-specific feedback.
Reinforcement learning (RL) has substantially advanced code generation with large language models (LLMs) through executable feedback. The feedback for coding problems mainly comes from specific test cases, where high-quality test cases are often scarce since they should be both sound and discriminative. We thus turn to study the auto-generation of test cases using the learned model. We find this is naturally an adversarial RL problem: the model is expected to generate effective test cases as counterexamples, depending on the solver's current failure modes. We propose Test Cases Scaling (TCS), a two-stage RL framework for effective test generation. Both stages train a test generator from a rolling policy-aligned buffer: Stage 1 generates tests consistent with the reference solution, and Stage 2 restricts the buffer to current failure modes and learns counterexample tests. Across TACO and LiveCodeBench, TCS improves both pass@1 and inference-time answer selection according to generated tests. We find the learned test generator also enables effective selection among other LLM outputs.
Jiacheng Xu, Wentao Zhang, Zhiyi Lyu +4
Nanyang Technological University, Singapore · Skywork AI
Reinforcement Learning from Verifiable Rewards (RLVR) is pivotal for enhancing LLM code generation, yet its efficacy is often hindered by insufficient test case coverage, leading to reward hacking and policy degradation. To address this, we propose RobustTests, a framework featuring a faulty-code-driven test case synthesis strategy. By leveraging "near-correct" faulty codes, RobustTests captures latent logical discrepancies and employs validator agents with behavioral feature clustering to filter invalid or redundant test cases. Additionally, a stepwise dense reward function based on pass rates is introduced to mitigate false negatives and enhance training robustness. Using this pipeline, we construct an augmented version of the CodeContests+ dataset with superior diagnostic utility. Experimental results show that RL fine-tuning of Qwen3-32B via RobustTests achieves a 3% absolute gain on LiveCodeBench, demonstrating its effectiveness in advancing LLM code generation proficiency. Codes and data are available at https://huggingface.co/datasets/sid6/RobustTests.
Reinforcement learning for code generation relies on verifiable rewards from unit test pass rates. Yet high-quality test suites are scarce, existing datasets offer limited coverage, and static rewards fail to adapt as models improve. Recent self-play methods unify code and test generation in a single model, but face a inherent dilemma: white-box access leads to self-collusion where the model produces trivial tests for easy rewards, yet black-box restriction yields generic tests that miss implementation-specific bugs. We introduce Code-A1, an adversarial co-evolution framework that jointly optimizes a Code LLM and a Test LLM with opposing objectives. The Code LLM is rewarded for passing more tests, while the Test LLM is rewarded for exposing more defects. This architectural separation eliminates self-collusion risks and safely enables white-box test generation, where the Test LLM can inspect candidate code to craft targeted adversarial tests. We further introduce a Mistake Book mechanism for experience replay and a composite reward balancing test validity with adversarial difficulty. Experiments on Qwen2.5-Coder models demonstrate that Code-A1 achieves code generation performance matching or exceeding models trained on human-annotated tests, while significantly improving test generation capability.