Abstract
Comparative reasoning is a process of comparing objects, concepts, or entities to draw conclusions, which constitutes a fundamental cognitive ability. In this paper, we propose a novel framework to pre-train language models for enhancing their abilities of comparative reasoning over texts. While there have been approaches for NLP tasks that require comparative reasoning, they suffer from costly manual data labeling and limited generalizability to different tasks. Our approach introduces a novel method of collecting scalable data for text-based entity comparison, which leverages both structured and unstructured data. Moreover, we present a framework of pre-training language models via three novel objectives on comparative reasoning. Evaluation on downstream tasks including comparative question answering, question generation, and summarization shows that our pre-training framework significantly improves the comparative reasoning abilities of language models, especially under low-resource conditions. This work also releases the first integrated benchmark for comparative reasoning.
Introduction
Large language models (LLMs) have demonstrated remarkable capabilities across various natural language processing (NLP) tasks. However, they often struggle with comparative reasoning—the ability to contrast entities or concepts to derive meaningful conclusions. For instance, while a model may possess factual knowledge about two distinct products, it often fails to synthesize a coherent comparison of specific attributes, such as battery life or performance.
Existing solutions are typically task-specific and rely on expensive, manually annotated datasets. Furthermore, standard pre-training objectives, such as masked language modeling, do not explicitly cultivate the ability to weigh entities against one another. To address these challenges, we introduce +CMP, a novel pre-training framework designed to instill comparative reasoning skills in language models through automated, large-scale data generation and multi-task learning.
Methodology: The +CMP Framework
The +CMP framework consists of a three-step pipeline: collecting comparative data, textualizing it for model consumption, and performing multi-task pre-training.
1. Quintuple Collection
The foundation of our approach is the automated collection of "quintuples" $(e_1, e_2, p, v_1, v_2)$, representing two entities ($e_1, e_2$) that share a property ($p$) with distinct values ($v_1, v_2$). We identify these by cross-referencing structured data from Wikidata with unstructured text from Wikipedia and News corpora (e.g., Gigawords, CC-News). A quintuple is extracted when two similar entities appear within the same paragraph and possess a shared property in the knowledge graph.
2. Quintuple Textualization
To bridge the gap between structured data and natural language, we convert these quintuples into text. We employ templates to generate synthetic Question-Answer (QA) pairs and utilize a data-to-text model to produce concise comparative summaries. This process ensures the model encounters comparison facts in a format consistent with downstream tasks.
3. Multi-task Pre-training
We introduce three novel pre-training objectives to explicitly teach comparison:
- Comparative Answer Generation: Generating an answer based on a question and two supporting documents.
- Comparative QA Pairs Generation: Identifying a comparable property between two documents and generating a corresponding question and answer.
- Comparative Summary Generation: Producing a summary that highlights the similarities and differences between two entities.
These objectives are trained in conjunction with standard text infilling to maintain the model's general linguistic proficiency.
Evaluation and Benchmarking
We evaluated our framework using a newly released integrated benchmark for comparative reasoning. This benchmark includes tasks in Question Answering (subsets of HotpotQA and 2WikiQA), Question Generation (HotpotQG and 2WikiQG), and Summarization (CocoTrip and Diffen, a new dataset of human-authored comparisons).
Key Results
The +CMP framework demonstrated significant performance gains, particularly in data-scarce environments:
- Zero-shot Performance: BART+CMP achieved an average score of 24.15 across all tasks, compared to 10.16 for the vanilla BART baseline. Notably, the F1 score on HotpotQA improved by 82% relative to the baseline.
- Few-shot Performance: With only 100 training examples, BART+CMP outperformed the baseline by an average of 6.17 points.
- Comparison with LLMs: In several zero-shot scenarios, our smaller, specialized models (BART+CMP and T5+CMP) performed competitively with or even outperformed ChatGPT (gpt-3.5-turbo).
Insights and Discussion
Our analysis reveals that multi-tasking across all three comparative objectives is superior to training on any single task, suggesting the acquisition of a generalized "comparison skill." Furthermore, the model's robust performance on entities not seen during pre-training confirms that it learns the underlying logic of comparison rather than merely memorizing facts. We also observed a linear improvement in downstream performance as the volume of pre-training data increased on a logarithmic scale.
Conclusion and Future Work
The +CMP framework effectively enhances the comparative reasoning abilities of language models by leveraging automated data collection and targeted pre-training objectives. While successful, the approach currently faces limitations such as synthetic noise in generated data and the 1,024-token context window of the base models. Future research will focus on improving the fluency of textualized data and extending the framework to models capable of handling longer contexts.
Summary updated