ImageNet classification with deep convolutional neural networks
Alex Krizhevsky, Ilya Sutskever et al.
0
Citations
0
Influential Citations
—
Venue
2025
Year
A rule-based reinforcement learning framework trained on procedurally generated Knights and Knaves logic puzzles to enhance reasoning skills in large language models. It utilizes a modified REINFORCE++ algorithm with a strict format and answer-based reward system, enabling the model to develop advanced reasoning capabilities like reflection and verification, and generalize to challenging math benchmarks like AIME and AMC after training on a small dataset.
Large language models (LLMs) have shown impressive capabilities, but their reasoning abilities often remain brittle and heavily reliant on memorization. The Logic-RL paper tackles this head-on by introducing a rule-based reinforcement learning (RL) framework that trains models to reason from first principles using synthetic logic puzzles. The key insight is that by carefully controlling the training data and reward structure, we can induce genuine reasoning behaviors that generalize far beyond the training distribution. This matters because it offers a path to more robust and transferable reasoning in LLMs without requiring expensive human-annotated data.

The core idea is elegantly simple: use procedurally generated Knights and Knaves (K&K) logic puzzles as training data. In these puzzles, characters are either knights (always truthful) or knaves (always liars), and the task is to deduce each character's nature from their statements. The puzzles are generated using logic templates, allowing precise control over difficulty by varying the number of characters (2-8) and the complexity of logical operations (1-4 Boolean operators). This controllability is crucial for designing curriculum learning strategies and for creating out-of-distribution test sets.

The training uses a modified REINFORCE++ algorithm with a two-component reward system. The format reward enforces a structured output: the model must place its reasoning inside <think></think> tags and the final answer inside <answer></answer> tags. This strict format prevents common failure modes like skipping reasoning or placing answers in wrong tags. The answer reward then checks whether the extracted answer matches the ground truth. The researchers iteratively refined the format rules based on observed hacking behaviors, such as the model placing reasoning inside answer tags or repeating the question to avoid genuine reasoning.


Experiments started with Qwen2.5-7B models. Interestingly, the base and instruct versions showed nearly identical training metrics, though the instruct model had slightly higher test accuracy. The training dataset consisted of fewer than 5,000 synthetic samples, all from 3-7 person puzzles.

The results are striking. After 1,000 RL steps, the model's output length increased from an average of 500 tokens to 2,000 tokens, and it began exhibiting complex behaviors like reflection, verification, and exploration of alternative solutions. These behaviors emerged gradually, not as a sudden "aha moment."


Among RL algorithms, PPO achieved the highest accuracy but was 138% slower than REINFORCE++, which generally outperformed GRPO across most metrics. The analysis of thinking tokens revealed that language mixing significantly harms reasoning, while terms like "wait" and "verify" correlate with improved performance. Interestingly, "recheck" was associated with worse reasoning, likely indicating uncertainty.


The model demonstrated remarkable generalization to "Super OOD" tasks: performance improved by 125% on the AIME dataset and 38% on the AMC dataset. This shows that the reasoning skills learned from logic puzzles transfer to complex mathematical problems.

A direct comparison between RL and supervised fine-tuning (SFT) revealed that SFT relies heavily on memorization, while RL generalizes better. When tested on perturbed versions of the training data, SFT showed higher sensitivity to changes, indicating superficial learning. RL, in contrast, maintained robust performance.

Curriculum learning provided only marginal early benefits that diminished over time, suggesting its practical necessity is questionable. Critically, longer responses did not guarantee better reasoning; the best-performing model actually showed decreasing response length over time, while a model with increasing length showed no improvement.


Logic-RL demonstrates that rule-based RL on synthetic data can be a powerful and scalable approach for instilling genuine reasoning capabilities in LLMs. The framework's ability to generalize to challenging math benchmarks after training on only 5K logic puzzles is particularly impressive and suggests that the reasoning skills learned are fundamental and transferable. The paper also provides valuable practical insights: response length alone is not a reliable metric, language mixing should be penalized, and curriculum learning may not be essential. This work opens the door to more data-efficient and robust methods for improving LLM reasoning, with potential applications in education, automated theorem proving, and any domain requiring logical deduction.
Alex Krizhevsky, Ilya Sutskever et al.
Ashish Vaswani, Noam Shazeer et al.
Douglas M. Bates, Martin Mächler et al.
Diederik P. Kingma, Jimmy Ba