Skip to content
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

Question: Support for sparse embeddings? #146

Open
Matheus-Garbelini opened this issue Mar 16, 2024 · 4 comments
Open

Question: Support for sparse embeddings? #146

Matheus-Garbelini opened this issue Mar 16, 2024 · 4 comments
Labels
new model Make a model compatible question Further information is requested

Comments

@Matheus-Garbelini
Copy link

Matheus-Garbelini commented Mar 16, 2024

Hi, I was wondering whether is would make sence to support models which, in addition to dense vectors, also support sparse and colbert. For example, BGE-M3 works well under infinity for dense vector retrieval. However, it would require some changes to the inference process to additionally obtain sparse vectors such as shown here:
https://github.com/FlagOpen/FlagEmbedding/blob/master/FlagEmbedding/BGE_M3/modeling.py#L352-L355

I wonder if for such case, it's feasible to add extra config parameters in the CLI or that would require too much changes to the core logic of the model during startup?

@Matheus-Garbelini Matheus-Garbelini changed the title Question: Support for sparse or colbert embeddings? Question: Support for sparse embeddings? Mar 16, 2024
@michaelfeil
Copy link
Owner

The most staigtforward way to do this at this moment would be to:

  • fork BGE/m3
  • Add a “trust_remote_code=True” - ship the code above
  • See if the postprocessing (e.g. normalization) influences the new embedding model.

@michaelfeil
Copy link
Owner

michaelfeil commented Mar 16, 2024

If you end up getting it done - I would love to feature it here!
Also if you have further questions, let me know!

I personally think the results from BGE-m3 paper are a bit to hastly - the performance is not good enough for a paradigm change, its more of a experiment. Perhaps its time for a BGE-M3-V2

@michaelfeil michaelfeil added question Further information is requested new model Make a model compatible labels Mar 16, 2024
@seetimee
Copy link

same question now

@Matheus-Garbelini
Copy link
Author

Hi @michaelfeil , sorry for the late reply. I actually ended up implementing a very basic and manual version of sparse embeddings for BGE-M3, but it is so slow and occupy so much GPU vram that I just switched to use the simple bm25 in elasticsearch for lexical search instead haha.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new model Make a model compatible question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants