Dot Product
A mathematical operation on two lists of numbers (vectors) that produces a single number, often used to measure similarity.
Imagine you have two shopping lists, each with the same items but different quantities. A dot product is a way to compare these lists numerically. You multiply the quantity of each item on the first list by the quantity of the same item on the second list, and then add up all those products.
For example, if list A is [2 apples, 3 bananas] and list B is [4 apples, 1 banana], the dot product would be (2 * 4) + (3 * 1) = 8 + 3 = 11. A higher number generally means the lists are more similar in their proportions. In AI, these lists are often called vectors, and the dot product helps determine how alike two pieces of text or data are.
The dot product, or scalar product, of two vectors is the sum of the products of their corresponding components. For vectors \(a = [a_1, a_2, ..., a_n]\) and \(b = [b_1, b_2, ..., b_n]\), the dot product is \(a \cdot b = \sum_{i=1}^{n} a_i b_i\). Geometrically, it relates to the cosine of the angle between the vectors and their magnitudes: \(a \cdot b = |a| |b| \cos(\theta)\). This property makes it fundamental for calculating similarity between embeddings, where vectors represent semantic meaning.
OpenAI's 2022 announcement highlights the use of dot products in their embedding models. These models convert text into numerical vectors, and the dot product is a key operation for comparing these vectors to find semantically similar content, powering features like search and recommendations.
- Introducing text and code embeddingsOpenAI · OpenAI News ·
- OpenAI ChatGPT
- OpenAI uses dot products as a core mathematical operation in its embedding models to measure the similarity between text and code representations.
- Cosine Similarity
- Cosine similarity uses the dot product but normalizes it by t
- Cross Product
- The cross product is an operation on two vectors in three-dimensi
- Euclidean Distance
- Euclidean distance measures the straight-line distance betwe
The dot product is a fundamental concept in linear algebra, with its origins in the late 19th century as mathematicians formalized vector calculus and geometry. Source ↗
Use OpenAI's embedding API to get vector representations for two different sentences. Then, calculate the dot product of these two vectors. Try sentences with similar meanings and sentences with different meanings to observe how the dot product value changes, indicating similarity.
The Playbook: reusable how-tos, prompts, configs and tips pulled out of the news.
- PromptRole-play a student struggling with math for AI tutor simulationSimulate a student's math struggles and uncertainty for AI tutor evaluation. · 5 min
- TemplateReusable workflow templates for healthcare teamsTeams can create and share templates for common workflows like documentation or prior authorizations. · 15 min
- TemplateTemplate for building an AI tool tailored to your workA structured approach to defining and building a custom AI tool for specific business needs. · 15 min
- TemplateEvals CSV prompt list for agent skillsA CSV file template for listing prompts used in evaluating agent skills. · 20 min
- HeuristicDouble coding agent task completion with docs linksProviding coding agents with a documentation link significantly increases their task completion rate. · 2 min
Questions people ask
- Why is the dot product important for AI?
- It's crucial for comparing numerical representations (vectors) of data like text. A higher dot product often means the data is more similar in meaning or context.
- How does the dot product relate to similarity?
- When used with normalized vectors (like in cosine similarity), the dot product helps determine the angle between them. A smaller angle, indicated by a dot product closer to 1, means higher similarity.
First seen on Subvolts Jan 25, 2022. Updated Sep 15, 2026. Written by an AI model from the items above and reviewed against them weekly; report an error.

