You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In MongoDBAtlasHybridSearchRetriever, currently it's not possible to add weights separately to 2 retrievers (in other words, it's always 50-50).
A workaround is to change vector_penalty and fulltext_penalty. However, tuning the RRF parameter k changes the shape of the reciprocal rank function, while multiplying by a weight is a simple linear scaling of the entire curve. These two approaches are not mathematically equivalent and lead to different effects on how each rank contributes to the final score.
One thing to mention is that EnsembleRetriever in Langchain also implemented the weights (instead of changing the penalty constant k).
Thus, I'd propose implementing weights to the class MongoDBAtlasHybridSearchRetriever by adding 2 more stages to the Mongo pipeline, so that it can be instantiated this way:
In
MongoDBAtlasHybridSearchRetriever
, currently it's not possible to add weights separately to 2 retrievers (in other words, it's always 50-50).A workaround is to change
vector_penalty
andfulltext_penalty
. However, tuning the RRF parameterk
changes the shape of the reciprocal rank function, while multiplying by a weight is a simple linear scaling of the entire curve. These two approaches are not mathematically equivalent and lead to different effects on how each rank contributes to the final score.One thing to mention is that
EnsembleRetriever
in Langchain also implemented the weights (instead of changing the penalty constantk
).Thus, I'd propose implementing weights to the class
MongoDBAtlasHybridSearchRetriever
by adding 2 more stages to the Mongo pipeline, so that it can be instantiated this way:The text was updated successfully, but these errors were encountered: