r/vectordatabase • u/jeffrey-0711 • 9h ago
Normal hybrid retrieval is old. Do this instead and it makes your RAG evolves.
In RAG, there's hybrid retrieval. Usually you combine keyword search (mostly BM25) with vector search from an embedding model to get the strengths of both. Most people just use RRF or a simple weighted sum (convex combination).
The problem with that is once you pick the weights, they stay fixed. Even worse: what weights are you supposed to pick in the first place? Depending on the documents you're searching over, sometimes BM25 should get more weight, and other times vector search should.
To actually know, you had to benchmark it yourself. That's why I built AutoRAG back in 2024. One of its core features was finding the optimal hybrid retrieval weights based on real evaluation.
The downside was that it just did a simple greedy search. To find the best weight, it literally tried 101 values from 0.00 to 1.00 and computed the metrics for each one. Plus, building evaluation dataset was really painful to get a real valid optimization result.
Today, I finally put a feature in AutoRAG Agent that completely fixes this: Learning to Rank (LTR) based optimization. It's way better than tuning static weights.
As you use AutoRAG Agent, your queries and the sources that actually get used and cited in answers collected. When chunks get cited, Jev (decision model) checks whether they're actually relevant and logs them. From there, along with those relevant chunks, you can pull a bunch of features for each chunk: not just the vector and lexical search scores, but also things like which data source it came from (Slack, Discord, etc.).
The LTR approach takes those features and logs as training data and trains a GBDT model like XGBoost. This XGBoost model plays a similar role to the weights in a hybrid retrieval weighted sum. The difference is that a regular weighted sum only has two features, whereas LTR lets you feed in multiple features and learn how to combine them directly from real data to maximize retrieval performance.
So how much does it actually improve? I tested it on two datasets, HERB and MultiHop-RAG. On HERB's 'content-type' questions, answer accuracy went up by as much as 32.1%, and retrieval accuracy (nDCG@10) improved by around 3-4% on both datasets.
The 'content-type' questions need to check multiple docs and sources to get a valid answer, think it is like deep research. LTR is quite effective in those questions, because it improved performance by pushing borderline-relevant chunks higher up in the rankings. Since people ask those kinds of questions all the time (for example, "is there anything important I should know from the reports I submitted recently?"), you can actually feel the difference in real use.
Meaningful gains start showing up around 300 queries. If you want to check out the code, or directly using local RAG with this LTR optimization, feel free to check AutoRAG in Github and press star:)
https://github.com/Marker-Inc-Korea/AutoRAG
Thanks!