PANDUAN AI Bahasa

Inferensi dan Keterikatan Bahasa Alami

Natural language inference (NLI), also called recognizing textual entailment, is the task of deciding whether one sentence, the premise, makes another, the hypothesis, true (entailment), false (contradiction) or neither (neutral).

Dengarkan panduan iniDiceritakan oleh AI · ~7 min

Di halaman ini8 menit baca
  1. Ikhtisar
  2. Poin-poin utama
  3. Menyelam Lebih Dalam
  4. Check a summary sentence against its source with NLI
  5. Implementasi Dunia Nyata
  6. Masa Depan Inferensi dan Keterikatan Bahasa Alami
  7. Mempraktikkannya
  8. Sumber dan bacaan lebih lanjut
  9. Terus Menjelajah
  10. Pertanyaan yang sering diajukan

Ikhtisar

It matters because it is a standard test of language understanding and a working tool for zero-shot classification and for checking whether generated text is supported by its source.

Poin-poin utama

  1. Natural language inference labels a premise and hypothesis pair as entailment, contradiction or neutral, based on what a reasonable reader would infer.
  2. SNLI (2015) has 570,000 labeled pairs and MultiNLI (2017) has 433,000 pairs drawn from ten genres of English.
  3. A classifier that sees only the hypothesis gets about 67% of SNLI right, showing that crowd-written data contains exploitable artifacts.
  4. Any trained NLI model can act as a zero-shot classifier by turning each candidate label into a hypothesis and scoring entailment.
  5. NLI-based checkers flag unsupported summary sentences, and SummaC reached 74.4% balanced accuracy by aggregating sentence-level scores across a document.

Menyelam Lebih Dalam

Natural language inference asks a question people answer constantly without noticing: if this sentence is true, what follows? A system receives two pieces of text. The premise is taken as true, for example "A man is playing a guitar on stage." The hypothesis is a claim to evaluate, such as "A man is performing music." The system outputs one of three labels. Entailment means a typical reader would conclude the hypothesis is true given the premise. Contradiction means the hypothesis must be false, as with "The man is asleep in bed." Neutral means the premise does not settle it, as with "The man is a famous musician." The judgment is about what a reasonable person would infer, not strict formal logic.

Modern NLI systems are text classifiers built on pretrained Transformer language models. The premise and hypothesis are joined into one input with a separator token between them, so every word of the hypothesis can attend to every word of the premise. A small classification layer on top of the model's output produces three scores, which a softmax function turns into probabilities for entailment, neutral and contradiction. The model is fine-tuned, meaning further trained, on hundreds of thousands of labeled pairs until its predictions match the human labels.

The task is older than neural networks. Early Recognizing Textual Entailment (RTE) challenges used small test sets, which limited learning-based approaches. That changed in August 2015, when Samuel Bowman and colleagues released the Stanford Natural Language Inference corpus (SNLI) with 570,000 human-labeled sentence pairs, about two orders of magnitude larger than earlier resources of its kind. SNLI premises are image captions, and crowd workers wrote a hypothesis for each label. In 2017 Adina Williams, Nikita Nangia and Bowman released MultiNLI with 433,000 examples from ten genres of written and spoken English, published at NAACL 2018. MultiNLI became a standard training set for general-purpose NLI models.

High scores soon turned out to hide shortcuts. In 2018 Suchin Gururangan and colleagues showed that a classifier that never sees the premise, only the hypothesis, labels about 67% of SNLI and 53% of MultiNLI correctly, against a chance rate of about 33%. Crowd workers left annotation artifacts: negation words, for example, correlate strongly with contradiction. In 2019 Tom McCoy, Ellie Pavlick and Tal Linzen built HANS, a test set where three tempting heuristics fail: assuming entailment when the hypothesis reuses the premise's words, when it is a contiguous piece of the premise, or when it is a complete subtree of the premise's parse. Models trained on MultiNLI, including BERT, did very poorly on it. Adversarial NLI (ANLI), released by Yixin Nie and colleagues in 2019, answered by having people write examples specifically to fool strong models in a human-and-model-in-the-loop process, producing a harder test set.

NLI is now used more as a tool than a leaderboard. Wenpeng Yin, Jamaal Hay and Dan Roth showed in 2019 that a trained NLI model can act as a zero-shot classifier: treat the text as the premise, write each candidate label as a hypothesis, and pick the label with the highest entailment score. The bart-large-mnli model on Hugging Face packages exactly this method. A second use is checking generated text. A summary sentence that is entailed by the source is supported; one that is contradicted or neutral may be a hallucination, meaning a statement the source does not back.

