---
language: en
title: "Cosine similarity"
description: "Cosine similarity compares vectors by direction. Learn about its role in semantic search and why a score does not prove relevance or truth."
canonical: "https://tropk.ai/en/resources/glossary/cosine-similarity"
last_modified: "2026-10-12T16:13:09.460Z"
---

# Cosine similarity

Reviewed on 2026-10-06.

## What it means

Cosine similarity is a measure that compares the direction of two vectors by dividing their dot product by the product of their norms. In [semantic search](/en/resources/glossary/semantic-search), it can compare the embedding of a query with those of passages. The result expresses proximity in this numerical representation, without directly assessing whether a statement is true, current, or suitable for the user.

## Why it matters for marketing

For marketing, this measure helps explain why a search retrieves text with different wording from the query. It also prevents interpreting a high score as proof of editorial quality. When evaluating a content database, the team needs to distinguish topical proximity from meeting the user's intent, especially when pages about the same product describe different commercial terms.

## Example in practice

In a hypothetical test, a store queries its database about exchanging used sneakers. The general policy receives a cosine similarity score of 0.87, while the specific rule for used products receives 0.79. The team reviews the passages and realizes that the first does not address the condition in the query. It decides to include this question in the relevance evaluation before approving the retriever.

## How to apply or verify

Ask the person responsible for search for the embedding model, comparison function, and passages associated with the scores. Compare representative queries with passages judged relevant by people. Keep the same model and processing during the comparison. In the implementation, confirm how vectors with no magnitude are handled and whether the system returns similarity or a distance derived from it.

## Important distinctions

Cosine similarity and cosine distance are not the same quantity: a common transformation calculates distance as one minus similarity. The values do not represent probabilities of success or percentages of users. With vectors normalized by the L2 norm, the calculation is equivalent to the dot product; without this condition, switching functions can change the ranking.

## Sources and references

- [cosine\_similarity — scikit-learn 1.9.1 documentation](<https://scikit-learn.org/stable/modules/generated/sklearn.metrics.pairwise.cosine_similarity.html>) — scikit-learn
- [Retrieve & Re-Rank — Sentence Transformers documentation](<https://www.sbert.net/examples/sentence_transformer/applications/retrieve_rerank/README.html>) — Sentence Transformers

## Continue a leitura

- [Bi-encoder](</en/resources/glossary/bi-encoder>)
- [Semantic search](</en/resources/glossary/semantic-search>)
- [Embeddings](</en/resources/glossary/embeddings>)

## About the author

[Vinicius Pacheco](</en/team/vinicius-pacheco>)

Responsible for Tropk’s technical content, focusing on crawling, indexing, structured data, and agent access to content.

---

[All pages in Markdown](<https://tropk.ai/sitemap.md>)
