NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

From f(x) and g(x) to f(g(x)): LLMs Learn New Skills in RL by Composing Old Ones

Lifan Yuan, Weize Chen, Yuchen Zhang, Ganqu Cui, Hanbin Wang, Ziming You, Ning Ding, Zhiyuan Liu, Maosong Sun, Hao Peng

Does Reinforcement Learning (RL) actually teach large language models (LLMs) new tricks, or does it merely help them find the tricks they already knew? This question is at the core of ongoing debates about the role of RL in LLM post-training. While RL has shown incredible results in reasoning tasks (e.g., in models like o1 or DeepSeek-R1), critics argue it might just be a "reranking illusion"—simply reweighting the model to pick a correct reasoning path it already possessed from pre-training.

This paper provides concrete evidence that RL does enable LLMs to acquire genuinely new skills. It does so by teaching models to compose existing "atomic" skills into complex, nested sequences, mirroring human cognitive skill acquisition.

The Challenge of Data Contamination

Proving "new skill acquisition" is notoriously difficult due to data contamination. If a model solves a complex calculus problem after RL, did it learn calculus, or did it just retrieve a memorized solution from its massive pre-training dataset?

To mitigate this, the researchers developed a strictly controlled, synthetic framework: the String Transformation Testbed. By defining a skill as the ability to infer the output of a string transformation function $f(x)$ given $x$, they could guarantee the model had never seen the complex, composed tasks before.

Overview of the RL Compositionality Hypothesis and Testbed

Methods: The String Transformation Testbed

The authors utilized a two-stage training framework to isolate skill acquisition:

  1. Stage 1: Atomic Skill Acquisition. The base model is trained via next-token prediction to learn 25 "atomic" functions (e.g., func_16(x) might reverse a string). Crucially, these functions are given meaningless names to prevent the model from relying on semantic priors.
  2. Stage 2: Compositional Skill Training. The model is then trained to solve "Level 2" problems—nested functions like func_16(func_15(x)).

The researchers compared two approaches for Stage 2:

  • Supervised Fine-Tuning (SFT) / Rejection Fine-Tuning (RFT): A supervised approach where the model learns from step-by-step demonstrations or its own successful attempts.
  • Reinforcement Learning (RL): Using algorithms where the model is rewarded solely for the final correct output, without step-by-step guidance.

Key Insights and Results

1. RL Overcomes the "Reranking Illusion"

On easy problems, RL and the base model perform similarly as the number of sampled generations ($k$) increases. However, on hard, nested problems (Level 3+) where the base model has a near 0% success rate, RL creates a massive performance gap that widens as $k$ increases. This diverging Pass@k scaling curve is a strong indicator of genuinely new skill acquisition, rather than mere reranking of existing knowledge.

2. Composition as a Generalizable Meta-Skill

The model didn't just memorize specific combinations of functions; it learned the underlying concept of nesting. Models trained only on Level 2 compositions via RL successfully generalized to harder problems, reaching 30% accuracy on Level 3 and 15% on Level 4 (compositions of 3 or 4 functions). In contrast, the SFT baseline remained near 0% for anything beyond Level 2.

3. Zero-Shot Cross-Domain Transfer

Most surprisingly, the compositional logic learned in one domain transferred to an entirely different one. The researchers tested models on a "Countdown" math task (using numbers and basic operators to reach a target). A model that underwent compositional RL only on string functions achieved 35% accuracy on the math task, nearly doubling the base model's 17% performance. The "compositional muscle" built during RL proved to be domain-agnostic, provided the model already knew the target domain's atomic skills.

4. RL as a Behavioral Transformer

Qualitative analysis revealed that RL fundamentally changes the model's reasoning behavior. Before RL, models frequently made "Ignores Composition" errors, failing to process the outer function of a nested command. After RL, these structural errors vanished. For RL models, 55% of failures were merely "Atomic Errors" (minor execution mistakes on a single function) rather than failures in compositional logic.

Limitations and Future Directions

The primary limitation of this study is its reliance on synthetic tasks. While string manipulation provides a clean, uncontaminated environment for scientific analysis, real-world reasoning (like legal analysis or medical diagnosis) involves "fuzzy" skills that are harder to decompose into strict $f(x)$ and $g(x)$ functions.

Furthermore, the authors note a critical prerequisite: for RL to successfully teach composition, the model must possess the atomic skills first. RL acts as a powerful "composer," but it struggles to discover the basic building blocks from scratch. Future work will need to explore how models can be incentivized to learn both the atomic skills and their composition simultaneously without heavy supervised scaffolding.

Summary updated

BibTeX
@inproceedings{yuan2026from,
  author = {Lifan Yuan and Weize Chen and Yuchen Zhang and Ganqu Cui and Hanbin Wang and Ziming You and Ning Ding and Zhiyuan Liu and Maosong Sun and Hao Peng},
  title = {{From f(x) and g(x) to f(g(x)): LLMs Learn New Skills in RL by Composing Old Ones}},
  booktitle = {International Conference on Learning Representations},
  year = {2026},
  url = {https://openreview.net/forum?id=jt7oCtYqHE},
}
Figure