Compared with alternatives, NLI-based checks are cheap and transparent. A fine-tuned NLI model is far smaller than a chatbot-scale language model, runs quickly on modest hardware and returns probabilities that can be thresholded and audited. Question-answering-based metrics, which generate questions from a summary and check whether the source answers them the same way, are slower but catch different errors; the TRUE study found the two families complementary. Asking a large language model to judge consistency is flexible but costlier, and its verdicts can vary with the prompt.

The limitations are real. NLI datasets are built at sentence level, while documents spread facts across many sentences; Laban and colleagues identified this granularity mismatch as the reason early NLI-based summary checkers performed poorly, and their SummaC method, which aggregates sentence-pair scores, reached 74.4% balanced accuracy on its six-dataset benchmark. Labels also depend on background assumptions about what a reasonable reader infers, so annotators sometimes disagree. Shortcut learning can reappear in any new domain, and a model trained on captions and fiction may misjudge legal or medical text. A neutral label means only that the premise does not settle the claim; it does not mean the claim is false.

In practice, building with NLI requires a pretrained model already fine-tuned on MultiNLI or a combination of SNLI, MultiNLI and ANLI, which are freely available, plus a validation set from the target domain to set decision thresholds. Fine-tuning a new model takes a single modern GPU and the public datasets. The main ongoing cost is evaluation: checking examples where the model's labels and human judgment differ, and watching for the overlap and negation shortcuts the research literature has documented.

04Contoh yang berhasil

Check a summary sentence against its source with NLI

  1. Load a public NLI model fine-tuned on MultiNLI, such as facebook/bart-large-mnli, with the Hugging Face Transformers library.

  2. Take a source sentence as the premise: "The library will close at 6 p.m. on Friday for staff training."

  3. Score three hypotheses: "The library closes early on Friday.", "The library is open late on Friday." and "The training is mandatory for all staff."

  4. Read the three probabilities for each pair and record the highest label.

  5. Expect entailment for the first, contradiction for the second and neutral for the third, since the premise does not say whether training is mandatory.

  6. Repeat with the premise reworded to share few words with the first hypothesis to see whether the model relies on word overlap.

Apa yang ditunjukkannya

A small table of labels and probabilities showing which claims the source supports, contradicts or leaves open. Check it by labeling the same pairs yourself; disagreements, especially on the reworded premise, show where the model may be using shortcuts rather than meaning.

Implementasi Dunia Nyata

The facebook/bart-large-mnli model on Hugging Face classifies text into labels it was never trained on by turning each label into a hypothesis such as "This example is travel." and scoring entailment.

SummaC, published in 2021, splits a document and its summary into sentences and runs NLI on every pair to flag summaries that state things the source does not support.

The 2022 TRUE study found that large-scale NLI models performed strongly at judging factual consistency across 11 manually annotated datasets drawn from diverse generation tasks.

Researchers use the HANS test set to check whether a model trained on MultiNLI really reasons or just assumes that high word overlap means entailment.

Benchmarks such as SNLI, MultiNLI and Adversarial NLI are used to compare language models, since each item has a clear three-way label that makes scoring simple.

Masa Depan Inferensi dan Keterikatan Bahasa Alami

NLI research since 2019 has shifted from beating benchmarks toward measuring robustness and supporting other tasks. Adversarial collection, as in ANLI, showed that test sets written to fool current models stay hard longer than static ones. In evaluation, NLI models remain a common, inexpensive way to score factual consistency, and the 2022 TRUE study recommended NLI-based and question-answering-based metrics as starting points while noting that they catch different errors. Open problems include document-level inference, where the evidence for a claim is spread across many sentences; graded or disputed labels, where reasonable annotators disagree; and domain shift into specialized fields such as law or medicine, where training data is scarce. Large language models can perform NLI when prompted, which raises a practical question that research has not settled: when a small fine-tuned NLI classifier is preferable for its speed, cost and calibrated probabilities, and when a general model's broader knowledge justifies its cost. For hallucination detection, the consistent finding is that NLI provides useful evidence for human review rather than a final verdict on truth.

Mempraktikkannya

