Topic
Cosine Similarity & Vector Distance Metrics
6 posts on cosine similarity & vector distance metrics — part of glossary on the n4n AI blog.
Vector distance metrics compared: cosine, dot product, L2
Compare cosine similarity, dot product, and L2 distance for vector search — when each metric works, fails, and how to choose for your retrieval system.
How cosine similarity measures semantic closeness
Learn how cosine similarity measures semantic closeness between embeddings with step-by-step code examples and production considerations.
Dot product vs cosine similarity for embeddings
Dot product vs cosine similarity for embeddings — when to use each, how normalization changes the math, and practical tradeoffs for retrieval and ranking.
Cosine similarity vs Euclidean distance: which to use
A practical comparison of cosine similarity and Euclidean distance for vector embeddings, with code examples and clear guidance on when to use each metric.
Cosine similarity explained with a simple example
A practical guide to cosine similarity with code examples, covering the math, intuition, and common pitfalls engineers encounter when working with embeddings.
Computing cosine similarity in Python step by step
Learn to compute cosine similarity in Python with NumPy, scikit-learn, and pure Python implementations, plus practical tips for production use.
More topics in glossary
- Structured Outputs & JSON Mode19
- AI Agents Fundamentals12
- Hallucination in LLMs11
- Sampling Parameters: Top-p, Top-k & Penalties11
- Context Window & Context Length10
- Fine-Tuning Fundamentals9
- Foundation Models: Base vs Instruct vs Chat9
- Model Families & Naming Conventions: GPT-5, Claude, Gemini 3, Llama 4, Mistral, DeepSeek, Qwen, Grok9
- Grounding & Fact-Checking in AI8
- LLM Benchmarks: MMLU, HumanEval, SWE-bench & GPQA8
- Max Tokens, Stop Sequences & Output Truncation8
- Quantization Formats: GGUF, GPTQ, AWQ & INT4/INT88