AI Dictionary of Terms

Semantic Search

A search methodology that retrieves results based on the meaning and intent of a query rather than exact keyword matches, using vector embeddings to capture semantic relationships between concepts.

The Simple Version

Traditional search is like looking for a book by its exact title. If you search “artificial intelligence,” you only find books with those exact words.

Semantic search is like asking a librarian “books about smart machines.” The librarian understands you might want books about AI, robotics, machine learning, or even philosophy of mind — even if those exact words don’t appear in your query. It searches by meaning, not just keywords.

Detailed Explanation

Semantic search works by converting both queries and documents into high-dimensional vector embeddings, then finding documents whose embeddings are most similar to the query embedding.

The Pipeline:

  1. Embedding Generation: Convert documents into vectors using a model like Sentence-BERT or OpenAI embeddings
  2. Indexing: Store vectors in a vector database with efficient similarity search (HNSW, IVF)
  3. Query Embedding: Convert user query into a vector
  4. Similarity Search: Find top-K most similar vectors using cosine similarity or other metrics
  5. Result Ranking: Return documents ranked by semantic similarity

Hybrid Search: Modern systems combine semantic search with traditional keyword search (BM25) to get the best of both worlds:

Key Metrics:

Key Characteristics

Business Context

Semantic search is transforming enterprise information retrieval:

Applications:

ROI Drivers:

Real-World Analogy

A knowledgeable concierge at a hotel. You say “I want to see something beautiful and historic.” The concierge doesn’t search for “beautiful historic” — they understand you might want museums, historic districts, architectural landmarks, or scenic viewpoints. They retrieve options based on meaning.

Code Example

# Semantic search using sentence-transformers and FAISS
from sentence_transformers import SentenceTransformer
import faiss
import numpy as np

# Load embedding model
model = SentenceTransformer('all-MiniLM-L6-v2')

# Documents to search
documents = [
    "The cat sat on the mat",
    "A feline rested on the rug",
    "Dogs are loyal companions",
    "Python is a programming language",
    "Machine learning models learn from data"
]

# Create embeddings
doc_embeddings = model.encode(documents)

# Build FAISS index
dimension = doc_embeddings.shape[1]
index = faiss.IndexFlatL2(dimension)
index.add(doc_embeddings.astype('float32'))

# Search query
query = "kitten sitting on carpet"
query_embedding = model.encode([query])

# Find most similar documents
distances, indices = index.search(query_embedding.astype('float32'), k=3)

print("Query:", query)
print("Top results:")
for idx in indices[0]:
    print(f"  - {documents[idx]}")
# Returns: "The cat sat on the mat", "A feline rested on the rug"
# Even though query used different words ("kitten", "carpet")

Common Misconceptions

Sources & Further Reading