First ask: what number did you receive?
A value above 1 does not by itself indicate a broken search. Chroma’s l2 is squared L2 distance and can exceed 1; its cosine distance can range from 0 to 2 for nonzero vectors. Smaller distances mean closer vectors. A cosine similarity, by contrast, ranges from −1 to 1 and increases with alignment.
Do not turn an unexplained score into a percentage or apply 1 − score automatically. Identify the actual return path first. See Chroma’s distance equations and the Cookbook’s return convention.
Trace this chain before touching the cutoff
- Existing collection and versions. Record the Chroma client/server versions and inspect the actual collection configuration. Current docs use
configurationwith an indexspace; older setups may usehnsw:spacemetadata. A new constructor argument does not prove an existing collection uses it. Do not change metadata as a score repair. - Direct API return. Record the exact operation and field, such as
collection.query→distances. Match a result by ID for the same query and embedding path. Keep the raw value before any application transform. - Wrapper and method. Record the import path and package versions, including
langchain-chromaandlangchain-core. Distinguish a raw distance method from a relevance method and any later reranker score. - Transformation. Inspect the implementation installed in your environment, including a custom
relevance_score_fn. Write the actual formula and its assumptions, rather than inferring them from a method name. - Comparison and cutoff. Write the exact inequality and the scale it applies to. Only then evaluate a cutoff on labeled examples from your task.
Collection configuration and query results are documented separately from wrapper behavior. If the metric or transform is unknown, leave the score uninterpreted. If normalization is unknown, do not convert squared L2 to cosine using the unit-vector formula.
A named LangChain example: two different return paths
In the Python langchain_chroma.Chroma source inspected at revision ea17e48f0a4336c920394fd029de99f1568b4c38, similarity_search_with_score pairs documents with Chroma’s raw distances; lower is closer. The inherited similarity_search_with_relevance_scores applies a selected transformation, then keeps scores greater than or equal to its relevance threshold.
The inspected cosine transform is 1 − distance. The selected L2 transform is 1 − distance / √2; this is not the unit-vector squared-L2-to-cosine identity below. A custom override can change the transform. A range warning or negative output is a reason to inspect assumptions, not evidence of a negative probability.
Sources: pinned Chroma integration, pinned core transforms and filtering, and Chroma wrapper reference. This is source inspection, not an installed Chroma/LangChain runtime test. Match your own installed versions before relying on this example.
Same vectors, four different numbers
For nonzero vectors, cosine similarity is (a · b) / (‖a‖ ‖b‖). Ordinary L2 is ‖a − b‖; squared L2 is its square. Only when both vectors have length 1 does squared L2 = 2 − 2 × cosine similarity, so cosine similarity = 1 − squared L2 / 2. For ordinary L2, square the distance first. These identities follow from Google’s unit-vector derivation.
Same unit vector
a = [1, 0]; b = [1, 0]
- Cosine similarity ↑
- 1
- Cosine distance ↓
- 0
- Ordinary L2 ↓
- 0
- Squared L2 ↓
- 0
Unit vectors: cutoff example
a = [1, 0]; b = [0.8, 0.6]
- Cosine similarity ↑
- 0.8
- Cosine distance ↓
- 0.2
- Ordinary L2 ↓
- 0.6325
- Squared L2 ↓
- 0.4
Opposite unit vectors
a = [1, 0]; b = [-1, 0]
- Cosine similarity ↑
- -1
- Cosine distance ↓
- 2
- Ordinary L2 ↓
- 2
- Squared L2 ↓
- 4
Both lengths 2: same angle as cutoff example
a = [2, 0]; b = [1.6, 1.2]
- Cosine similarity ↑
- 0.8
- Cosine distance ↓
- 0.2
- Ordinary L2 ↓
- 1.2649
- Squared L2 ↓
- 1.6
↑ means larger is closer; ↓ means smaller is closer under that measure. These are synthetic vectors, with values rounded to four decimal places. The last pair has the same cosine as the cutoff pair but a different L2 distance: vector lengths matter. Chroma also supports ip, whose distance is 1 − a · b; do not assume it is cosine unless the normalization conditions hold.
The cutoff mistake: reject 0.6, or keep 0.8?
Take the unit vectors [1, 0] and [0.8, 0.6]. Their squared L2 distance is 0.4. Suppose a fictional application intends to keep cosine similarity ≥ 0.75.
- Wrong conversion:
1 − 0.4 = 0.6→ rejects the result. - Correct under the stated unit-length assumption:
1 − 0.4 / 2 = 0.8→ keeps it. - Equivalent raw-distance test: squared L2
≤ 2 × (1 − 0.75) = 0.5→ keeps 0.4.
The value 0.75 is an illustrative cutoff, not a recommendation. Even a mathematically correct 0.8 cosine is not an 80% chance that the document answers the question.
Check the interpretation
Raw cosine distance is 1.2. Is the similarity 120%?
Answer: no. If the field really is cosine distance, cosine similarity is 1 − 1.2 = −0.2. Distance above 1 is possible; it is not confidence.
Squared L2 is 1.6, but vector lengths are unknown. Can you recover cosine?
Answer: not from that distance alone. Leave the conversion undetermined. The length-2 example above has squared L2 1.6 and cosine 0.8; a unit-vector pair with squared L2 1.6 would instead have cosine 0.2.
The wrapper returns −0.1. Should you clamp it to zero?
Answer: first identify the transform and its intended input range. Clamping can conceal a scale mismatch and collapse distinct scores. It does not establish relevance or repair retrieval.
Optional support record
The guide works without a worksheet. Keep a local record of the chain when comparing logs or asking for support; remove document text, private IDs, paths and credentials before sharing it.
Open the score-provenance record to copy into a document
This is a copy-to-document record, with no saved fields or print control. For a paper copy, copy the prompts into your editor and check its print preview; page print layout has not been verified.
- Chroma client/server versions, deployment/index type, and existing collection configuration evidence: ______. See configuration docs.
- Embedding model/version and preprocessing for query and documents; evidence of normalization on both sides, or unknown: ______.
- Exact direct API operation, returned field and raw value for one sanitized matched result: ______. See query-result shapes.
- Wrapper import, package versions, method, returned value and any reranker: ______.
- Installed source link/version, selected transform, custom override and assumptions: ______. Compare the integration and core method.
- Score meaning and range; smaller/larger is closer, or undetermined: ______.
- Exact cutoff inequality and scale; unknown evidence still needed: ______.
- Labeled queries, relevant/irrelevant examples, false accepts, false rejects and held-out evaluation result: ______.
Choose a cutoff using your task
Once the score chain is known, collect representative queries with relevant and irrelevant results labeled for your use case. Include queries with no good answer. Compare false accepts and false rejects at several cutoffs, then check a held-out set. Keep model, preprocessing, collection and retrieval settings attached to those results.
A cutoff only filters candidates that retrieval returned; it cannot recover a relevant item absent from that set. Reevaluate when the model, corpus or pipeline changes. Neither the score nor a top-ranked hit establishes factual correctness of a generated answer.
For magnitude-related large-distance symptoms, see the Chroma FAQ. This page provides documentary guidance and synthetic arithmetic, with AI source inspection. No embedding model, live index, retrieval-quality study or human learning test was run. Reviewed .