Abstract: The growing excitement around the ability of large language models (LLMs) to tackle various tasks has been tempered by their propensity for generating unsubstantiated information (hallucination) and by their inability to effectively handle inconsistent inputs. To detect such issues, we propose the novel task of Query-Conditioned Natural Language Inference (QC-NLI), where the goal is to determine the semantic relationship (e.g. entailment or not entailment) between two documents conditioned on a query; we demonstrate that many common tasks regarding inconsistency detection can be formulated as QC-NLI problems. We focus on three applications in particular: fact verification, intrinsic hallucination detection, and document inconsistency detection. We convert existing datasets for these tasks into the QC-NLI format, and manual annotation confirms their high quality. Finally, we employ zero- and few-shot prompting methods to solve the QC-NLI prediction problem for each task, showing the critical importance of conditioning on the query.
Introduction: Beyond All-or-Nothing Comparisons
Traditional Natural Language Inference (NLI) is a cornerstone of NLP, used to determine if a "premise" entails, contradicts, or is neutral toward a "hypothesis." However, standard NLI is often too rigid for real-world applications like Retrieval-Augmented Generation (RAG).
Consider a scenario where a premise states "Jack is working in the park," and a hypothesis states "Jack is sleeping in the park." Standard NLI would label this a contradiction. However, if the user query is simply "Where is Jack?", both documents agree on the location. In that specific context, the relationship is one of entailment. Current models struggle with this nuance, often flagging entire documents as inconsistent due to minor, irrelevant discrepancies. The authors address this gap by proposing QC-NLI, where the semantic relationship is determined strictly through the lens of a specific question or aspect.
The QC-NLI Framework
The authors formalize QC-NLI as a triplet: a premise document ($d_p$), a hypothesis document ($d_h$), and a query ($q$). The goal is to predict a label, typically entailment or not_entailment. To solve this, three primary prompting strategies were evaluated using state-of-the-art LLMs like GPT-4o and Gemini 1.5 Pro:
- Zero-shot prompting: The model receives the documents and query and predicts the label directly.
- Few-shot prompting: The model is provided with a few labeled examples to establish the pattern.
- QA + NLI prompting: A "cascaded" approach where the model first answers the query for both documents independently, then performs NLI on those two concise answers.
Benchmark Datasets
To establish a robust benchmark, the researchers adapted four existing datasets into the QC-NLI format, totaling 21,655 examples. These datasets cover a range of critical NLP tasks:
- SNLI (Image Descriptions): Adapted from the classic Stanford Natural Language Inference corpus.
- RobustQA: Used for inconsistent document detection in RAG settings.
- RAGTruth: Focused on detecting "intrinsic hallucinations" (where an LLM generates info not supported by its input).
- FactScore: Used for fact verification against Wikipedia.
Partial validation by human annotators was conducted to ensure high-quality ground truth labels across these diverse tasks.
Key Insights and Results
The study's findings highlight several critical aspects of contextual reasoning in LLMs:
- The Query as a Semantic Filter: The most significant finding is that the query acts as a critical filter. In ablation studies where the query was removed, model performance plummeted. For instance, on the SNLI-based dataset, average accuracy dropped from ~69% to ~54%. This proves that "global" document similarity is a poor proxy for "contextual" agreement.
- Cascaded vs. End-to-End: While the "QA + NLI" approach seems logical for reducing noise, it often underperformed compared to direct few-shot prompting. This suggests that LLMs are more effective at weighing the entire context holistically than performing a two-step extraction-then-comparison.
- The Performance Ceiling: Human annotation revealed a "quality ceiling" for these datasets (e.g., 84% for FactScore). Top-tier models like Gemini 1.5 Pro are currently hitting 82.63% on FactScore, suggesting they are approaching the limits of the dataset's clarity but still have room to improve on complex reasoning.
Conclusion and Future Directions
QC-NLI provides a vital new yardstick for making RAG systems more reliable and less prone to the "noise" of irrelevant document contradictions. While current results are promising, the authors identify several areas for future work, including addressing potential "LLM bias" in dataset generation, expanding the benchmark beyond English, and developing "segment-level" annotations to pinpoint exact sentences causing contradictions. Future research may also explore "conditional neural architectures" specifically designed for this three-way interaction rather than relying solely on prompting.
Summary updated