top | item 46080936

(no title)

nilirl | 3 months ago

Why is it implicit that semantic search will outperform lexical search?

Back in 2023 when I compared semantic search to lexical search (tantivy; BM25), I found the search results to be marginally different.

Even if semantic search has slightly more recall, does the problem of context warrant this multi-component, homebrew search engine approach?

By what important measure does it outperform a lexical search engine? Is the engineering time worth it?

discuss

order

kgeist|3 months ago

It depends on how you test it. I recently found that the way devs test it differs radically from how users actually use it. When we first built our RAG, it showed promising results (around 90% recall on large knowledge bases). However, when the first actual users tried it, it could barely answer anything (closer to 30%). It turned out we relied on exact keywords too much when testing it: we knew the test knowledge base, so we formulated our questions in a way that helped the RAG find what we expected it to find. Real users don't know the exact terminology used in the articles. We had to rethink the whole thing. Lexical search is certainly not enough. Sure, you can run an agent on top of it, but that blows up latency - users aren't happy when they have to wait more than a couple of seconds.

victorbuilds|3 months ago

This is the gap that kills most AI features. Devs test with queries they already know the answer to. Users come in with vague questions using completely different words. I learned to test by asking my kids to use my app - they phrase things in ways I would never predict.

babelfish|3 months ago

How did you end up changing it? Creating new evals to measure the actual user experience seems easy enough, how did that inform your stack?

scosman|3 months ago

Totally depends on use case.

It solves some types of issues lexical search never will. For example if a user searches "Close account", but the article is named "Deleting Your Profile".

But lexical solves issues semantic never will. Searching an invoice DB for "Initech" with semantic search is near useless.

Pick a system that can do both, including a hybrid mode, then evaluate if the complexity is worth it for you.

mips_avatar|3 months ago

Depends on how important keyword matching vs something more ambiguous is to your app. In Wanderfugl there’s a bunch of queries where semantic search can find an important chunk that lacks a high bm25 score. The good news is you can get all the benefits of bm25 and semantic with a hybrid ranking. The answer isn’t one or the other.

andoando|3 months ago

The benefit I see is you can have queries like "conversations between two scientists".

Its very dependent on use case imo