An embedding is a list of numbers that represents the meaning of a piece of text, and cosine similarity is the most common way to measure how close two embeddings are. Search engines and AI assistants use them to find passages that match a question even when the words are different. This is why modern search rewards pages that explain a topic well over pages that repeat a keyword.
What an embedding is
An embedding model reads a word, sentence or passage and outputs a vector: a fixed-length list of numbers. OpenAI’s text-embedding-3-small model, for example, produces vectors with 1,536 numbers, and text-embedding-3-large produces 3,072. Each number on its own means nothing to a person. Together they place the text at a point in a high-dimensional space where texts with similar meanings sit close to each other.
The idea became widely used with word2vec, published by researchers at Google in 2013, which gave each word a single vector. Later models such as BERT, released by Google in 2018, produce contextual embeddings: the same word gets a different vector depending on the sentence around it. “Bank” in “river bank” and “bank loan” ends up in different places. Google began using BERT in Search in 2019.
What cosine similarity measures
Cosine similarity compares the direction of two vectors and ignores their length. It is the dot product of the two vectors divided by the product of their lengths, and the result falls between -1 and 1. A score near 1 means the texts point the same way in meaning; a score near 0 means they are unrelated.
| Query | Passage | Likely similarity |
|---|---|---|
| How do I cut cloud hosting costs? | Five ways to reduce your AWS bill | High, despite sharing almost no words |
| How do I cut cloud hosting costs? | Cloud hosting company history and founders | Lower, despite sharing the words “cloud hosting” |
The exact scores depend on the model. The pattern is what matters: meaning counts more than shared words.
How search systems use embeddings
A retrieval system converts every stored passage into an embedding ahead of time. When a question arrives, it converts the question too, then looks for the passages whose vectors are closest. Comparing against millions of passages exactly would be too slow, so systems use approximate nearest neighbour search with index structures such as HNSW (hierarchical navigable small world graphs), which trade a little accuracy for a large gain in speed.
Most production systems combine this with keyword matching such as BM25. Keywords catch exact product names, codes and numbers that embeddings can blur; embeddings catch meaning that keywords miss. The approach is called hybrid retrieval, and it is covered in more detail in the guide to retrieval-augmented generation.
What it means for your content
Explain the concept, then use the words people use
An embedding captures what a passage is about. A passage that clearly explains a topic will match many phrasings of a question about it. Include the common terms buyers use as well, because keyword matching still runs alongside.
One topic per section
A section that covers pricing, setup and troubleshooting in one block produces an embedding that sits between all three and matches none of them strongly. Separate sections produce separate, sharper embeddings.
Keyword repetition does little
Repeating a phrase moves an embedding only slightly. The 2023 GEO research paper found that keyword stuffing did not improve visibility in AI answers, while adding statistics, quotations and sources did.
Exact terms still matter for names and numbers
Product names, model numbers, prices and technical identifiers should appear exactly as people search for them. This is where keyword matching carries the weight.
Frequently asked questions
Is semantic search the same as vector search?
The terms are often used interchangeably. Semantic search describes the goal, matching meaning. Vector search describes the usual method, comparing embeddings.
Can I see how my page is embedded?
Not in Google or ChatGPT. You can run your own passages and test questions through a public embedding model to compare scores, which is useful for spotting sections that mix too many topics, but the result will not match any search engine exactly.
Do embeddings replace keywords in SEO?
No. They change what keyword work is for. Keywords now mainly help with exact names and with understanding what people ask, while the page itself has to explain the topic.