Okapi BM25F Field-Weighted Lexical Scoring, HNSW Graph ANN & Reciprocal Rank Fusion
Pure dense vector search misses exact SKU codes, DOI strings, and C++ symbol names, whereas flat bag-of-words TF-IDF ignores structural HTML hierarchy and semantic paraphrases. Fusing pre-saturation BM25F field scoring with HNSW proximity graphs via Reciprocal Rank Fusion solves both failure modes deterministically.
1. Okapi BM25F Pre-Saturation Pseudo-Frequency Across Document Fields
Across structured fields f in {title, h1_h2, anchor, body} with boost weights w_f > 0 and field-specific length-normalization slopes b_f in [0, 1] (typically b_title approx 0.3, b_body approx 0.75), Robertson, Zaragoza & Taylor (2004) and Robertson & Zaragoza (2009) aggregate normalized pseudo-counts prior to single-pass k_1 saturation:
tf_tilde(t, d) = sum_{f} w_f * ( tf_{t,d,f} / (1 - b_f + b_f * (dl_{d,f} / avgdl_f)) )
IDF_RSJ(t) = ln( 1 + (N - df_t + 0.5) / (df_t + 0.5) )
BM25F(Q, d) = sum_{t in Q} IDF_RSJ(t) * ( tf_tilde(t, d) / (k_1 + tf_tilde(t, d)) )2. Hierarchical Navigable Small World (HNSW) Skip-Graph Routing
With level-generation multiplier m_L = 1 / ln(M) (for max degree M, e.g. M = 16, M_max0 = 32), Malkov & Yashunin (2020) bound expected layer count at O(log N) while diversity-pruned neighbor selection preserves navigable long-range bridges across clustered embeddings:
l_node = floor( -ln(Uniform(0, 1)) * m_L ), P(l_node >= l) = exp(-l / m_L) = M^(-l)
// Greedy 1-NN descent on layers L_max .. 1, followed by efSearch beam search on layer 03. Scale-Free Reciprocal Rank Fusion Over Lexical & Dense Rankings
Given 1-based rank positions rank_BM25F(d) and rank_HNSW(d), Cormack, Clarke & Buettcher (2009) compute calibration-free hybrid relevance with damping constant k = 60:
RRF_score(Q, d) = ( 1 / (60 + rank_BM25F(Q, d)) ) + ( 1 / (60 + rank_HNSW(Q, d)) )4. Interactive Technical SEO & Cloud SaaS TCO Calculator
Compare query-capped content/SEO SaaS subscriptions against unified local-first technical SEO, writing, citation verification, and static HTML5 publishing below.
Display on documentation hubs or footers audited for single-@graph JSON-LD parity and llms.txt readiness.
Okapi BM25F, HNSW & Reciprocal Rank Fusion — FAQ
Direct answers on pre-saturation BM25F field normalization, HNSW skip-layer routing, RRF k=60 rank fusion, and structured HTML/JSON-LD search design.
- Why did Robertson, Zaragoza & Taylor (2004) sum field-weighted pseudo-frequencies before k1 saturation in BM25F?
- Taking a naive linear combination of separate per-field BM25 scores breaks term-frequency saturation—allowing a term appearing once in Title and ten times in Body to score higher than intended. BM25F normalizes each field f by length ratio dl_f / avgdl_f with field-specific b_f, sums weighted pseudo-counts tf_tilde(t, d) = sum_f w_f * tf_{t,f} / (1 - b_f + b_f * dl_f / avgdl_f), and applies nonlinear saturation tf_tilde / (k_1 + tf_tilde) once.
- How does HNSW (Malkov & Yashunin, 2020) achieve logarithmic approximate nearest-neighbor routing?
- Each inserted vector is assigned maximum layer l = floor(-ln(Uniform(0, 1)) * m_L), forming an exponentially sparser hierarchy of navigable small-world proximity graphs. Querying greedily descends upper layers with candidate beam ef = 1 to locate an entry basin before expanding a priority-queue beam of width efSearch at layer 0, paired with heuristic diversity pruning so edges span distinct angular directions.
- Why is Reciprocal Rank Fusion (Cormack, Clarke & Buettcher, 2009) robust without score-calibration training?
- Unbounded BM25F log-odds scores and bounded [-1, 1] cosine similarities live on incompatible scales whose distributions shift per query. RRF(d) = sum_{r in R} 1 / (k + rank_r(d)) with k = 60 depends strictly on ordinal rank positions, preventing a single outlier score from dominating while boosting documents ranked near the top by both lexical and semantic retrievers.
- How does BM25F field weighting guide clean on-page technical SEO and /llms.txt structure?
- Placing exact primary entities and specifications clearly inside <title>, H1/H2 headings, descriptive internal anchor text, and single-@graph JSON-LD earns full high-weight field credit cleanly—eliminating any need for repetitive body keyword stuffing.