Hybrid Search Toy

Two search engines arguing about relevance, and a slider to referee.

Keyword search and semantic search fail in opposite directions. BM25, the ranking function behind most text search since the 90s, is precise but literal: it finds documents containing your exact words, weighted by how rare those words are, and shrugs at synonyms and typos. Semantic matching is forgiving but fuzzy: it catches "k8s" when you meant "kubernetes", and occasionally decides two unrelated things are soulmates. Production systems, including my Atlas app, run both and blend the scores.

This page does the same over the actual paragraphs of this site's blog posts. The BM25 is real (k1=1.5, b=0.75, honest inverse document frequency). The "semantic" side is a confessed toy: character-trigram cosine similarity, which knows nothing about meaning but handles typos and partial words the way you'd hope. Try searching kilswitch with the typo, then drag the slider fully to keyword-only and watch the result vanish. That's the whole argument for hybrid, in one slider.

keyword (BM25) semantic-ish 0.4 / 0.6

In Atlas the semantic half is real sentence embeddings and the blend is 0.4 × bm25 + 0.6 × semantic, running in under a millisecond on a phone. And yes, the score normalization here is tested, because I once shipped the bug where worse keyword matches ranked higher: Fitting a Second Brain Into 8,192 Tokens →