Closed creatorrr closed 3 weeks ago
our current mmr implementation is here. It's written in cozoscript but unfortunately the logic is incorrect. Technically it is possible to implement it in cozo but it's a pretty crazy query and looks like this
For reference: MMR Algorithm
recommendation: instead of applying MMR in cozo script, when it is turned on, get (n=3*k)
results from the search query and then re-rank using MMR to get new (n=k*)
results. This can be done in python at the routers/
level. MMR only applies to hybrid and vector searches.
You can add this to the search_docs
router here.
Flag for activating mmr is mmr_strength > 0
here.
Important note: mmr_strength = 1 - mmr_lambda
where mmr_lambda
is the hyperparameter for the mmr algorithm.
Reference implementation: in keybert
📜 Description
No response
👟 Reproduction steps
No response
👀 Have you spent some time to check if this bug has been raised before?