Skip to content
AI.info

Natural language processing

Semantics: Meaning, Ambiguity, and Lexical Relations

Analyze lexical meaning, ambiguity, entailment, semantic roles, composition, and the limits of representing meaning from text alone.

By the end you can

Key idea

100% right on the affirmative sentence, 0.0% on its negation

Two sentences differ by one word. A robin is a ___. A robin is not a ___. In 2020 Allyson Ettinger ran BERT over NEG-136-SIMP, a set of matched affirmative and negated statements, as part of a psycholinguistic diagnostic suite. On the affirmative items, both BERT BASE and BERT LARGE assigned the higher probability to the true completion in 100% of items. On the negated items, both assigned it in 0.0% of items. Ettinger states it flatly: “However, in the negative statements (A robin is not a ____), BERT prefers the true completion in 0% of items, assigning the higher probability to the false completion in every case.” The completions did not change when negation was added.

That is the whole problem in one measurement. The two sentences share nearly all their words. Their truth conditions are opposites. The model's ranking of what follows is the same in both. A system that scores proximity will place them close together; a system that has to say whether one supports the other cannot.

Semantic modeling therefore needs more than topical proximity. The product must distinguish relations such as equivalence, entailment, contradiction, answer support, and event participation.

Semantic similarity is one relation among many, not a substitute for truth conditions.

Visual

Meaning appears at several interacting levels

Failures can arise at any layer even when the words are familiar, and each layer in this lesson has a published failure attached to it. Lexical sense: the Most Frequent Sense heuristic reads no context at all and still reaches 64.8 F1 on the ALL concatenation of the unified word-sense evaluation. Compositional structure: the 100% to 0.0% flip Ettinger measured when a single negation was inserted. Reference and entities: the 44,000 pronoun problems of WinoGrande, where systems sit 15 to 35 points under the 94.0% human score. Discourse and context: the entailment pairs of SNLI, two-thirds of which can be labelled without reading the premise sentence at all. World and domain knowledge: a missing comma in a Maine statute, which a federal appeals court had to interpret because the text alone did not settle it.

The layers are not a hierarchy of difficulty. A system can be strong at one and indifferent to another. An aggregate accuracy number mixes them together.

FigureLayers · 5 layers
  1. 01

    Lexical sense

    A wordform selects among related or unrelated meanings.

  2. 02

    Compositional structure

    Syntax combines words, modifiers, quantifiers, and negation.

  3. 03

    Reference and entities

    Expressions point to people, objects, places, times, or abstract concepts.

  4. 04

    Discourse and context

    Earlier sentences establish entities, events, and assumptions.

  5. 05

    World and domain knowledge

    Interpretation relies on facts and conventions not written in the sentence.

Comparison

Semantic relations answer different questions

A score or embedding should not be described generically as “meaning.” Similarity is graded and often symmetric. Entailment is directional and sensitive to quantifiers and negation. Contradiction asks whether two statements can hold in the same interpretation. Relatedness is an associative signal, useful for discovery and weak for substitution.

The distinctions are not academic, because a benchmark built for one of them can be passed by a model that computed another. The two sections that follow are both instances of that: an entailment corpus whose hypotheses leaked their labels, and a sense task whose commonest answer is available without reading the sentence. Naming the relation your product needs is what makes those failures visible.

FigureComparison · 4 columns

Similarity

How alike are two expressions in use or content?

  • Graded relation
  • Often symmetric
  • Can reflect topic or function
  • Does not imply truth

Entailment

If one statement is true, must another follow under the assumed context?

  • Directional relation
  • Sensitive to quantifiers and negation
  • Depends on assumptions
  • Useful for support checks

Contradiction

Can the statements both be true in the same interpretation?

  • Context-dependent
  • Different from mere dissimilarity
  • Scope matters
  • Useful for consistency tests

Relatedness

Are concepts associated even if they are not similar?

  • Doctor–hospital example
  • Broad associative signal
  • Useful for discovery
  • Weak for substitution

Case

570,000 labelled pairs, and two-thirds of them labelled without the premise

Entailment got a resource large enough to train on in 2015. The Stanford Natural Language Inference corpus is around 570,000 human-written English sentence pairs, each labelled entailment, contradiction or neutral; the proceedings paper puts the exact count at 570,152. Bowman and colleagues built it. The pairs were “written by humans doing a novel grounded task based on image captioning”, and that protocol is what made the corpus “two orders of magnitude larger than all other resources of its type”. Similarity scores need no such labels. That is exactly why they cannot be asked to answer this question.

