Transformers with RL or SFT Provably Learn Sparse Boolean Functions, But Differently
Abstract
Lay Summary
Large language models often solve difficult tasks by generating intermediate reasoning steps before producing a final answer. Two common ways to improve this behavior are supervised fine-tuning (SFT), which trains the model on labeled reasoning sequences, and reinforcement learning (RL), which trains the model using rewards. This paper studies how these two approaches induce Chain-of-Thought (CoT) reasoning in transformers from a theoretical perspective. We analyze a simplified setting where a one-layer transformer learns sparse Boolean functions, such as parity, through intermediate reasoning steps akin to CoT. Our main finding is that RL with verifiable process rewards and SFT without teacher forcing exhibit different learning dynamics. RL with verifiable process rewards can learn all CoT reasoning steps simultaneously, because the reward for each step is computed from the model’s generated history and therefore provides a valid local training signal for every step along the sampled trajectory. In contrast, SFT without teacher forcing learns the CoT chain step by step: later steps become reliably learnable only after the model has learned to generate earlier steps correctly. We also show that RL with only final-answer rewards can be hard, while SFT with teacher forcing can recover simultaneous learning. These results suggest that comparisons between RL and SFT should account not only for the training algorithm, but also for reward design and the use of teacher forcing.