TL;DR
Standard reinforcement learning for LLMs often struggles with complex reasoning tasks due to sparse, outcome-based rewards that fail to incentivize genuine exploration. This paper introduces IMAGINE, a framework that provides dense, sequence-level intrinsic rewards exclusively to incorrect trajectories. By integrating these exploration bonuses after advantage computation, IMAGINE significantly boosts reasoning performance—achieving a 22.23% improvement on the challenging AIME 2024 benchmark—with negligible training overhead and zero inference cost.
What Problem Does This Paper Address?
When training Large Language Models (LLMs) on reasoning tasks using Reinforcement Learning (RL) algorithms like PPO or GRPO, models typically receive a sparse reward based solely on the final answer (correct vs. incorrect). On difficult math or logic problems, early training rollouts yield mostly zero rewards, leaving the model to navigate a massive action space without intermediate guidance. Furthermore, standard group-sampling strategies give identical advantage estimates to any trajectory that reaches the same final outcome, effectively penalizing or ignoring alternative, creative reasoning paths.
While traditional RL uses intrinsic motivation (like curiosity or novelty-seeking via Random Network Distillation) to encourage exploration, directly applying token-level novelty to LLMs breaks down. It over-samples short prefixes, introduces a severe bias toward lengthy responses, and incurs massive computational costs because it requires forward passes for every single token.
Methods
The authors propose IMAGINE (Intrinsic MotivAtion Guided exploratIoN for Enhanced reasoning) to make intrinsic motivation compatible with LLM fine-tuning through three core innovations:
- Trajectory-Aware Exploration Rewards: Instead of evaluating novelty token-by-token, IMAGINE uses a sequence-level dual-network design (a frozen random target network and a trainable predictor network). It treats the complete question-response pair $(q, o)$ as a single input, dropping computational complexity from $O(|o|)$ to $O(1)$ per sequence and eliminating token-length bias.
- Error-Conditioned Reward Allocation: To prevent stable, correct trajectories from being disrupted by exploration noise, IMAGINE applies a selection mask. Intrinsic rewards are allocated only to incorrect trajectories, focusing exploration resources where the model is struggling.
- Advantage-Preserving Integration: Instead of mixing exploration rewards into the initial reward stream, IMAGINE injects them after standard advantage computation ($\hat{A}_{new} = \hat{A}_{old} + R^*$). This preserves the statistical integrity of the outcome-based advantages and prevents the sign-inversion issues common in group-relative normalization.
Datasets
The framework was evaluated using Qwen2.5-3B and DeepSeek-7B across four public benchmarks:
- GSM8K: Grade-school math word problems.
- Countdown-34 & Countdown-4: Mathematical puzzles requiring combined operations on given numbers to hit a target. Countdown-4 is significantly harder as it strictly limits inputs to four numbers.
- AIME 2024: High-level mathematics competition problems used to test advanced reasoning capabilities.
Key Insights and Ideas
- Sequence-Level over Token-Level: Token-level curiosity models are fundamentally flawed for LLMs because shorter prefixes are inherently over-sampled (appearing in every rollout), while longer, complex reasoning paths are under-sampled. Sequence-level evaluation fixes this statistical imbalance.
- Explore Only When Wrong: Uniformly rewarding exploration across all samples destabilizes the model when it already knows the right answer. Restricting exploration bonuses to incorrect paths acts as a self-regulating pressure cooker for hard problems.
- Longer CoTs Emerge Naturally: By rewarding novel but incorrect paths, the model learns to generate longer, more complex Chain-of-Thought (CoT) sequences, stabilizing at a higher reasoning depth than vanilla GRPO.
Key Results
- Substantial Reasoning Gains: IMAGINE consistently outperformed vanilla PPO and GRPO. The harder the dataset, the larger the gain. On Countdown-4, IMAGINE improved GRPO accuracy from 38.72% to 47.39% (+22.39% relative improvement). On AIME 2024, it achieved a 22.23% relative improvement in Pass@1 accuracy.
- Increased Trajectory Diversity: Exploration analysis proved that the trajectory loss function converged more slowly with IMAGINE, indicating that the model actively sampled more diverse reasoning paths rather than prematurely collapsing to a single solution.
- Efficiency: Because the predictor networks are lightweight (just three FFN layers) and operate at the sequence level, the added training time is minimal (e.g., 13.03 hours vs 11.69 hours for GRPO on Countdown-4), with zero overhead at inference time.
Limitations and Future Work
The authors note that IMAGINE currently relies on a single type of prediction-error reward function to evaluate trajectory novelty. A promising future direction is incorporating more diverse, multi-faceted reward functions to enable multi-angle exploration, which could help LLMs navigate even larger, more complex action spaces.
Summary updated