The protocol that produced the scale also produced an artifact. Gururangan and colleagues reported it in 2018: “Specifically, we show that a simple text categorization model can correctly classify the hypothesis alone in about 67% of SNLI (Bowman et. al, 2015) and 53% of MultiNLI (Williams et. al, 2017).” The model in question is fastText, a bag-of-words-and-bigrams classifier that never sees the premise. It scores 67.0% on SNLI, 53.9% on MultiNLI matched and 52.3% mismatched, against majority-class baselines of 34.3%, 35.4% and 35.2%. Poliak and colleagues reached the same conclusion independently that year, running hypothesis-only models over ten NLI datasets and finding that they significantly beat the majority-class baseline on six of the ten.

So a high score on the corpus is not evidence that the relation was computed. Crowdworkers asked to write a contradiction reach for the same devices, and a classifier can learn those devices instead of the inference. The lesson for a product is not that SNLI was badly built. It is that a labelled pair carries the fingerprints of how it was made, and that the cheapest way to find out is to run the task with half the input removed.

Example

Lexical relations with different product consequences

A thesaurus-like expansion needs finer controls than “nearby word.”

These relations have been a queryable database for three decades. WordNet is “an online lexical database designed for use under program control”, as George A. Miller put it in 1995. He stated the design plainly: “English nouns, verbs, adjectives, and adverbs are organized into sets of synonyms, each representing a lexicalized concept”, and “semantic relations link the synonym sets”. His motivation was that “dictionary entries evolved for the convenience of human readers, not for machines”. The unit is the synonym set, not the wordform. That is what makes hypernymy expressible at all — and what makes nearby word the wrong query to send to a lexical resource.

Having the inventory is not the same as choosing correctly within it. In the unified word-sense disambiguation framework published in 2017, the Most Frequent Sense heuristic — which reads no context whatsoever — scores 64.8 F1 on the ALL concatenation, 67.6 on nouns and 49.6 on verbs. The best supervised system trained on SemCor scores 69.6. The framework's own authors diagnose why: “all supervised systems suffer a strong bias towards the MFS, with all IMS-based systems disambiguating over 75% of instances with their MFS”. Blevins and Zettlemoyer reproduced the baselines in 2020 — 65.5 F1 for MFS, 65.2 for the WordNet first sense on ALL — and reported the split that matters. The WordNet-first-sense baseline scores 100.0 on most-frequent-sense instances and 0.0 on less-frequent-sense instances. A product's domain senses live in that 0.0.

  • Synonymy: “purchase” and “buy” can substitute in many contexts, but register and argument patterns may differ — which is why WordNet's unit is the synonym set and not the wordform.
  • Antonymy: “increase” and “decrease” are semantically related while reversing a numeric trend — the same one-word reversal that left BERT's completions unchanged on NEG-136-SIMP.
  • Hypernymy: “vehicle” is broader than “bus,” which enables hierarchy-aware retrieval, and is expressible only because relations are stated between synonym sets rather than between words.
  • Polysemy: “bank” can refer to finance or a river edge. Guessing the commonest sense with no context already reaches 64.8 F1 on ALL, while the first-sense baseline scores 0.0 on every less-frequent-sense instance.
  • Metonymy: “The White House announced” refers to an institution through a location expression, and no entry in a sense inventory is being selected at all.
  • Domain shift: “discharge” changes meaning across medicine, electronics, law, and water management — precisely the setting in which the frequent-sense prior is confidently wrong.

Analogy

For want of a comma, we have this case

In a contract, each term has a local definition, clauses combine those terms, and earlier sections establish references. A single familiar word cannot determine the document's legal effect. A contract supplies its own glossary and states its scope; ordinary language has neither one authoritative glossary nor perfectly explicit scope.

The analogy has been litigated. Maine's overtime exemption, 26 M.R.S.A. §664(3)(F), listed the exempt activities without a serial comma before the final item, leaving it open whether the last two words named one activity or two. The First Circuit found the statute ambiguous, reversed summary judgment for the dairy, and adopted the drivers' reading. That was O'Connor v. Oakhurst Dairy, decided 13 March 2017. The opinion of Barron, Circuit Judge, opens: “For want of a comma, we have this case.” The Maine Legislature then rewrote the list with semicolons, signed 16 June 2017; the current text reads “The canning; processing; preserving; freezing; drying; marketing; storing; packing for shipment; or distributing of”. The amendment was made retroactive to 29 September 1995, but expressly “not to cases pending on March 12, 2017”.

This is a drafted legal text, written by professionals, reviewed, enacted. One coordination ambiguity in one clause took an appeal to resolve and a statute to repair. Lexical lookup, composition, and discourse context must still work together, and when they do not, someone pays for the difference.

Meaning emerges from words in structure and context, not from isolated dictionary entries.

113,000 verb tokens annotated for who did what to whom

An event description can distinguish who performed an action, what changed, what instrument was used, where it occurred, and when. Active and passive sentences may express similar roles through different syntax. The canonical demonstration is a pair of sentences: “John broke the window” and “The window broke”. The window occupies two different syntactic positions and fills the same underlying role in both.