Mengapa itu penting

  • Kecepatan dan skala. Alur kerja bahasa dapat berjalan lebih cepat tanpa mengorbankan konsistensi.
  • Akses dan jangkauan. Ini memperluas akses lintas bahasa dan gaya komunikasi.
  • Keputusan yang lebih jelas. Tim dapat menghabiskan lebih banyak waktu untuk melakukan penilaian sementara otomatisasi menangani pengulangan.

Hati-hati

  • Fakta-fakta yang dihalusinasi dapat secara diam-diam masuk ke dalam laporan, aliran dukungan, atau keluaran penelitian.
  • Sensitivitas yang cepat dapat menimbulkan hasil yang tidak konsisten pada permintaan serupa.
  • Data teks sensitif mungkin terekspos jika kontrol akses lemah.

Langkah selanjutnya

  1. Tentukan format output, nada, dan standar kualitas sebelum peluncuran.
  2. Dasarkan respons dengan sumber tepercaya kapan pun akurasi penting.
  3. Pertahankan pos pemeriksaan tinjauan manusia untuk keluaran berisiko tinggi.
  4. Lacak pola kegagalan dan latih kembali perintah atau alur kerja secara teratur.

Sumber dan bacaan lebih lanjut

  1. arXiv (EMNLP 2015)A large annotated corpus for learning natural language inference
  2. arXiv (NAACL 2018)A Broad-Coverage Challenge Corpus for Sentence Understanding through Inference
  3. arXiv (NAACL 2018)Annotation Artifacts in Natural Language Inference Data
  4. arXiv (ACL 2019)Right for the Wrong Reasons: Diagnosing Syntactic Heuristics in Natural Language Inference
  5. arXiv (ACL 2020)Adversarial NLI: A New Benchmark for Natural Language Understanding
  6. arXiv (EMNLP 2019)Benchmarking Zero-shot Text Classification: Datasets, Evaluation and Entailment Approach
  7. arXiv (TACL)SummaC: Re-Visiting NLI-based Models for Inconsistency Detection in Summarization
  8. arXiv (NAACL 2022)TRUE: Re-evaluating Factual Consistency Evaluation

Terus Menjelajah

Buletin gratis

Dapatkan pengarahan AI harian

Tiga cerita AI terverifikasi setiap pagi hari kerja, ditulis dalam bahasa Inggris sederhana. Gratis selamanya, tanpa iklan.

Satu email setiap hari kerja. Berhenti berlangganan dalam satu klik. Kami tidak pernah menjual atau membagikan alamat Anda.

Uji diri Anda sendiri

Take the Natural Language Inference and Entailment quiz

Umpan balik instan untuk setiap jawaban, dan sertifikat yang dapat dibagikan dengan ID yang dapat diverifikasi setelah Anda lulus kursus.

Mulai kuis

Mendukung pendidikan AI gratis. AI Understanding adalah organisasi nirlaba 501(c)(3) — tanpa iklan, tanpa paywall, selamanya. Berikan sumbangan

Pertanyaan yang sering diajukan

Apa itu Inferensi dan Keterikatan Bahasa Alami?

Natural language inference (NLI), also called recognizing textual entailment, is the task of deciding whether one sentence, the premise, makes another, the hypothesis, true (entailment), false (contradiction) or neither (neutral). It matters because it is a standard test of language understanding and a working tool for zero-shot classification and for checking whether generated text is supported by its source.

Apa tiga label standar dalam inferensi bahasa alami?

NLI mengklasifikasikan pasangan premis-hipotesis sebagai keterikatan, kontradiksi, atau netral.

Di NLI, apa yang dimaksud dengan 'entailment'?

Entailment berarti premis menjamin kebenaran hipotesis.

Mengingat premis 'Seorang pria sedang bermain gitar di atas panggung,' hipotesis manakah yang merupakan kontradiksi?

Jika seorang pria sedang bermain gitar di atas panggung, maka panggung tersebut tidak boleh kosong, sehingga hipotesis tersebut bertentangan dengan premis.

What is an annotation artifact in an NLI dataset?

NLI datasets can contain patterns such as certain words being associated with a label, allowing shortcut prediction that may fail out of domain.

Kumpulan data manakah yang banyak digunakan untuk melatih dan mengevaluasi NLI?

SNLI dan MultiNLI adalah korpora besar berlabel manusia yang dibuat khusus untuk inferensi bahasa alami.