ElemedexA pocket encyclopedia of AI architectures

Glossary (TM) › Language and language models

TM061

Natural language inference (NLI)

Also: recognizing textual entailment, RTE

In Spanish: Inferencia en lenguaje natural (NLI)

The task of classifying premise–hypothesis pairs as entailment, contradiction or neutral, as a speaker would judge them; it is not the same as logical consequence.

In NLI a system is given a premise and a hypothesis and must decide whether the first entails the second, contradicts it, or neither (neutral) (Devlin et al., 2019, p. 4184). Large datasets such as SNLI (570,152 pairs; Bowman et al., 2015) and MultiNLI made it a central testbed for “understanding”: MNLI is part of the GLUE benchmark, and its pairs are also used to train embeddings through contrastive learning (Alammar & Grootendorst, 2024, pp. 296–297).

Tiny example (from the SNLI instructions). Premise: “Two dogs are running through a field.” “There are animals outdoors”: entailment. “Some puppies are running to catch a stick”: neutral. “The pets are sitting on a couch”: contradiction.

Why the difference matters to a logician. NLI “entailment” is not logical consequence. The founding definition is deliberately informal: T entails H if, “typically, a human reading T would infer that H is most likely true”, relying on shared background knowledge (Dagan et al., 2006). This admits defeasible, world-knowledge-laden inferences and leaves out almost all the logical consequences no annotator would think of. The labels are judgments by platform workers (data annotation), not theorems. And contradictions depend on coreference conventions: “A boat sank in the Pacific Ocean” and “A boat sank in the Atlantic Ocean” contradict each other only if they describe the same event; but if one always assumes so, “Ruth Bader Ginsburg was appointed to the US Supreme Court” would contradict “I had a sandwich for lunch today” (Bowman et al., 2015, p. 633). Even Alammar and Grootendorst's textbook example, “He is in the cinema watching Coco” versus “He is watching Frozen at home”, is a contradiction only if the pronoun and the time are the same (2024, p. 296).

Models that score well often learn shortcuts. Trained on MNLI, BERT tends to assume that a premise entails any hypothesis built from its own words, as in “The doctor was paid by the actor” → “The doctor paid the actor” (McCoy et al., 2019, p. 3429); models also fail at monotonicity inferences, especially in downward-entailing contexts (Yanaka et al., 2019). Measuring logical consequence in the strict sense takes other datasets, such as the pairs of propositional formulas of Evans et al. (2018). Against shortcuts, adversarial datasets are written by people trying to make the model fail (ANLI, Nie et al., 2020, pp. 4885–4886).

What about other languages? Almost all of this is in English. XNLI took the dataset to fifteen languages by translating it, and its authors warn that translation misses cultural differences (Conneau et al., 2018, p. 2477). InferES was written directly in European Spanish (Kovatchev & Taulé, 2022); ESPANLI, still being designed, proposes an adversarial dataset for Río de la Plata Spanish (Santelli et al., 2026). And mind the terminology: in machine learning, inference often just means running a model.

Sources

  • Alammar, J., & Grootendorst, M. (2024). Hands-on large language models: Language understanding and generation. O’Reilly Media. §
  • Bowman, S. R., Angeli, G., Potts, C., & Manning, C. D. (2015). A large annotated corpus for learning natural language inference. In L. Màrquez, C. Callison-Burch, & J. Su (Eds.), Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing (pp. 632–642). Association for Computational Linguistics. https://doi.org/10.18653/v1/D15-1075 §
  • Conneau, A., Rinott, R., Lample, G., Williams, A., Bowman, S., Schwenk, H., & Stoyanov, V. (2018). XNLI: Evaluating cross-lingual sentence representations. In E. Riloff, D. Chiang, J. Hockenmaier, & J. Tsujii (Eds.), Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing (pp. 2475–2485). Association for Computational Linguistics. https://doi.org/10.18653/v1/D18-1269 §
  • Dagan, I., Glickman, O., & Magnini, B. (2006). The PASCAL recognising textual entailment challenge. In J. Quiñonero-Candela, I. Dagan, B. Magnini, & F. d’Alché-Buc (Eds.), Machine learning challenges: Evaluating predictive uncertainty, visual object classification, and recognising textual entailment (pp. 177–190). Springer. https://doi.org/10.1007/11736790_9 §
  • Devlin, J., Chang, M.-W., Lee, K., & Toutanova, K. (2019). BERT: Pre-training of deep bidirectional transformers for language understanding. In J. Burstein, C. Doran, & T. Solorio (Eds.), Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers) (pp. 4171–4186). Association for Computational Linguistics. https://doi.org/10.18653/v1/N19-1423 §
  • Evans, R., Saxton, D., Amos, D., Kohli, P., & Grefenstette, E. (2018). Can neural networks understand logical entailment? In 6th International Conference on Learning Representations (ICLR 2018). https://openreview.net/forum?id=SkZxCk-0Z §
  • Kovatchev, V., & Taulé, M. (2022). InferES: A natural language inference corpus for Spanish featuring negation-based contrastive and adversarial examples. In Proceedings of the 29th International Conference on Computational Linguistics (pp. 3873–3884). International Committee on Computational Linguistics. https://aclanthology.org/2022.coling-1.340/ §
  • Liu, Y., Ott, M., Goyal, N., Du, J., Joshi, M., Chen, D., Levy, O., Lewis, M., Zettlemoyer, L., & Stoyanov, V. (2019). RoBERTa: A robustly optimized BERT pretraining approach (arXiv:1907.11692). arXiv. https://doi.org/10.48550/arXiv.1907.11692 §
  • McCoy, R. T., Pavlick, E., & Linzen, T. (2019). Right for the wrong reasons: Diagnosing syntactic heuristics in natural language inference. In A. Korhonen, D. Traum, & L. Màrquez (Eds.), Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics (pp. 3428–3448). Association for Computational Linguistics. https://doi.org/10.18653/v1/P19-1334 §
  • Nie, Y., Williams, A., Dinan, E., Bansal, M., Weston, J., & Kiela, D. (2020). Adversarial NLI: A new benchmark for natural language understanding. In D. Jurafsky, J. Chai, N. Schluter, & J. Tetreault (Eds.), Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics (pp. 4885–4901). Association for Computational Linguistics. https://doi.org/10.18653/v1/2020.acl-main.441 §
  • Santelli, M., Toranzo Calderón, J., Caso, R., & Muntaabski, B. (2026). ESPANLI: Un benchmark adversarial de NLI para el español rioplatense mediante competencias humano–modelo [ESPANLI: An adversarial NLI benchmark for Río de la Plata Spanish via human–model competitions]. In Memorias del Simposio Argentino de Inteligencia Artificial y Ciencia de Datos (ASAID), 55 Jornadas Argentinas de Informática (JAIIO). SADIO. https://55jaiio.sadio.org.ar/wp-content/uploads/2026/07/395.pdf §
  • Yanaka, H., Mineshima, K., Bekki, D., Inui, K., Sekine, S., Abzianidze, L., & Bos, J. (2019). Can neural networks understand monotonicity reasoning? In T. Linzen, G. Chrupała, Y. Belinkov, & D. Hupkes (Eds.), Proceedings of the 2019 ACL Workshop BlackboxNLP: Analyzing and Interpreting Neural Networks for NLP (pp. 31–40). Association for Computational Linguistics. https://doi.org/10.18653/v1/W19-4804 §