AI5 min read10 interview questions
Embeddings: turning meaning into numbers
How computers tell that two sentences mean the same thing.
In one sentenceAn embedding is a list of numbers that places a piece of text on a map, where similar meanings sit close together.
Think of it like thisIt is like giving every place a map coordinate: cities near each other have similar numbers, and so do texts about similar ideas.
The big picture
Tap any step to see where to use it, how to use it and an example result.
Why it is useful
A normal search matches words. Embeddings match meaning, so a search for "cheap flights" can find a page about "budget airlines" even if the words differ.
How closeness is measured
Each embedding is a point in space. The angle or distance between two points tells how related they are. Vector databases and extensions such as pgvector store embeddings and find the nearest ones quickly.
Limits
Embeddings capture general meaning, not exact facts like part numbers or names. Many systems combine them with normal keyword search for better results.
Common mistakes
- Mixing embeddings from different models. Only compare numbers made by the same model.
- Expecting exact matches for codes or names.
- Embedding huge chunks of text where the main idea is lost.
Quick recap
- Embeddings turn text into numbers
- Similar meaning means close numbers
- They power search by meaning
- Combine with keyword search for exact terms
Try it yourself
Use any free embedding model to embed five short sentences, then print which pairs are closest.
Top 10 interview questions
Ordered from basic to advanced. Try answering out loud first, then open the answer.
What is an embedding?Basic
A list of numbers that represents the meaning of a piece of text (or an image), so that similar meanings get similar numbers.
Why are embeddings useful?Basic
They let computers compare meaning rather than exact words, for search, recommendations, grouping similar items and finding duplicates.
How are embeddings created?Basic
By passing text through an embedding model, which returns a fixed-length vector, for example a few hundred or a few thousand numbers.
What is semantic search?Basic
Searching by meaning. The question and the documents are turned into embeddings, and the closest ones are returned, even when they share no words.
How do you measure how similar two embeddings are?Intermediate
Most often with cosine similarity, which compares the direction of two vectors. Dot product and Euclidean distance are also used.
How is semantic search different from keyword search?Intermediate
Keyword search matches the exact words. Semantic search matches meaning, so "car" can find "automobile", but it can miss exact names or codes, so many systems combine both.
Can you mix embeddings from different models?Intermediate
No. Each model has its own space, so vectors from different models cannot be compared. Use the same model for documents and queries, and re-embed everything if you change models.
What are dimensions in an embedding?Intermediate
The number of values in the vector. More dimensions can hold more nuance but cost more storage and time to search.
What is approximate nearest neighbour search and why is it used?Advanced
Comparing a query with millions of vectors one by one is slow. Approximate methods such as HNSW or IVF find very close matches much faster, accepting a tiny chance of missing the exact best.
What limits do embeddings have?Advanced
They can miss exact terms, numbers and negation, reflect biases in the training data, and go out of date. They need good chunking and often a reranker or keyword search alongside.
Guides are simplified on purpose. Tool names and details change, so check the official documentation before relying on a detail.