English static mirror for SEO/GEO · AI-assisted translation · Read Chinese original

Logic-RL: Unlocking Reasoning Potential in LLMs with Rule-Based Reinforcement Learning

Forum topic · QianXun · 2025-11-17

Summary

Logic-RL is a framework that uses rule-based reinforcement learning to unlock the reasoning potential of large language models. Instead of relying on large annotated datasets or learned reward models, Logic-RL uses clear, verifiable rules that evaluate both the reasoning structure and final answer correctness, mitigating reward hacking. Training uses synthetic Knights & Knaves (K&K) logic puzzles, which offer controllable difficulty (2-8 characters), automatically verifiable unique answers, low cost, and a pure logic environment requiring no external knowledge. The reward function combines a strict format reward (enforcing <think>/<answer> structure) with a binary answer-correctness reward, optimized with REINFORCE++ plus PPO/GRPO-style clipping and KL-divergence penalties for stability. A 7B model trained on only 5,000 logic puzzles improved accuracy by 125% on AIME 2021-2024 and 38% on AMC 2022-2023 relative to its baseline, demonstrating cross-domain generalization. During training, response length grew from roughly 500 to nearly 2,000 tokens, and the model spontaneously developed reflection, verification, and summarization behaviors, indicating transferable general reasoning skills rather than task-specific tricks. Open-source implementations, including Logic-RL-Lite, are available.

Logic-RL: Unlocking Reasoning Potential in LLMs with Rule-Based Reinforcement Learning

This post introduces Logic-RL, a framework that uses rule-based reinforcement learning to release the reasoning potential of large language models (LLMs).

Core Principles and Technical Innovations

Rule-Based RL Framework

Unlike traditional RL that depends on large-scale human annotation or learned reward models, Logic-RL defines "good" behavior through clear, explicit, and verifiable rules. The reward signal directly evaluates whether the model's output follows the prescribed reasoning structure and whether the final answer is correct. This precision and stability help avoid common problems such as reward hacking.

> "In this way, the goal of RL is no longer to simply match a possibly noisy 'golden answer', but to learn a reasoning process that produces correct and well-structured answers."

Three pillars of the framework:

1. System prompt design — carefully crafted prompts require the reasoning process to be placed inside specific tags (e.g., <think>), preventing the model from taking shortcuts (reference). 2. Format reward function — strict penalties for any deviation from the required output format ensure the full reasoning process is shown (arXiv:2502.14768). 3. Stable training method — REINFORCE++-based training keeps learning stable until convergence (arXiv:2505.12929).

The overall pipeline: synthetic K&K puzzles → system prompt with format requirements → <think> reasoning → format reward check → answer correctness verification → policy update via REINFORCE++ → model improvement → emergent advanced reasoning behaviors (reflection, verification, summarization).

Key insight: behaviors like "reflection" and "verification" are not pre-programmed; they emerge spontaneously as strategies for solving problems more effectively, signaling that the model has acquired transferable reasoning skills.

Training Data and Applications

Synthetic Logic Puzzles: Knights & Knaves

Logic-RL trains on classic Knights & Knaves (K&K) logic puzzles, where "knights" always tell the truth and "knaves" always lie. These puzzles are ideal because:

  • Controllable complexity — difficulty scales with the number of characters and dialogue complexity
  • Verifiable answers — unique answers that can be validated automatically by a program
  • Cost-effective — synthetic data is cheap and infinitely generatable
  • Pure environment — focuses purely on logic with no external knowledge required
  • Cross-Domain Generalization: From Logic Puzzles to Math Competitions

  • Training: 5,000 synthetic K&K puzzles with 2–8 characters, structured solutions, pure logical reasoning
  • Testing: AIME 2021–2024 and AMC 2022–2023 competition problems
  • Significant performance gains: a 7B-parameter model trained on only 5K logic puzzles improved accuracy by 125% on AIME 2021–2024 and 38% on AMC 2022–2023 relative to its baseline model (reference).

    > "This cross-domain success strongly demonstrates that Logic-RL cultivates not task-specific 'problem-solving tricks', but a more fundamental, general 'thinking ability'."

    Technical Details and Implementation

    Reward Function Design

    The total reward is a composite: Total Reward = w_format × R_format + w_answer × R_answer

  • Format reward (R_format): checks use of <think> and <answer> tags, verifies reasoning completeness, penalizes malformed output
  • Answer reward (R_answer): exact match against the standard answer, binary correctness judgment, stable and unbiased feedback signal
  • Training Algorithm and Optimization

  • REINFORCE++ — policy-gradient base algorithm with a baseline to reduce gradient-estimation variance (reference)
  • PPO/GRPO — clipped policy updates prevent drastic policy changes (arXiv:2505.12929)
  • KL-divergence penalty — limits divergence from a reference policy to avoid instability or policy collapse
  • Training dynamics: the model spontaneously extends its reasoning length — from about 500 tokens early in training to nearly 2,000 tokens at the end — and this length increase correlates tightly with performance gains (reference).

    Open-Source Resources

  • Official repository with full implementation, datasets, and training scripts (arXiv paper)
  • Logic-RL-Lite — a lightweight reproduction for quick experimentation (GitHub)
Key implementation elements include hyperparameter configuration (learning rate, batch size, epochs), curriculum-style mixed-difficulty training across 2–8 character puzzles, and a complete evaluation pipeline on AIME and AMC benchmarks.

Tags

#reinforcement-learning#llm-reasoning#logic-rl#knights-and-knaves#reinforce-plus-plus#math-benchmarks#reward-design#synthetic-data

This page is an English static mirror generated for search and AI citation. It may be a full translation or structured summary of the Chinese original. Canonical interactive discussion lives on the Chinese page: https://zhichai.net/topic/176313324