liveBook · Manning

Semantic similarity

Also called semantic textual similarity

Semantic similarity is the degree to which two pieces of content or representations correspond in meaning, regardless of differences in wording or form.

How 8 Manning books explain it

LLM Evaluation and Alignment, The Foundational Ideas

Semantic similarity is the degree to which texts express related meanings despite possible differences in wording.

How it is used
Uses semantic similarity to evaluate generated text against references when valid paraphrases make word overlap misleading.
How deep it goes
Explains contextual embeddings, cosine similarity, word matching, and metric selection, including factual and interpretability limitations.
Examples
Compares foreign-car paraphrases and contrasting sentences, and illustrates contextual meaning with running a company versus running a marathon.
What you can do after
Evaluate or understand generated text by selecting semantic and lexical metrics for the task and inspecting consequential factual errors separately.

Read how LLM Evaluation and Alignment, The Foundational Ideas explains semantic similarity →

Build an Advanced RAG Application (From Scratch)

Semantic similarity is the degree to which two pieces of text express related meaning, typically estimated from their representations.

How it is used
Supports comparing sentence meaning, matching paraphrased cache queries, and assessing retrieval candidates within RAG systems.
How deep it goes
Explains vector comparison and SBERT training architectures, then stops short of prescribing a universal similarity threshold or retrieval policy.
Examples
Uses Uber revenue paraphrases and mixed API-documentation and financial-filing searches to expose matching and false-retrieval behavior.
What you can do after
Evaluate semantic matches while separating meaning similarity from domain-appropriate retrieval.

Read how Build an Advanced RAG Application (From Scratch) explains semantic similarity →

AI-Powered Search

Semantic textual similarity is the task or measure of determining how closely two text segments correspond in meaning.

How it is used
Uses document co-occurrence to discover related terms, expand search queries, rank graph nodes, and generate content-based recommendations.
How deep it goes
Explains distributional reasoning, stop-word effects, document-set comparison, scoring, traversal, and query construction without deriving the full equation.
Examples
Demonstrates health-term discovery from “advil” and topic-based recommendations from a “star wars” document.
What you can do after
Apply it via a knowledge-graph traversal and search API to expand queries and recommend contextually similar documents.

Read how AI-Powered Search explains semantic similarity →

Natural Language Processing in Action, Second Edition

Semantic similarity is the degree to which two language items have similar meanings or contextual associations.

How it is used
Supports semantic search and identifies related or redundant passages when wording differs.
How deep it goes
Explains embeddings, normalization, cosine matrices, heatmaps, and an approximate redundancy threshold, without detailing transformer internals.
Examples
Uses movie-plot retrieval, MiniLM sentence embeddings, pairwise similarity matrices, and a heatmap of manuscript passages.
What you can do after
Apply it via sentence-transformers and cosine similarity to retrieve related text or inspect possible redundancy.

Read how Natural Language Processing in Action, Second Edition explains semantic similarity →

Effective Conversational AI

Semantic similarity is the degree of shared meaning between two pieces of text, typically estimated from their representations.

How it is used
Finds relevant document passages for chatbot questions by comparing meaning rather than exact words.
How deep it goes
Explains vector-space matching and runtime retrieval, but does not specify a similarity formula or threshold.
Examples
Uses indexed document chunks and user questions, then compares generated answers with expected responses.
What you can do after
Evaluate response relevance by scoring semantic similarity and informativeness, comparing generated and expected answers, and reviewing precision, recall, and F1.

Read how Effective Conversational AI explains semantic similarity →

Math and Architectures of Deep Learning

Similarity of meaning between terms or documents, as opposed to exact string overlap.

How it is used
Measures document relatedness through shared topics when explicit term overlap misses meaningful connections.
How deep it goes
Explains semantic similarity through topics, subspaces, variance, and principal components.
Examples
Uses documents d5 and d6, the terms gun and violence, and a toy document-vector dataset.
What you can do after
Evaluate document relatedness through topic-based representations rather than relying only on explicit word overlap.

Read how Math and Architectures of Deep Learning explains semantic similarity →

Building Reliable AI Systems

A measure of how closely the meanings of two pieces of content correspond.

How it is used
Uses similarity to retrieve relevant passages and compare generated claims with grounding data.
How deep it goes
Explains spatial proximity and threshold filtering, but gives no similarity formula or scoring implementation.
Examples
Uses clustered policy documents, an international-roaming FAQ query, and claim comparisons against knowledge-base data.
What you can do after
Evaluate retrieved passages for relevance and compare generated claims with grounding data.

Read how Building Reliable AI Systems explains semantic similarity →

Retrieval Augmented Generation, The Foundational Ideas

Semantic similarity is the degree to which two linguistic items have similar meanings or conceptual content.

How it is used
Supports similarity search and forms a learned foundation for retrieval-augmented generation systems.
How deep it goes
Explains training signals, domain adaptation, and production limitations, but stops short of specifying model architecture or loss functions.
Examples
Contrasts million-document Sentence-BERT indexing with Word2Vec lookup and notes sentence-level context limits.
What you can do after
Apply via Sentence-BERT to perform similarity search while weighing domain, context-length, and indexing constraints.

Read how Retrieval Augmented Generation, The Foundational Ideas explains semantic similarity →

Also covered in

What to know first

Related concepts

Questions about semantic similarity

What is semantic similarity?

Semantic similarity is the degree to which two pieces of content or representations correspond in meaning, regardless of differences in wording or form.

Which Manning books explain semantic similarity?

LLM Evaluation and Alignment, The Foundational Ideas, Build an Advanced RAG Application (From Scratch), AI-Powered Search, Natural Language Processing in Action, Second Edition, Effective Conversational AI, Math and Architectures of Deep Learning, Building Reliable AI Systems and Retrieval Augmented Generation, The Foundational Ideas.

What should I know before learning semantic similarity?

Manning books that teach semantic similarity usually introduce language model, embedding, knowledge base and BERT first.

What is the difference between semantic similarity and word-matching metric?

Semantic similarity is the degree to which two pieces of content or representations correspond in meaning, regardless of differences in wording or form. A word-matching metric evaluates generated text by measuring lexical overlap or other relationships among surface-level tokens, words, or n-grams, often against reference text.

What is semantic similarity also called?

Semantic similarity is also called semantic textual similarity.

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.