Vector similarity measures geometric proximity. Relevance means a document is useful for a particular query. A nearby vector need not represent a useful or reliable document.
| Method | Mechanism and limitation |
|---|---|
| BM25 (Best Match 25) | Term matching, frequency saturation and length normalization. Each additional occurrence adds less score. b = 0 disables length normalization. |
| Bi-encoder | Encodes queries and documents separately; document vectors can be precomputed. |
| ANN / HNSW (Hierarchical Navigable Small World) | ANN (approximate nearest neighbours) is approximate nearest-neighbor search; HNSW uses a vector graph. It can miss some exact neighbors. |
| Cross-encoder | Processes a query–document pair jointly, so it usually reranks a short candidate list. |
In HNSW, higher search ef usually improves recall at a latency cost. Higher M increases graph connectivity and index memory. These control different things: traversal of an existing index and the index structure.
BM25 and cosine scores use different scales. A plain sum can give one retriever disproportionate influence. RRF (Reciprocal Rank Fusion) combines ranks: score = Σ1/(c + rank).
A document at ranks 2 and 4 with c = 8 gets 1/10 + 1/12 ≈ 0.1833. Calculate the two contributions separately; do not add ranks inside one denominator.
HyDE (Hypothetical Document Embeddings) creates a hypothetical document and retrieves using its embedding. An incorrect assumption can steer retrieval toward the wrong topic. Measure its benefit against the original query on the same labeled set.
| Count | Meaning |
|---|---|
| TP (True Positives) | Correctly predicted positive cases. |
| FP (False Positives) | Cases incorrectly predicted positive. |
| FN (False Negatives) | Missed positive cases. |
With TP = 6, FP = 2 and FN = 4:
Macro-F1 averages per-class F1 with equal weight. Micro-F1 sums TP/FP/FN across classes first, then calculates F1. Macro-F1 is not the F1 of averaged precision and recall.
| Metric | What it checks |
|---|---|
| ANN recall@k | Overlap with the k exact neighbors. It does not establish relevance to users. |
| MRR (Mean Reciprocal Rank) | Mean 1/rank of the first relevant result; an absent result contributes 0. For ranks 2 and 4: (1/2 + 1/4)/2 = 0.375. |
| NDCG (Normalized Discounted Cumulative Gain) | DCG (Discounted Cumulative Gain)/IDCG (Ideal Discounted Cumulative Gain): ranking quality using relevance and position, relative to the ideal ordering. 3/4 gives 0.75. |
| Calibration | Agreement between probabilities and event frequencies. If predictions of 0.7 occur only 40% of the time, confidence in that range is too high. |
| Algorithm | Selection rule | Condition |
|---|---|---|
| BFS (Breadth-First Search) | Next layer by edge count. | Fewest actions; lowest cost only when edges have equal positive cost. |
| Dijkstra | Lowest accumulated cost g. | Nonnegative edge costs. |
| A* | Lowest f = g + h; h estimates the remaining path. | Guarantees depend on the heuristic and handling of repeated states. |
S→G costs 10, while S→A→G costs 2 + 2 = 4. BFS favors one edge; cost-based search favors the two cheaper edges.
A plan is valid relative to its world model. Actual state, action availability and permissions must be checked before execution.