Mistral 7B: Advancements in Language Model Efficiency and Performance
File Type
Entry Count
Embed. Model
Index Type

Mistral 7B, a 7–billion-parameter language model engineered for superior performance and efficiency. Mistral 7B outperforms the best open 13B model (Llama 2) across all evaluated benchmarks, and the best released 34B model (Llama 1) in reasoning, mathematics, and code generation. The model leverages grouped-query attention (GQA) for faster inference, coupled with sliding window attention (SWA) to effectively handle sequences of arbitrary length with a reduced inference cost. We also provide a model fine-tuned to follow instructions, Mistral 7B – Instruct, that surpasses Llama 2 13B – chat model both on human and automated benchmarks. These models are released under the Apache 2.0 license.

Figure 5: Results on MMLU, commonsense reasoning, world knowledge and reading comprehension for Mistral 7B and Llama 2 (7B/13B/70B). Mistral 7B largely outperforms Llama 2 13B on all evaluations, except on knowledge benchmarks, where it is on par (this is likely due to its limited parameter count, which limits the amount of knowledge it can compress).
id: 1996af15b988c40aa30524136c970904 - page: 5
5 Adding guardrails for front-facing applications The ability to enforce guardrails when it comes to AI generation is important for front-facing applications. In this section, we highlight how to leverage system prompting to optionally enforce output constraints on top of our models. Additionally, we showcase the ability of Mistral 7B to perform fine-grained content moderation, which can be useful to enforce quality content in applications. 5.1 System prompt to enforce guardrails We introduce a system prompt (see below) to guide the model to generate answers within specified guardrails, similar to the work done with Llama 2. Using this prompt allows the user to move on the Pareto front of model utility / guardrails enforcement, as indicated in Table 4. Always assist with care, respect, and truth. Respond with utmost utility yet securely. Avoid harmful, unethical, prejudiced, or negative content. Ensure replies promote fairness and positivity.
id: a14f69c7435964e5aca7ecb14a54cf2d - page: 5
We use a set of 175 unsafe prompts for evaluating safety. With the recommended system prompt, the model properly declines to answer 100% of the harmful questions. As an illustration, we provide in Table 5 the answers of both Mistral 7B Instruct and Llama 2 Chat 13B to the question How to kill a linux process with system prompts activated. We observe that Mistral 7B provides a correct response while Llama 2 declines to answer. Note that on this specific question, both models answer correctly when system prompts are deactivated. Guardrails MT Bench No system prompt Llama 2 system prompt Mistral system prompt 6.84 0.07 6.38 0.07 6.58 0.05 Table 4: System prompts. Mean official MT Bench score over 10 iterations with standard deviation for Mistral 7B Instruct. For reference, Llama 2 13B Chat reports official results of 6.65.
id: 6a0d1fe4b2fce2b0ddeb96555abbad1a - page: 5
5.2 Content moderation with self-reflection Mistral 7B Instruct can be used as a content moderator: the model itself is able to accurately classify a user prompt or its generated answer as being either acceptable or falling into one of the following categories: Illegal activities such as terrorism, child abuse or fraud; Hateful, harassing or violent content such as discrimination, self-harm or bullying; Unqualified advice for instance in legal, medical or financial domains. 5 Model Answer
id: 430fb5f8e6ab189e475e9c653d591eec - page: 5
How to Retrieve?
# Search

curl -X POST "https://search.dria.co/hnsw/search" \
-H "x-api-key: <YOUR_API_KEY>" \
-H "Content-Type: application/json" \
-d '{"rerank": true, "top_n": 10, "contract_id": "flt9cFOq_0Dtk_mCFnX5ET-ZCnn14fBMt5bMYDZ6jKA", "query": "What is alexanDRIA library?"}'
# Query

curl -X POST "https://search.dria.co/hnsw/query" \
-H "x-api-key: <YOUR_API_KEY>" \
-H "Content-Type: application/json" \
-d '{"vector": [0.123, 0.5236], "top_n": 10, "contract_id": "flt9cFOq_0Dtk_mCFnX5ET-ZCnn14fBMt5bMYDZ6jKA", "level": 2}'