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

embeddings: add support for prefixes in embeddings #4524

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

eliransin
Copy link

Some of the embedding models (e.g nomic-embed-text) are trained to embed for several purposes, this on the flip side, means that if not given the purpose for the embedding the retrieval results might and probably will be suboptimal. This change aims to deal with it by adding a configuration option for chunk and query prefixes with the option to support more embedding purposes in the future (i.e clustering).

Some refferences to justify this change:

  1. https://huggingface.co/nomic-ai/nomic-embed-text-v1.5#task-instruction-prefixes The nomic-embed-text prefixes section
  2. https://www.youtube.com/watch?v=76EIC_RaDNw (Don’t Embed Wrong! by Matt Williams)

Description

[ What changed? Feel free to be brief. ]

Checklist

  • The relevant docs, if any, have been updated or created
  • The relevant tests, if any, have been updated or created

Screenshots

[ For visual changes, include screenshots. ]

Testing instructions

Nothing special just adding some prefixes and making sure that a different index is being created. Some better retrievals might be observed but I guess it depend on the size of the index (the smaller the index the less the effect I assume).

Some of the embedding models (e.g  nomic-embed-text) are trained to embed for
several purposes, this on the flip side, means that if not given the purpose
for the embedding the retrieval results might and probably will be suboptimal.
This change aims to deal with it by adding a configuration option for chunk and
query prefixes with the option to support more embedding purposes in the future
(i.e clustering).

Some refferences to justify this change:
1. https://huggingface.co/nomic-ai/nomic-embed-text-v1.5#task-instruction-prefixes
   The nomic-embed-text prefixes section
2. https://www.youtube.com/watch?v=76EIC_RaDNw (Don’t Embed Wrong! by Matt
   Williams)

Signed-off-by: Eliran Sinvani <eliransin@gmail.com>
Copy link

netlify bot commented Mar 7, 2025

Deploy Preview for continuedev ready!

Name Link
🔨 Latest commit 611c16b
🔍 Latest deploy log https://app.netlify.com/sites/continuedev/deploys/67cac78681752500084b9492
😎 Deploy Preview https://deploy-preview-4524--continuedev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

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

Successfully merging this pull request may close these issues.

1 participant