English

Transformers with RL or SFT Provably Learn Sparse Boolean Functions, But Differently

Machine Learning 2026-05-27 v2 Machine Learning

Abstract

Transformers can acquire Chain-of-Thought (CoT) capabilities to solve complex reasoning tasks through fine-tuning. Reinforcement learning (RL) and supervised fine-tuning (SFT) are two primary approaches to this end. In this work, we specifically examine RL with process rewards and SFT for learning kk-sparse Boolean functions with a one-layer transformer through intermediate reasoning steps akin to CoT. In particular, we consider kk-sparse Boolean functions that can be recursively decomposed into fixed 2-sparse Boolean functions. We first analyze the learning dynamics of RL fine-tuning with process reward and SFT in a unified way. This allows us to identify sufficient conditions under which the transformer provably learns these sparse Boolean functions. We then verify that these conditions hold for three basic examples, including kk-PARITY, kk-AND, and kk-OR, thus demonstrating their learnability via both RL and SFT. Notably, we reveal that RL and SFT exhibit distinct learning behaviors: RL learns the whole CoT chain simultaneously, whereas SFT naturally learns the CoT chain step by step. Overall, our findings provide insights on the mechanisms underlying RL and SFT and how they differ in triggering the CoT capabilities of transformers, and suggest that the comparison between RL and SFT may need to consider the reward design and the use of teacher forcing.

Keywords

Cite

@article{arxiv.2511.17852,
  title  = {Transformers with RL or SFT Provably Learn Sparse Boolean Functions, But Differently},
  author = {Bochen Lyu and Yiyang Jia and Xiaohao Cai and Zhanxing Zhu},
  journal= {arXiv preprint arXiv:2511.17852},
  year   = {2026}
}

Comments

50 pages, 12 figures

R2 v1 2026-07-01T07:49:52.607Z