Logical Satisfiability of Counterfactuals for Faithful Explanations in NLI

Suzanna Sia, Anton Belyy, Amjad Almahairi, Madian Khabsa, Luke Zettlemoyer, Lambert Mathias

Abstract

Evaluating an explanation's faithfulness is desired for many reasons such as trust, interpretability and diagnosing the sources of model's errors. In this work, which focuses on the NLI task, we introduce the methodology of Faithfulness-through-Counterfactuals, which first generates a counterfactual hypothesis based on the logical predicates expressed in the explanation, and then evaluates if the model's prediction on the counterfactual is consistent with that expressed logic (i.e. if the new formula is logically satisfiable). In contrast to existing approaches, this does not require any explanations for training a separate verification model. We first validate the efficacy of automatic counterfactual hypothesis generation, leveraging on the few-shot priming paradigm. Next, we show that our proposed metric distinguishes between human-model agreement and disagreement on new counterfactual input. In addition, we conduct a sensitivity analysis to validate that our metric is sensitive to unfaithful explanations.

Introduction: The Challenge of Faithful Explanations

In Natural Language Processing (NLP), models are increasingly expected to provide "explanations" for their predictions. However, these explanations are frequently post-hoc rationalizations—plausible-sounding stories that may not reflect the model's internal reasoning. This discrepancy is known as the problem of faithfulness.

In Natural Language Inference (NLI), where a model determines if a premise entails, contradicts, or is neutral toward a hypothesis, measuring faithfulness is notoriously difficult. Existing metrics often suffer from label leakage or rely on external verifier models that introduce their own biases. To address this, researchers from Johns Hopkins and Meta AI propose Faithfulness-through-Counterfactuals (FTC), a framework that audits explanations using formal logic.

The Faithfulness-through-Counterfactuals (FTC) Framework

The FTC framework operates on a simple intuition: if an explanation truly reflects a model's reasoning, the model should remain consistent across logically similar scenarios. If a model’s explanation relies on a specific logical relationship, we can test it by generating a "counterfactual" hypothesis based on that logic. If the model’s prediction on the new input is inconsistent with its own explanation, the explanation is deemed unfaithful.

Overview of the Faithfulness-through-Counterfactuals (FTC) framework, showing the flow from premise and hypothesis to a logic-based consistency check.

The Four-Step Process

  1. Extract: Identify logical variables ($A$ and $B$) and their relationship from the model's explanation (e.g., "A dog is an animal").
  2. Transform: Use a few-shot primed Large Language Model (LLM) to rewrite the original hypothesis by substituting variable $A$ with $B$, creating a counterfactual hypothesis.
  3. Predict: Feed this counterfactual hypothesis back into the original NLI model.
  4. Verify: Use First-order Free Logic to determine the "correct" label if the explanation's logic holds. If the model predicts a different label, the explanation is unfaithful.
The Counterfactual Rewriting process, detailing how logical spans are extracted and transformed to create a new hypothesis.

Why Free Logic?

Standard logic is binary (True/False), but NLI is ternary (Entailment, Contradiction, Neutral). Free Logic allows for "truth-valueless" statements, which effectively models the "Neutral" label where a statement is not necessarily true or false given the premise.

Experimental Setup and Datasets

The researchers evaluated FTC using two primary datasets:

  • e-SNLI: The Stanford Natural Language Inference dataset augmented with human-written explanations.
  • e-SNLI-VE: A Visual Entailment version where the premise is an image, ensuring the model isn't relying solely on text-overlap heuristics.

To automate the rewriting process, the authors utilized few-shot priming with GPT-Neo (2.7B), finding it more flexible and effective than building a complex semantic parser.

Key Results and Insights

  • High-Quality Rewriting: Automated counterfactual generation achieved METEOR scores between 0.71 and 0.88, indicating that the generated hypotheses were both grammatically sound and logically relevant.
  • Superior Discrimination: FTC variants outperformed existing metrics like Label Adjusted Simulation (LAS) and Label Rationale Association (LRA) in distinguishing between human-model agreement and disagreement on logical consistency.
  • Sensitivity to Pathological Explanations: In sensitivity analyses, FTC successfully detected "bad" explanations (e.g., those missing the premise) as unfaithful, whereas text-similarity metrics like BERTScore were easily misled.
  • Soft Logic Benefits: Using "soft" versions of the metric (e.g., KL-Divergence) to account for model probabilities proved more robust than binary checks, as they could absorb minor errors in the automated rewriting process.

Limitations and Future Work

While FTC provides a robust "lie detector" for NLI models, several challenges remain. The framework is currently tightly coupled to ternary NLI logic and is computationally expensive due to the reliance on LLMs for rewriting. Furthermore, because the process involves discrete text rewriting, it is non-differentiable and cannot yet be used as a loss function for training. Finally, the metric's reliability is partially dependent on the quality of the "gold" human explanations, which can themselves be logically flawed.

By bridging formal logic and deep learning, this work offers a significant step toward verifying the internal consistency of increasingly complex AI systems.

Summary updated

BibTeX
@inproceedings{sia2023logical,
  author = {Suzanna Sia and Anton Belyy and Amjad Almahairi and Madian Khabsa and Luke Zettlemoyer and Lambert Mathias},
  title = {{Logical Satisfiability of Counterfactuals for Faithful Explanations in NLI}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2023},
  url = {https://openreview.net/forum?id=w0_kE7GFPZ},
}
Figure