Back to Glossary Index
Core ConceptSimilarity / Ranking Layer

Cosine Similarity

Industry Definition Set • Entity Resolution Path: /glossary/cosine-similarity

Quick Answer / TL;DR

A metric that measures the cosine of the angle between two vectors, commonly used to compare embedding vectors for semantic similarity.

Key Takeaways

  • Measures directional similarity between vectors.
  • Ranges from -1 to 1; 1 means identical direction.
  • Most common metric for embedding similarity.
  • Ignores vector magnitude, focusing on direction.
Definitive Statement: A metric that measures the cosine of the angle between two vectors, commonly used to compare embedding vectors for semantic similarity.

Technical Context & Protocol Usage

Detailed Explanation
Cosine similarity ranges from -1 (opposite) to 1 (identical), with values close to 1 indicating high similarity. It is the most common similarity metric for dense embeddings because it captures directional similarity regardless of vector magnitude. In MCP RAG systems, cosine similarity is used to rank documents by their relevance to a query embedding.

Format & Payload Metadata

Format: Dot product of normalized vectors

Latency: O(n) per query where n is the number of vectors to compare

Real-World Implementation Use Case

An MCP RAG server computes cosine similarity between a query embedding and document embeddings to rank results by relevance.

M
MCPserver.in Engineering

Platform Team

Published: 2026-07-20
Updated: 2026-07-20

Cite This Page

MLA Style:

MCPserver.in Engineering. "Cosine Similarity." MCPserver.in Knowledge Hub, 20 July 2026, mcpserver.in/glossary/cosine-similarity.