E5-mistral-7b-instruct
a text embedding model based on Mistral
2 min readupdated
This model is designed to convert text into vector representations (embeddings) using the capabilities of large language models. Based on the Mistral-7B-v0.1 architecture, it features 32 layers and an embedding dimension of 4096, enabling efficient matching of query and document meanings. Trained using text instructions (task descriptions), it helps tailor search more precisely to specific scenarios. The release is useful for developers and researchers working on codebase search, semantic search, and document reranking in English.
Key features
- Query instructions: requires adding a single-sentence task description to the query for maximum accuracy.
- Context length: supports sequences up to 4096 tokens long.
- Vector dimension: outputs embeddings with a dimension of 4096.
- Integration: full support via the popular Sentence Transformers and Hugging Face Transformers libraries.
What you can do
- Semantic search: set up precise retrieval of relevant documents or articles based on user text queries.
- Passage reranking: apply the model in information retrieval and text matching tasks (for example, on the MS-MARCO dataset).
- Task customization: use text prefixes (such as for summarization or web search) to adapt the model to various business scenarios.
Example
from sentence_transformers import SentenceTransformer
model = SentenceTransformer("intfloat/e5-mistral-7b-instruct")
model.max_seq_length = 4096
queries = ["how much protein should a female eat"]
documents = ["As a general guideline, the CDC's average requirement..."]
query_embeddings = model.encode(queries, prompt_name="web_search_query")
document_embeddings = model.encode(documents)
scores = (query_embeddings @ document_embeddings.T) * 100
print(scores.tolist())Read more
DetailsBase model: Mistral-7B-v0.1
Limitations: Not recommended for sequences longer than 4096 tokens; multilingual capabilities are limited, with English as the primary recommendation.
Training details: Adding instructions to queries is mandatory, otherwise a performance drop is observed.










Comments