Skip to content

X-Coder: Advancing Competitive Programming with Fully Synthetic Tasks, Solutions, and Tests

Conference: EMNLP 2026
Paper: ACL Anthology
Code: https://github.com/JieWu02/X-Coder
Area: LLM / NLP
Keywords: Competitive Programming, Synthetic Data, Dual Verification, Reinforcement Learning, Long-CoT

TL;DR

Addressing the severe data scarcity and benchmark contamination risks in competitive programming, X-Coder establishes the first complete SFT-then-RL post-training lifecycle driven entirely by synthetic tasks, solutions, and executable tests, lifting a 14B model by over 40 points on LiveCodeBench.

Background & Motivation

Large language models have achieved saturating performance on standard coding benchmarks such as HumanEval and MBPP, shifting the frontier of code intelligence toward competitive programming. Unlike basic code synthesis or function implementation, competitive programming platforms—exemplified by Codeforces, AtCoder, and rigorous dynamic evaluation suites like LiveCodeBench—require deep algorithmic design, complex data structure composition, and stringent runtime-memory complexity guarantees. Recent advances in reasoning models (such as DeepSeek-R1 and AceReason) have unlocked competitive capabilities by utilizing extensive long chain-of-thought (Long-CoT) supervision and reinforcement learning. However, this data-driven scaling paradigm faces a severe sustainability ceiling: the finite pool of real-world competitive tasks is rapidly exhausted, and public repositories like APPS, CodeContests, and TACO are already heavily distilled, raising significant risks of near-duplicate benchmark contamination and memorization.

This dilemma poses a fundamental research question: Can code LLMs achieve expert-level competitive reasoning without directly reusing real-world tasks, reference solutions, or test cases during post-training? Overcoming this barrier requires resolving three core challenges. First, synthesizing competition-grade problem descriptions frequently yields trivial, ambiguous, or mathematically inconsistent tasks that lack sufficient algorithmic depth. Second, high-quality supervised fine-tuning requires logically sound reasoning paths; validating candidate solutions without ground-truth unit tests risks poisoning the training set with hallucinations and faulty logic. Third, reinforcement learning demands dependable reward signals; fragile or sparse synthetic tests fail to catch corner-case bugs, emitting noisy execution feedback that misleads policy optimization or triggers degenerate reward hacking.

To navigate these obstacles, off-the-shelf code synthesis pipelines often fail to generalize to complex competitive scenarios. The core perspective of this work is that while raw problem statements should be withheld to prevent contamination, abstract algorithmic principles can be decoupled from problem contexts, and multi-model consensus combined with difficulty-weighted verification can synthesize clean, verifiable training artifacts. Core idea: establish an end-to-end SFT-then-RL competitive programming post-training paradigm powered entirely by synthetic tasks, verified Long-CoT solutions, and reliable test suites, utilizing feature tree evolution to generate multi-style problems and a dual-verification strategy to eliminate reward noise and label errors.

Method

Overall Architecture

X-Coder formulates an end-to-end data synthesis and post-training system comprised of four stages: task formulation, test input generation, candidate solution sampling, and dual verification. The pipeline begins by extracting fine-grained algorithmic and data structure features from TACO snippets and evolving them into a domain-specific feature tree. Mutually consistent features are selected through a two-stage role assignment process to compose stylized, hint-free competitive tasks spanning Codeforces, LeetCode, and AtCoder conventions. Next, both prompting-based heuristics and dedicated test-generation tools (CYaRon) produce boundary and stress test inputs. Candidate reasoning solutions featuring complete Long-CoT trajectories are sampled from frontier open-source reasoning teachers and filtered via AST static validation. A dual-verification mechanism executes candidate solutions against generated inputs, deriving provisional test labels via majority voting and selecting robust golden solutions through weighted scoring and unseen hold-out set validation. Finally, verified \((q, A_{\text{golden}})\) pairs drive SFT, and \((q, T_{\text{golden}})\) test suites provide continuous execution rewards for GRPO reinforcement learning in a distributed sandbox environment.

%%{init: {'flowchart': {'rankSpacing': 24, 'nodeSpacing': 28, 'padding': 6, 'wrappingWidth': 400, 'subGraphTitleMargin': {'top': 8, 'bottom': 16}}}%%
flowchart TD
    A["Abstract Feature Seeds<br/>Extracted from 10k TACO Snippets"] --> B["Two-Stage Feature Evolution & Stylized Task Synthesis<br/>Breadth/Depth Evolution + Subtree Role Integration"]
    B --> C["Multi-Scale Test Input Construction<br/>Prompting Edge Cases + CYaRon Automated Tooling"]
    C --> D["Candidate Long-CoT Sampling & AST Filtering<br/>DeepSeek-R1 / Qwen3 Sampling + Syntax Validation"]
    D --> E["Dual-Verification Strategy<br/>Step 1: Multi-Model Consensus Voting on Test Labels<br/>Step 2: Difficulty Weighting & Hold-Out Validation"]
    E --> F["Synthetic Post-Training Lifecycle<br/>SFT: 200k Verified Long-CoT Trajectories<br/>RL: 40k Task Test Suites with Continuous GRPO Rewards"]

Key Designs

1. Two-Stage Feature Evolution & Stylized Task Synthesis: Preventing Task Oversimplification and Preserving Algorithmic Depth When prompted end-to-end, LLMs tend to oversimplify rich algorithmic concepts into elementary exercises, diluting task diversity and difficulty. To address this, task synthesis is decoupled into explicit feature evolution and two-stage problem formulation. First, 10,000 TACO code snippets are parsed into structured categories—including algorithms, data structures, problem categories, implementation logic, and optimization techniques. Using GPT-4o, these categories undergo breadth expansion (introducing peer techniques) and depth expansion (refining concepts, such as evolving prefix sums into difference arrays or Fenwick trees), growing the feature pool to over 582,000 nodes. In the formulation stage, the model first inspects a sampled feature subtree, annotating each leaf with its operational role (potential_use) and specifying a cohesive integration strategy (for example, combining Dijkstra's shortest path, Edmonds-Karp maximum flow, and segment trees into a dynamic transportation network problem). Only then does the model formulate the final stylized task. Problems are generated across Codeforces-style (narrative-rich standard I/O), LeetCode-style (starter function signatures), and AtCoder-style (concise specifications) formats at a 70:15:15 ratio, yielding a difficulty distribution centered at Codeforces ratings 2400–2600.

2. Multi-Scale Test Input Construction: Balancing Boundary Coverage with Large-Scale Stress Testing Evaluating code without official test suites creates severe risks of reward noise during RL. X-Coder integrates two complementary test-input generation pipelines. The prompting-based method directs the LLM to inspect problem constraints and explicitly construct 15 varied inputs targeting base cases, minimum/maximum values, empty structures, and distinct input dimensions. To overcome LLMs' inherent weakness in scaling input sizes, the tool-based method incorporates CYaRon, a specialized Olympiad test-data generation library. The teacher model writes an executable Python generator utilizing CYaRon's graph, tree, polygon, and sequence APIs with configurable random seeds. Empirical verification confirms that tool-based generation achieves an 87.9% pass rate on ground-truth solutions (compared to 77.4% for prompting-based generation) while producing a lower consensus ratio (78.8% vs. 82.0%), indicating stronger capability in exposing nuanced edge-case bugs and performance bottlenecks.

3. Candidate Long-CoT Sampling & AST Filtering: Enforcing Structural Validity and Cognitive Soundness To instill structured reasoning habits into student models, multiple candidate solutions are sampled per task using DeepSeek-R1-0528 and Qwen3-235B. Each candidate solution encompasses an extensive chain-of-thought process—covering problem decomposition, trial-and-error exploration, and backward sanity checks—alongside final Python code. The pipeline applies a four-fold static quality gate: tasks with problem statements shorter than 200 tokens are discarded; responses lacking complete, well-formed <think> and <answer> XML tags are purged; solutions failing Python Abstract Syntax Tree (AST) compilation or outputting multiple disorganized code blocks are eliminated; and trajectories exceeding 25,000 tokens are truncated to mitigate sequence padding overhead and suppress degenerative overthinking loops.

4. Dual-Verification Strategy: Multi-Model Consensus Voting and Hold-Out Validation In the absence of ground-truth test labels and reference solutions, ensuring data reliability is paramount. X-Coder introduces a strict dual-verification procedure: - Step 1 (Consensus Voting on Test Outputs): For any test input \(x_i\), all \(m\) candidate solutions are executed in isolated sandboxes to produce outputs \(\{y_1^i, \dots, y_m^i\}\). A provisional ground-truth label is assigned via majority voting: \(\hat{y}_i = \arg\max_y \sum_{j=1}^m I(y_j^i = y)\). On the TACO-verified dataset with \(m=8\) sampled solutions, this voting mechanism achieves a 94.73% labeling accuracy with a false-positive rate of only 5.27%. Combining heterogeneous model families (e.g., DeepSeek-R1 and Qwen3) further mitigates model-specific systematic blind spots. - Step 2 (Weighted Solution Selection and Hold-Out Confirmation): The candidate test set is randomly partitioned into an evaluation suite \(T_{\text{golden}}\) and an unseen hold-out validation set \(T_{\text{val}}\) (50% split). Test cases are assigned difficulty weights \(w(x_i) \in \{1, 2, 3, 4\}\) based on input byte size as a proxy for computational and memory complexity. The optimal candidate solution \(A'_{\text{golden}}\) is selected by maximizing the difficulty-weighted score over \(T_{\text{golden}}\): $\(A'_{\text{golden}} = \arg\max_{A_j \in \{A_1, \dots, A_m\}} \sum_{(x_i, \hat{y}_i) \in T_{\text{golden}}} w(x_i) \cdot I\left(A_j(x_i) = \hat{y}_i\right)\)$ \(A'_{\text{golden}}\) is confirmed as the final golden solution \(A_{\text{golden}}\) if and only if it simultaneously achieves the highest unweighted accuracy on the unseen hold-out set \(T_{\text{val}}\) among all candidate solutions; otherwise, the task is discarded. Additionally, tasks where GPT-5-High fails completely (achieving a 0% pass rate on voted tests, comprising ~36.9% of candidates) are purged as underspecified or unsolvable.

Loss & Training

The post-training pipeline follows a two-stage regime: 1. Supervised Fine-Tuning (SFT): Trained on 200,000 verified \((q, A_{\text{golden}})\) pairs by minimizing autoregressive negative log-likelihood over full Long-CoT reasoning trajectories: $\(J_{\text{SFT}}(\theta) = -\mathbb{E}_{(x, y) \sim \mathcal{D}}\left[\sum_{t=1}^{|y|} \log \pi_\theta(y_t \mid x, y_{<t})\right]\)$ SFT utilizes a global batch size of 128, a learning rate of \(5\times 10^{-5}\), and is trained for 8 epochs. 2. Reinforcement Learning (RL): Policy models are optimized using Group Relative Policy Optimization (GRPO) over 40,000 synthetic tasks. Formatting rewards are omitted since format adherence is established during SFT. The policy generates \(G=8\) rollouts per prompt, evaluated concurrently across a FastAPI and Redis-backed distributed sandbox. The continuous reward function is parameterized as: $\(R = \begin{cases} -2, & \text{if code extraction fails or code fails to compile} \\ 0, & \text{if code compiles but passes zero test cases} \\ 5.0 \times \frac{\#\text{passed}}{\#\text{total}}, & \text{otherwise (continuous pass ratio)} \end{cases}\)$ RL optimization uses a global batch size of 512, learning rate \(7\times 10^{-5}\), rollout temperature 1.0, and runs for 270 steps without explicit KL penalties.

Key Experimental Results

Main Results

Evaluation is conducted on LiveCodeBench (LCB) v5 and v6 under the standardized avg@8 metric (average pass rate across 8 independent rollouts per problem).

Model Parameters Training Stage Data Source LCB v5 (avg@8) LCB v6 (avg@8)
Qwen2.5-Coder-7B-Instruct (Base) 7B Base Instruct Real-world 17.5 21.7
Qwen2.5-Coder-14B-Instruct (Base) 14B Base Instruct Real-world 24.0 23.4
Bespoke-Stratos 7B SFT 17k Real 16.2 (pass@1) 8.6
OlympicCoder 7B SFT 100k Real 40.9 19.3
OCR-Qwen-Instruct 7B SFT 736k Real 51.3 (avg@64) 44.5
OpenThinker3 7B SFT 1.2M Mixed 51.7 40.8
Qwen3-8B 8B SFT Real-world 57.5 48.4
Skywork-OR1 7B RL 124k Real 47.6 (avg@32) 40.0
DeepCoder-Preview 14B RL 24k Real 57.9 (pass@1) 48.5
AReal-boba² 14B RL 24k Real 58.1 (avg@32) 56.7
AceReason1.1 7B SFT+RL 2.2M Real 57.2 52.1
MiMo 7B SFT+RL 130k Undisclosed 57.8 49.3
Klear-Reasoner 8B SFT+RL 106k Real 61.6 53.1
X-Coder-7B-SFT 7B SFT 200k Synthetic 60.3 ± 2.5 53.5 ± 1.7
X-Coder-7B-RL 7B SFT+RL 40k Synthetic 62.9 ± 1.8 55.8 ± 1.9
X-Coder-14B-SFT 14B SFT 200k Synthetic 64.2 ± 1.7 59.1 ± 2.5
X-Coder-14B-RL 14B SFT+RL 40k Synthetic 67.5 ± 1.2 63.4 ± 2.6

Ablation Study

Ablations isolate the individual contributions of data verification, synthesis strategy, scaling axes, and reasoning trajectory length.

Configuration Metric (LCB v5) Observation & Impact
Raw Solutions (64k) 47.0% Training on unverified sampled solutions introduces hallucinatory logic
Verified Solutions (64k) 53.4% Dual verification filters noisy solutions, yielding a +6.4% net boost
One-Step Task Generation 34.8% Joint feature selection and drafting collapses into trivial tasks
Two-Stage Task Generation 40.1% Decoupling subtree role selection improves task rigor by +5.3%
Solution Scaling (\(8k \times 8\) solutions) 44.4% Repeating solutions per task narrows general algorithmic coverage
Task Scaling (\(64k \times 1\) solution) 47.0% Scaling unique problem prompts outperforms solution scaling under fixed tokens
Short-CoT Supervision (Epoch 8) 43.1% Fast convergence but capped algorithmic depth
Long-CoT Supervision (Epoch 8) 60.3% Deliberate reasoning traces produce an absolute gain of +17.2%
Open-Source Teacher Pipeline (Qwen3.5-35B, 32k) 27.7% (+10.2 over Base) Demonstrates strong synthetic gains without proprietary teacher dependencies

Key Findings

  • Task diversity dominates solution diversity: Under equivalent token budgets, scaling unique problem prompts (\(64\text{k}\times 1\)) outperforms scaling solutions per prompt (\(8\text{k}\times 8\), 47.0% vs. 44.4%). Increasing unique tasks up to 200k achieves monotonic improvement up to 62.7%, demonstrating that competitive programming requires diverse algorithmic scenario coverage rather than memorizing solution variants.
  • SFT drives primary capability acquisition; RL acts as a critical functional refiner: Long-CoT SFT accounts for over 80% of total performance gains by instilling planning, backtracking, and reflection behaviors. Reinforcement learning provides indispensable, complementary alignment that grounds execution behavior and eliminates subtle runtime discrepancies.
  • Algorithmic reasoning errors remain the dominant failure mode: Error analysis on LCB v5 reveals that Wrong Answer errors account for the vast majority of failures (dropping from 194.6 in the base model to 67.9 after RL), followed by context exhaustion and time limit exceeded (TLE). Syntax errors and format mismatches are virtually eliminated.

Highlights & Insights

  • Shattering the real-world data bottleneck: Confirms for the first time that an entirely synthetic training artifact suite (tasks, solutions, and tests) can fully sustain the post-training lifecycle of frontier competitive code models without direct contamination risks.
  • Two-stage subtree role integration: Systematically prevents LLM prompt collapse when synthesizing complex algorithmic scenarios, successfully concentrating problem difficulties into the 2400–2600 Codeforces rating tier.
  • High-throughput distributed verification architecture: Combines FastAPI, Redis atomic operations (BZPOPMIN/BLPOP), and sandboxed execution workers, enabling the verification of 1.6M candidate trajectories across 24M sandbox executions during dataset construction and providing ultra-low-latency rewards during GRPO.

Limitations & Future Work

  • Scope confined to self-contained algorithmic problems: The methodology operates on algorithmic problems with clean standard I/O or defined function signatures. It does not directly generalize to repository-level software engineering (e.g., SWE-bench), multi-file dependency resolution, or interactive visual/GUI coding.
  • Residual teacher noise and correlated consensus errors: Human audits reveal a 12.7% residual error rate in synthetic golden solutions and voted labels prior to deterministic signature filtering. When candidate solutions from identical model families share common reasoning blind spots, majority voting can fail to eliminate correlated errors.
  • Inverse relationship between reasoning token length and pass rates: Harder tasks trigger longer CoT reasoning sequences, which correlates with higher context exhaustion rates (hitting the 32k token ceiling) and run-time timeouts, calling for adaptive inference-time computation control.
  • vs. OpenCodeReasoning (NVIDIA): OpenCodeReasoning synthesizes large-scale reasoning traces over approximately 28,000 real-world competitive prompts crawled from APPS and TACO; X-Coder completely eliminates direct dependence on real tasks, demonstrating superior performance on medium and hard splits via synthetic task diversity.
  • vs. EpiCoder: EpiCoder pioneered general-purpose feature-based code synthesis; X-Coder tailors the framework to competitive programming via tree evolution, two-stage role assignment, and CYaRon-driven test generation, achieving a 20.9% gain over general feature synthesis on LCB v5.
  • vs. AceReason / Klear-Reasoner: Prior hybrid SFT-then-RL frameworks heavily blend mathematical datasets with real competitive coding corpora; X-Coder proves that code-centric RL with execution pass-rate rewards can operate effectively and stably entirely on synthetic test suites.

Rating

  • Novelty: ⭐⭐⭐⭐⭐ Establishes the first fully synthetic SFT-to-RL pipeline for competitive programming without real-world tasks, solutions, or tests.
  • Experimental Thoroughness: ⭐⭐⭐⭐⭐ Comprehensive evaluations across LiveCodeBench v5/v6, Codeforces, LiveBench, extensive ablations, and rigorous data contamination checks.
  • Writing Quality: ⭐⭐⭐⭐⭐ Clear exposition, elegant methodology decoupling, and rigorous mathematical formulations of the dual-verification protocol.
  • Value: ⭐⭐⭐⭐⭐ Demonstrates a scalable and reproducible pathway for self-improving reasoning models to break free from the finite ceiling of human-authored competition problems.