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 and takes you literally: it finds documents containing your exact words, weighted by how rare those words are, and shrugs at synonyms and typos. Semantic matching is more forgiving and a lot fuzzier. It catches "k8s" when you meant "kubernetes", and every so often decides two unrelated things are soulmates. Production systems, my Atlas app included, 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, typo included, then drag the slider all the way to keyword-only and watch the result vanish. BM25 has no idea "kilswitch" is one letter off from "killswitch", and that gap is most of the argument for hybrid search.
In Atlas the semantic half is real sentence embeddings and the blend is 0.4 × bm25 + 0.6 × semantic, and it runs in under a millisecond on a phone. 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 →