The answer to that was PropBank, a predicate–argument layer added over the Penn Treebank Wall Street Journal text. Palmer and colleagues built it and described it in 2005. The scale is on record: the release Proposition Bank I, dated 1 September 2004, contains approximately 113,000 annotated verb tokens and annotations for over 3,200 unique verbs. So is the boundary of what a role layer buys you. The authors state it themselves in their abstract: “The resulting resource can be thought of as shallow, in that it does not represent coreference, quantification, and many other higher-order phenomena, but also broad, in that it covers every instance of every verb in the corpus and allows representative statistics to be calculated.”

Read that sentence as a specification rather than a caveat. Broad coverage over one text type, with coreference and quantification deliberately out of scope, is a design choice made for a purpose. It is the same choice a product team makes when it decides which participants its workflow actually needs. Define those, then test omitted, implicit, and coordinated arguments against them.

Semantic roles offer an event-centered view that can survive some surface rephrasing.

Key idea

273 hand-built problems, then 44,000, and still 15 to 35 points short

“The trophy did not fit in the suitcase because it was too large” invites a reference resolution based on size knowledge. Different contexts can change the likely referent. Neither token similarity nor syntax alone supplies every fact. Systems may use learned associations, structured knowledge, retrieval, or human clarification; a confident answer should not hide that the evidence was incomplete.

That sentence pattern is a published test rather than an anecdote. Levesque and colleagues proposed the Winograd Schema Challenge in 2012. Their definition: “A Winograd schema is a pair of sentences that differ only in one or two words and that contain a referential ambiguity that is resolved in opposite directions in the two sentences”. They compiled it so “that the correct answer is obvious to the human reader, but cannot easily be found using selectional restrictions or statistical techniques over text corpora”. The standing example, as the NYU Winograd schema collection writes it, is “The trophy doesn’t fit into the brown suitcase because it’s too [small/large].” with the answers “The suitcase/the trophy”. Corpus frequency cannot separate the two readings. The two sentences are almost the same string.

The challenge was then scaled. WinoGrande, reported in 2020 by Sakaguchi and colleagues, says what it was for: “To investigate this question, we introduce WinoGrande, a large-scale dataset of 44k problems, inspired by the original WSC design, but adjusted to improve both the scale and the hardness of the dataset.” The original set had 273 expert-crafted problems. The new one has 44,000 crowdsourced problems put through the AfLite debiasing algorithm. The best methods reached 59.4% to 79.1%, roughly 15 to 35 points below the 94.0% human performance — while the same models scored 90.1% on the original WSC273. Removing the statistical shortcuts did not remove the humans' advantage. It exposed how much of the earlier score had been the shortcut.

Some semantic problems require external knowledge or explicit repair, not a larger local context window.

Steps

Build a semantic challenge set the way HANS was built

Use controlled contrasts so that each example tests one meaning operation. There is a worked precedent with published numbers. HANS is a 30,000-example controlled evaluation set: 1,000 examples per template, 10,000 per heuristic, for three heuristics a model might apply instead of computing entailment. McCoy and colleagues published it in 2019.

The result splits cleanly by answer. Models trained on MNLI, BERT included, were near-perfect when the answer was entailment and near-zero when it was non-entailment. The paper states it: “All models performed substantially below chance on this dataset, barely exceeding 0% accuracy in most cases.” Clark and colleagues independently measured BERT at 62.40 on HANS against 84.24 on the MNLI matched dev set.

Notice what that gap is made of. The in-distribution test set reported 84.24 and never showed the problem, because the shortcut and the relation agree on most naturally occurring pairs. The templated contrast set forced them apart. The five steps below are the same construction discipline: vary one thing, keep the rest fixed, and make sure both answers are represented.

FigureProcess · 5 steps
  1. 1. Create lexical substitutions

    Test synonyms, antonyms, hypernyms, senses, and domain terminology.

  2. 2. Vary composition

    Change negation, quantifiers, modality, comparison, and argument roles.

  3. 3. Test directional relations

    Separate similarity, entailment, contradiction, and irrelevance.

  4. 4. Add context dependence

    Include pronouns, earlier definitions, ellipsis, and implicit participants.

  5. 5. Record ambiguity

    Allow multiple defensible readings and define when clarification is required.

Audit a semantic search claim

Take ten query–document pairs labeled “relevant.” For each pair, state whether relevance comes from synonymy, hierarchy, event match, question answer, shared topic, or an external fact.

Then add one hard negative that is topically similar but contradicts or fails to support the query, and measure whether the ranking system preserves the distinction. This is the non-entailment half of HANS in miniature, and it is the half where the reported aggregate number is silent.

Run the Gururangan check as well: score your labels with half the input removed. If a classifier that never sees the document can reproduce your relevance labels at well above the majority-class rate, the labels encode how they were written rather than the relation you meant to test.

A semantic system should be tested against the specific relation its product needs.

Key takeaways