TL;DR
This paper investigates whether Large Language Models (LLMs) can learn to perform formal logical reasoning by constructing proofs in Boolean logic. The authors introduce a novel framework for generating synthetic proofs and evaluating LLMs, demonstrating that fine-tuning with this data significantly improves reasoning capabilities, though performance degrades with proof complexity.
What Problem Does This Paper Address?
While LLMs excel at natural language tasks, their ability to perform rigorous logical reasoning, crucial for fields like mathematics and computer science, remains a significant challenge. This paper tackles the question of whether LLMs can learn to construct formal proofs, specifically in Boolean logic, a foundational system for more complex logics. The core problems addressed are: (1) the scarcity of real-world formal proofs for training LLMs, and (2) the difficulty of reliably assessing whether an LLM is truly reasoning or merely memorizing or guessing.
Methods
The authors propose a data-driven approach centered on Boolean logic, chosen for its conceptual simplicity and formal tractability.
- Synthetic Proof Generation: They developed an efficient, randomized procedure to generate a large and diverse corpus of valid Boolean logic proofs. This process is based on a backward proof construction mechanism, starting from a random goal and recursively breaking it down.
- Template Transformation: To enhance generalization and prevent rote memorization, they introduced a data augmentation technique called Template Transformation. This method generates syntactically varied proofs that share a common logical structure by applying random substitutions to variables in existing proofs. This encourages LLMs to focus on abstract proof patterns rather than specific tokens.
- Black-Box Evaluation Framework: To assess reasoning ability without relying on internal model states, they designed automated tests that measure generalization across various proof complexities (depth and width).
Datasets
The paper primarily uses synthetically generated datasets for training and evaluation.
- Training Data: A balanced corpus of 9000 synthetically generated Boolean logic proofs with varying depths (7, 10, 13) was used for fine-tuning Llama models.
- Evaluation Data: Separate proof trees were generated for evaluation to prevent data leakage. This dataset included:
- In-distribution samples (depths 7, 10, 13).
- Out-of-distribution samples for generalization testing across nine depths (4-28) and four widths (varying expression complexity).
Key Insights and Ideas
- Formal Logic as a Training Ground: Using formal logic for training and evaluation offers significant advantages, enabling large-scale synthetic data generation and robust, automated validation, which is difficult with natural language proofs.
- Template Transformation is Crucial: This augmentation technique significantly boosts LLM performance, particularly in handling complex expressions (width generalization), suggesting it helps models abstract logical structures.
- Depth vs. Width Generalization: While LLMs show performance degradation with increasing proof depth (complexity), Template Transformation has a more pronounced positive impact on width generalization, highlighting its utility for managing complex logical expressions.
- Model Size Matters, but Data Augmentation Helps: Larger models (8B parameters) generally outperform smaller ones (1B), but Template Transformation can help smaller models achieve comparable performance on wider expressions, indicating its effectiveness in compensating for capacity limitations.
- Boolean Logic as a "C.elegans" for Reasoning: Focusing on Boolean logic is a strategic choice, as difficulties here likely indicate limitations in more complex reasoning tasks.
Key Results
- Fine-tuned Llama-8B models achieved 98% accuracy on depth-7 proofs, significantly outperforming GPT-40's few-shot performance (67%±8).
- Performance degrades with increasing proof depth, but larger models (8B) show better resilience.
- Template Transformation significantly improved accuracy, especially for wider expressions, with an optimal probability of around 0.7.
- The 1B model, while showing improvement, lagged behind the 8B model, suggesting that logical reasoning capabilities scale with model size.
Limitations and Future Work
- Performance Degradation with Complexity: A key limitation is the sharp drop in accuracy with increasing proof depth, which the authors attribute to the inherent co-NP hardness of the Boolean reasoning problem and current LLM limitations in handling out-of-distribution depth instances.
- General Reasoning Gap: The current work focuses on Boolean logic. Future work needs to address the broader spectrum of human reasoning, which involves diverse formal frameworks (first-order logic, temporal logic, modal logic) and commonsense knowledge.
- Synthetic Data Limitations: While synthetic data is crucial for training and evaluation, it may not fully capture the nuances of real-world reasoning problems.
- Need for New Approaches: The authors emphasize the need for fresh approaches to tackle the general reasoning question, suggesting that current LLM architectures may have inherent limitations in maintaining reasoning performance for complex or out-of-distribution instances.
Summary updated