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

Feature Request: Support for NVEmbed #7746

Open
4 tasks done
christianazinn opened this issue Jun 4, 2024 · 2 comments
Open
4 tasks done

Feature Request: Support for NVEmbed #7746

christianazinn opened this issue Jun 4, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@christianazinn
Copy link
Contributor

Prerequisites

  • I am running the latest code. Mention the version if possible as well.
  • I carefully followed the README.md.
  • I searched using keywords relevant to my issue to make sure that I am creating a new issue that is not already open (or closed).
  • I reviewed the Discussions, and have a new and useful enhancement to share.

Feature Description

Attempting to python3 convert-hf-to-gguf.py with NVIDIA's latest NVEmbed model yields a NotImplementedError: Architecture 'NVEmbedModel' not supported! Add support for NVEmbedModel architecture.

Motivation

NVIDIA recently released their NVEmbed embeddings model based on the Mistral 7B decoder that ranks #1 on the MTEB leaderboard. It would be nice to see support for this in llama.cpp.

Possible Implementation

I'm not sure how different it would be than existing embeddings architectures. I'm aware other decoder-based models like SFR Embedding Mistral have GGUF quants which work, so I figure the NVEmbed model is structured similarly. Then it's mostly a matter of writing in a new model class for it in convert-hf-to-gguf.py.

@christianazinn christianazinn added the enhancement New feature or request label Jun 4, 2024
@iamlemec
Copy link
Collaborator

iamlemec commented Jun 4, 2024

It looks like NVEmbed is basically Mistral but with non-causal attention and "latent attention" pooling. I hadn't seen latent attention pooling before, but judging from the modeling code on HF, it's just another attention layer on top of the last hidden states.

Right now in llama.cpp, we can tell causal-by-default models like Mistral to use non-causal attention. If we get #7477 merged, that will allow general pooling on these models. The only catch is we don't have latent pooling implemented, but it should be quite straightforward.

@christianazinn
Copy link
Contributor Author

If we get #7477 merged, that will allow general pooling on these models. The only catch is we don't have latent pooling implemented, but it should be quite straightforward.

Thanks, will wait for that to be merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants