mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-11 10:34:13 -05:00
Bug: the default sbert model was trained on tweets and shouldn't be used for RAG #2047
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @thiswillbeyourgithub on GitHub (Sep 10, 2024).
Bug Report
Expected Behavior:
The default value for RAG should make sense: the chunk size and overlap should be compatible with the default model.
Actual Behavior:
The default model is
sentence-transformers/all-MiniLM-L6v2. Despite what its reputation seems to be, IMO it's a pretty terrible model for today's standard.To quote from their hf page :
Our model is intended to be used as a sentence and short paragraph encoder.The sequence length was limited to 128 tokens.By default, input text longer than 256 word pieces is truncated.I have been saying in multiple places now that this shouldn't be used by default ever, as it was trained on basically short tweets and silently clips any text above their limit.
Now there are several ways to go about this:
FWIW my prefered suggestion would be to use a multilingual model (they also are the only one with that long context AFAIK), jina's colbert might be a sane default as it's not so big.
AFAIK all those models can be used by the sentence-transformers package or as hugging face embeddings. As you can see here for example
Jina also makes good rerankers so you could set one up by default (even if it's disabled by default).
PS: I you use sentence transformer models, you can add checks to lookup the maximum supported embedding size of a given model and warn the user. Example can be found at my old broken script