Abstract
Large Language Models (LLMs) often struggle with complex reasoning tasks due to logical drift and hallucinations. This paper introduces CoT-RAG, a framework that combines the structured logic of Chain-of-Thought (CoT) with the factual grounding of Retrieval-Augmented Generation (RAG). CoT-RAG employs expert-defined Decision Trees to generate fine-grained Knowledge Graphs, which then guide a case-aware retrieval process. Reasoning is executed via "Pseudo-Program Prompting," a method that enforces logical rigor without requiring external code execution. Evaluation across 13 datasets demonstrates that CoT-RAG significantly outperforms existing methods, achieving up to 44% higher accuracy and excelling in specialized domains like law and finance.
Introduction: The Reasoning Gap
While Large Language Models (LLMs) have revolutionized natural language processing, they frequently stumble on complex reasoning tasks involving arithmetic, symbolic logic, and domain-specific knowledge. Two primary hurdles remain:
- Low Reliability: Standard CoT reasoning is often a "black box." LLMs can hallucinate intermediate steps, leading to "logical drift" where a single factual error ruins the entire conclusion.
- The Prompting Gap: Research indicates that LLMs reason more accurately when writing code (Program-of-Thought) than when using natural language. However, code is rigid, requires external interpreters, and is difficult for non-programmers to audit or apply to qualitative fields like law.
CoT-RAG aims to bridge this gap by creating a framework that is as rigorous as code but as flexible as natural language, specifically for high-stakes "vertical" domains where errors are unacceptable.
The CoT-RAG Framework
CoT-RAG introduces a three-stage pipeline designed to maximize controllability and logical rigor:
1. Knowledge Graph-driven CoT Generation
Instead of allowing the LLM to generate reasoning steps autonomously, domain experts provide a high-level "Decision Tree" (DT) representing the core logic of a field. The LLM then decomposes this DT into a fine-grained Knowledge Graph (KG). This process transforms a vague reasoning task into a structured map of sub-questions and logical dependencies.
2. Learnable Knowledge Case-aware RAG
When a user submits a query, the system does not simply search for raw text. It utilizes the KG to retrieve specific "sub-cases" and "sub-descriptions." This provides the LLM with relevant, learnable examples for every micro-step of the reasoning process, ensuring each logical link is grounded in factual evidence.
3. Pseudo-Program Prompting (PsePrompting)
The LLM is instructed to execute the reasoning task as if it were a computer program (using a solver() function style). This "Pseudo-Program Prompting" forces the model to follow a strict logical flow and handle variables—such as answers from previous steps—explicitly, without needing an actual Python interpreter.
Experimental Evaluation
The authors evaluated CoT-RAG across 13 diverse datasets to test its generalizability and specialized performance:
- Arithmetic Reasoning: AQuA, GSM8K, MultiArith, and SingleEq.
- Commonsense Reasoning: HotpotQA, CSQA, and SIQA.
- Symbolic Reasoning: Last Letter Concatenation and Coin Flip.
- Vertical Domains: Specialized datasets for Law (LawBench, LegalBench), Finance (CFBenchmark), and general intelligence (AGIEval).
Key Results and Insights
CoT-RAG demonstrated dominant performance across all tested benchmarks:
- Significant Accuracy Gains: On nine public benchmarks, CoT-RAG outperformed state-of-the-art methods such as Manual-CoT and Program-of-Thought, with accuracy improvements ranging from 4.0% to 44.3%.
- Superiority in Complex Tasks: On the notoriously difficult AQuA arithmetic dataset, CoT-RAG achieved 65.7% accuracy, a substantial leap from the 54.3% achieved by Manual-CoT.
- Vertical Domain Excellence: In specialized fields using GPT-4o mini, CoT-RAG achieved an average accuracy of 95.2% across law and finance datasets, significantly higher than standard RAG or CoT variants.
Beyond raw accuracy, the framework offers several qualitative advantages. By allowing experts to define the "coarse" logic once, the system gains domain-specific reliability. Furthermore, the decomposition of complex problems into a graph of entities prevents the "forgetting" or hallucination often seen in long, unstructured CoT responses.
Conclusion and Future Directions
CoT-RAG represents a significant step toward more reliable and interpretable LLM reasoning. By combining the structural benefits of Knowledge Graphs with the logical rigor of pseudo-code, it mitigates the risks of logical drift and hallucination.
Currently, the framework relies on larger proprietary models (like GPT-4o) to effectively "execute" pseudo-code, as smaller models (7B-13B parameters) struggle with the required instruction following. Future work will focus on automating the creation of expert decision trees and optimizing prompting techniques to make CoT-RAG compatible with smaller, open-source models.
Summary updated