Toward Structured Knowledge Reasoning: Contrastive Retrieval-Augmented Generation on Experience

Jiawei Gu, Ziting Xian, Yuanzhen Xie, Ye Liu, Enjie Liu, Ruichao Zhong, Mochi Gao, Yunzhi Tan, Bo Hu, Zang Li

Abstract

Large Language Models (LLMs) often struggle with structured data reasoning due to underexposure to tabular formats and brittle retrieval-augmented generation (RAG) processes. We present CoRE (Contrastive Retrieval-Augmented Generation on Experience), a framework that leverages Monte Carlo Tree Search (MCTS) to build an "Experience Memory" of successful and failed reasoning trajectories. By retrieving and contrasting these experiences during inference, CoRE enables LLMs to perform deliberate practice, significantly improving performance on complex Text-to-SQL and TableQA tasks. Evaluation on benchmarks like BIRD and FinQA demonstrates that CoRE particularly excels in challenging scenarios, achieving up to a 17.2% performance jump in complex Text-to-SQL tasks.

1. Introduction

While Large Language Models (LLMs) exhibit remarkable proficiency in processing unstructured natural language, their performance often degrades when faced with structured data, such as SQL databases or complex tables. This "cognitive gap" is primarily driven by two factors: underexposure to rigid tabular relationships during pre-training and the brittleness of standard Retrieval-Augmented Generation (RAG). In many cases, simply providing schema definitions or sub-tables in a prompt lacks the necessary context to guide the model through complex multi-step reasoning.

In contrast to the static retrieval methods used by current LLMs, human experts utilize Deliberate Practice. They do not merely memorize facts; they reflect on past attempts—analyzing both successes and failures—to refine their future strategies. This paper introduces the CoRE framework to bridge this gap by providing LLMs with a similar experience-based reasoning capability.

2. The CoRE Framework

The CoRE framework consists of three primary modules designed to simulate human-like learning and reflection through structured experience.

2.1 Experience Memory Builder

The "data factory" of the system utilizes Monte Carlo Tree Search (MCTS) to decompose complex questions into manageable sub-questions. The algorithm explores various reasoning trajectories and assigns reward labels based on success probability. This process generates a high-density dataset of reasoning paths, categorized into "positive" (successful) and "negative" (failed) examples. For the benchmarks evaluated, this process expanded the original training data by 8–9×.

2.2 Retriever

During inference, when a new query is received, the retriever identifies the most relevant past reasoning trajectories from the Experience Memory. Unlike standard retrievers that focus solely on semantic similarity to the question, this module specifically identifies both successful cases and failed cases that are semantically similar to the current problem, providing a dual-perspective context.

2.3 Contrastive Thinker

The final stage employs a Contrastive Prompting strategy. Instead of a standard instruction, the model is prompted to solve the new case by following the logic of successful experiences while explicitly avoiding the specific pitfalls identified in failed experiences. This contrastive approach helps the model identify subtle logical requirements and transfer successful patterns more effectively than positive-only examples.

3. Experimental Evaluation

CoRE was evaluated on three major benchmarks for structured knowledge reasoning:

  • BIRD: A large-scale Text-to-SQL benchmark featuring 95 databases across 37 domains.
  • WikiTQ (WikiTableQuestions): A dataset requiring comparison, aggregation, and arithmetic over Wikipedia tables.
  • FinQA: A dataset focused on numerical reasoning over financial reports, combining tables with unstructured text.

3.1 Key Results

The framework demonstrated substantial improvements across all benchmarks:

  • Text-to-SQL (BIRD): CoRE achieved an average gain of 3.44% in Execution Accuracy (EX). Most notably, on "Challenging" tasks, performance increased by 17.2%, suggesting that experience-based reasoning is most beneficial when the complexity of the task exceeds the model's zero-shot capabilities.
  • TableQA: Accuracy gains averaged 4.24% on WikiTQ. On FinQA, CoRE improved the "Dater" baseline by 6.6%.
  • Efficiency: Despite the sophisticated backend, inference-time retrieval and prompt construction remain efficient, typically taking under 60ms.

4. Discussion and Insights

4.1 The Power of Failure

A significant finding of this research is that showing a model a "failed" example is only beneficial if it is paired with a "successful" one. Providing negative examples in isolation can actually degrade performance, as the model may inadvertently imitate the errors. The contrastive pairing is essential for the model to understand why a specific path failed.

4.2 MCTS as a Heuristic Teacher

MCTS allows the system to discover "decomposed" knowledge. By breaking hard problems into steps, the model builds a mental representation of the logic required, rather than just memorizing surface-level SQL syntax. This makes the reasoning more robust across different database schemas.

4.3 Limitations and Future Work

The success of CoRE is currently dependent on the "grounding phase"—the initial identification of relevant tables or columns. If the model selects the wrong schema at the outset, the retrieved experience is unlikely to correct the error. Furthermore, while the system is training-free, the Experience Memory must be rebuilt via MCTS when applied to fundamentally new domains. Future work will focus on improving automated grounding mechanisms and exploring more fine-grained experience types to enhance robustness against ambiguous schemas.

5. Conclusion

CoRE represents a shift from simple retrieval to experience-based reasoning for LLMs. By leveraging MCTS to build a memory of both successes and failures, the framework enables models to perform contrastive reasoning that mirrors human deliberate practice. This approach significantly closes the performance gap in complex structured data tasks, particularly in high-difficulty Text-to-SQL and financial reasoning scenarios.

Summary updated

BibTeX
@inproceedings{gu2025toward,
  author = {Jiawei Gu and Ziting Xian and Yuanzhen Xie and Ye Liu and Enjie Liu and Ruichao Zhong and Mochi Gao and Yunzhi Tan and Bo Hu and Zang Li},
  title = {{Toward Structured Knowledge Reasoning: Contrastive Retrieval-Augmented Generation on Experience}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2025},
}
Figure