New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Cross-Encoder support to Similarity pipeline #372
Comments
This one might be the most promising as a default. The differences/improvements appear to be:
Here's a paper that seems to be the basis of MMarco and shows very competitive performance for these multilingual models vs monolingual ones, as well as mMiniLM performing comparably to the far larger mT5. https://arxiv.org/pdf/2108.13897.pdf |
I'm not savvy enough to submit a PR for this, but here's how Haystack implements it: https://github.com/deepset-ai/haystack/tree/main/haystack/nodes/ranker And sentence-transformers provided simple code on the HF model page:
|
The similarity pipeline is also using sequence classification. I'll take a look at what is going wrong. Most likely reason is the model outputs aren't interpreted correctly. |
Yeah, if I'm not mistaken, cross encoders just output a similarity score rather than a vector. Probably just need to add a bit of logic to interpret it. |
Added a new pipeline type for cross-encoders. The similarity pipeline can use the cross-encoder pipeline as a reference if |
As it turns out, I'm not getting great results with a few cross encoders, as compared to But it was probably worth adding this anyway! |
It seems to be that the models work best with questions - longer passages with the answer (asymmetric similarity). For symmetric similarity, mnli models appear to work better. Definitely was worth adding. |
It seems like Cross Encoders are the preferred model for doing Re-Ranking of search results that were generated by another means (BM25, vector search etc...). However, if I provide one of these models as the path, all the results just have scores of 0.5.
Sentence Transformers recommends doing this. https://www.sbert.net/examples/applications/retrieve_rerank/README.html
In particular, their msmarco-minilm models seem ideal as a default (maybe the L-6 version?) https://www.sbert.net/docs/pretrained-models/ce-msmarco.html
Haystack's implementation uses this in its Ranker node. https://haystack.deepset.ai/pipeline_nodes/ranker
The text was updated successfully, but these errors were encountered: