Cosine Similarity
Cosine similarity is a mathematical metric that measures the cosine of the angle between two multi-dimensional vectors. In AI knowledge retrieval, a cosine score close to 1.0 indicates high semantic relevance between a user's question and a documentation chunk.
Detailed Explanation
By calculating the dot product of two normalized vectors divided by the product of their magnitudes, cosine similarity isolates conceptual similarity independently of document length. In PostgreSQL pgvector, HNSW indexes compute cosine distance in sub-50ms, allowing real-time retrieval across millions of knowledge chunks.
How It Works in CustomerGPT
CustomerGPT evaluates cosine similarity on incoming customer questions to select only the top-k most relevant knowledge segments before invoking GPT-4o.
Related Glossary Terms
Frequently Asked Questions
Deploy Grounded RAG AI for Your Support
Get started in under 2 minutes with our 14-day free trial.
Start Free Trial →