# Mistral 7B

Albert Q. Jiang, Alexandre Sablayrolles, Arthur Mensch, Chris Bamford, Devendra Singh Chaplot, Diego de las Casas 외 12명 · arXiv · 2023년 10월 10일

- **연구 문제** 대형 언어 모델은 성능을 높이기 위해 모델 크기를 키우지만, 이는 계산 비용과 추론 지연을 늘려 배포를 어렵게 합니다. Mistral 7B는 7B 파라미터 규모에서 높은 성능과 효율을 함께 얻는 것을 목표로 합니다.
- **연구 방법** grouped-query attention으로 추론 중 메모리 요구를 줄이고, sliding window attention으로 긴 시퀀스의 연산과 캐시 비용을 제한합니다.
- **주요 결과** 논문은 Mistral 7B가 Llama 2 13B보다 모든 지표에서 높고, 여러 벤치마크에서 Llama 1 34B보다 높다고 보고합니다. Instruct 모델은 MT Bench에서 6.84 ± 0.07을 기록합니다.

## 모델 크기와 배포 비용의 충돌

언어 모델은 성능을 높이려고 모델 크기를 키우는 경향이 있습니다. 그러나 이 방식은 계산 비용과 추론 지연을 함께 늘리므로 실제 서비스에 배포하는 데 장벽이 됩니다. Mistral 7B는 이 상황에서 7B 파라미터 규모의 모델로 높은 성능과 효율을 함께 얻는 것을 목표로 소개됩니다.

이 목표를 위해 논문은 두 가지 어텐션 설계를 결합합니다. 하나는 키와 값의 헤드를 공유해 추론 중 메모리 요구를 줄이는 grouped-query attention(GQA)이고, 다른 하나는 각 토큰이 가까운 범위의 토큰에만 주의를 기울이는 sliding window attention(SWA)입니다. 이어지는 절에서는 SWA가 긴 시퀀스의 비용을 어떻게 줄이는지, 그리고 그 비용 절감이 캐시 관리와 어떻게 연결되는지를 차례로 따라갑니다.

## Sliding Window Attention의 정보 전달 방식

Sliding Window Attention(SWA)에서는 각 레이어의 위치 i에 있는 은닉 상태가 이전 레이어의 위치 i−W부터 i까지의 상태에만 주의를 기울입니다. 한 레이어가 직접 볼 수 있는 범위는 W개 토큰으로 고정됩니다. 그러나 이 연산을 여러 레이어에 쌓으면 정보가 레이어를 지날 때마다 W만큼 앞으로 전달되므로, k개 레이어 뒤에는 최대 W×k 토큰 거리까지 정보가 닿습니다. 그림 1의 캡션은 이 원리를 W=3인 예로 보여 줍니다. 논문은 W=4096인 경우 마지막 레이어의 이론적 주의 범위가 약 131K 토큰이라고 설명합니다.

![Figure 1: Sliding Window Attention. The number of operations in vanilla attention is quadratic in the sequence length, and the memory increases linearly with t…](https://refivu.com/papers/9993f1cb-8618-4aeb-9dc5-d4a5aa598381/figures/figure-c348620d5fc977bddeb841fd32e960ef.png?thumb=512)

**Figure 1** : Sliding Window Attention. The number of operations in vanilla attention is quadratic in the sequence length, and the memory increases linearly with the number of tokens. At inference time, this incurs higher latency and smaller throughput due to reduced cache availability. To alleviate this issue, we use sliding window attention: each token can attend to at most W tokens from the previous layer (here, W = 3). Note that tokens outside the sliding window still influence next word prediction. At each attention layer, information can move forward by W tokens. Hence, after k attention layers, information can move forward by up to k × W tokens.

[원문](https://arxiv.org/abs/2310.06825v1) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Albert Q. Jiang, Alexandre Sablayrolles, Arthur Mensch, Chris Bamford, Devendra Singh Chaplot, Diego de las Casas, Florian Bressand, Gianna Lengyel, Guillaume Lample, Lucile Saulnier, Lélio Renard Lavaud, Marie-Anne Lachaux, Pierre Stock, Teven Le Scao, Thibaut Lavril, Thomas Wang, Timothée Lacroix, William El Sayed · Mistral 7B · 원문 그림 인용 · 원본 PDF 2쪽에서 그림 영역을 추출했습니다.

이 설계가 필요한 이유는 vanilla attention의 비용 구조에 있습니다. 그림 1의 캡션에 따르면 vanilla attention의 연산 수는 시퀀스 길이에 대해 이차적으로 늘고, 메모리는 토큰 수에 비례해 증가합니다. 추론 시 캐시 공간이 줄어들면 지연은 커지고 처리량은 작아집니다. SWA는 각 레이어의 주의 범위를 W로 제한해 이 비용을 줄이면서도 여러 레이어를 통해 더 먼 정보까지 전달되도록 합니다.

이 구조는 Table 1의 설정과 함께 제시됩니다. 표에는 window\_size 4096과 context\_len 8192가 포함되어 있으며, Mistral 7B는 이 조건에서 SWA를 사용하는 구조로 설명됩니다.

![Table 1: Model architecture](https://refivu.com/papers/9993f1cb-8618-4aeb-9dc5-d4a5aa598381/figures/figure-64cbfb073a1ff672746a267c8b6c45ee.png?thumb=512)

**Table 1** : Model architecture.

[원문](https://arxiv.org/abs/2310.06825v1) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Albert Q. Jiang, Alexandre Sablayrolles, Arthur Mensch, Chris Bamford, Devendra Singh Chaplot, Diego de las Casas, Florian Bressand, Gianna Lengyel, Guillaume Lample, Lucile Saulnier, Lélio Renard Lavaud, Marie-Anne Lachaux, Pierre Stock, Teven Le Scao, Thibaut Lavril, Thomas Wang, Timothée Lacroix, William El Sayed · Mistral 7B · 원문 그림 인용 · 원본 PDF 2쪽에서 그림 영역을 추출했습니다.

## 고정 크기 캐시와 프롬프트 청크 처리

Rolling Buffer Cache는 SWA의 고정된 주의 범위를 이용해 캐시 크기를 W로 제한합니다. 시점 i의 키와 값은 캐시의 \\(i \\bmod W\\) 위치에 저장됩니다. 따라서 i가 W보다 커지면 오래된 값이 덮어써지고 캐시 크기는 더 이상 늘어나지 않습니다. 그림 2는 W=4인 경우에 이 동작을 보여 줍니다.

![Figure 2: Rolling buffer cache. The cache has a fixed size of W = 4. Keys and values for position i are stored in position i mod W of the cache. When the posit…](https://refivu.com/papers/9993f1cb-8618-4aeb-9dc5-d4a5aa598381/figures/figure-e03e30564dc5d85cdf9676883ad8efd3.png?thumb=512)

**Figure 2** : Rolling buffer cache. The cache has a fixed size of W = 4. Keys and values for position i are stored in position i mod W of the cache. When the position i is larger than W , past values in the cache are overwritten. The hidden state corresponding to the latest generated tokens are colored in orange.

[원문](https://arxiv.org/abs/2310.06825v1) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Albert Q. Jiang, Alexandre Sablayrolles, Arthur Mensch, Chris Bamford, Devendra Singh Chaplot, Diego de las Casas, Florian Bressand, Gianna Lengyel, Guillaume Lample, Lucile Saulnier, Lélio Renard Lavaud, Marie-Anne Lachaux, Pierre Stock, Teven Le Scao, Thibaut Lavril, Thomas Wang, Timothée Lacroix, William El Sayed · Mistral 7B · 원문 그림 인용 · 원본 PDF 3쪽에서 그림 영역을 추출했습니다.

Pre-fill and Chunking은 생성 전에 알려진 프롬프트의 (k, v) 캐시를 미리 채우는 방법입니다. 토큰은 하나씩 생성되어야 하지만 프롬프트는 미리 주어져 있으므로 이를 먼저 캐시에 넣을 수 있습니다. 프롬프트가 매우 길면 윈도우 크기를 청크 크기로 삼아 여러 청크로 나누어 처리합니다. 각 청크는 캐시에 대한 어텐션과 청크 내부 어텐션을 함께 계산합니다. 그림 3은 세 번째 청크 'the dog go to'에서 청크 내부에는 causal mask가, 캐시에는 슬라이딩 윈도우가 적용되고, 윈도우 밖의 과거 토큰은 참조하지 않는 구조를 보여 줍니다.

![Figure 3: Pre-fill and chunking. During pre-fill of the cache, long sequences are chunked to limit memory usage. We process a sequence in three chunks, “The ca…](https://refivu.com/papers/9993f1cb-8618-4aeb-9dc5-d4a5aa598381/figures/figure-f67129fed3e14d070e3b303c2d392dbc.png?thumb=512)

**Figure 3** : Pre-fill and chunking. During pre-fill of the cache, long sequences are chunked to limit memory usage. We process a sequence in three chunks, “The cat sat on”, “the mat and saw”, “the dog go to”. The figure shows what happens for the third chunk (“the dog go to”): it attends itself using a causal mask (rightmost block), attends the cache using a sliding window (center block), and does not attend to past tokens as they are outside of the sliding window (left block).

[원문](https://arxiv.org/abs/2310.06825v1) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Albert Q. Jiang, Alexandre Sablayrolles, Arthur Mensch, Chris Bamford, Devendra Singh Chaplot, Diego de las Casas, Florian Bressand, Gianna Lengyel, Guillaume Lample, Lucile Saulnier, Lélio Renard Lavaud, Marie-Anne Lachaux, Pierre Stock, Teven Le Scao, Thibaut Lavril, Thomas Wang, Timothée Lacroix, William El Sayed · Mistral 7B · 원문 그림 인용 · 원본 PDF 3쪽에서 그림 영역을 추출했습니다.

논문은 32k 토큰 시퀀스에서 이 캐시가 캐시 메모리 사용량을 8x 줄이며, 모델 품질에는 영향을 주지 않는다고 보고합니다. 이 수치는 32k 토큰 시퀀스에 대한 결과이며, 다른 길이에서의 절감량은 이 글에서 다루지 않습니다.

## 16K 시퀀스에서의 추론 속도

SWA의 효율성은 FlashAttention과 xFormers에 적용한 변경을 통해 실제 속도로 확인됩니다. 논문은 16K 시퀀스 길이와 W=4096 조건에서 이 변경이 vanilla attention 기준선보다 2x 속도 향상을 낸다고 보고합니다.

이 결과는 해당 조건에서 측정한 속도 비교입니다. 같은 수치를 다른 시퀀스 길이나 다른 하드웨어에 그대로 적용하는 것은 이 글의 범위를 넘어섭니다. 앞서 설명한 캐시 절감과 함께 보면, SWA의 효과는 연산 속도와 메모리 사용이라는 두 측면에서 나타납니다.

## Llama 계열 기준선과의 벤치마크 비교

Mistral 7B는 Llama 2 7B, Llama 2 13B, Llama 1 34B, Code-Llama 7B와 비교됩니다. 그림 4는 여러 벤치마크에서 이 비교를 보여 주며, 캡션은 모든 모델을 같은 평가 파이프라인으로 다시 평가했다고 설명합니다. 그 결과 Mistral 7B는 Llama 2 13B보다 모든 지표에서 높고, Llama 1 34B보다는 대부분의 벤치마크에서 높습니다. 특히 코드, 수학, 추론 벤치마크에서 우위가 두드러집니다.

![Figure 4: Performance of Mistral 7B and different Llama models on a wide range of benchmarks. All models were re-evaluated on all metrics with our evaluation p…](https://refivu.com/papers/9993f1cb-8618-4aeb-9dc5-d4a5aa598381/figures/figure-b3f95b793a0baf93f95f639528513c1e.png?thumb=512)

**Figure 4** : Performance of Mistral 7B and different Llama models on a wide range of benchmarks. All models were re-evaluated on all metrics with our evaluation pipeline for accurate comparison. Mistral 7B significantly outperforms Llama 2 7B and Llama 2 13B on all benchmarks. It is also vastly superior to Llama 1 34B in mathematics, code generation, and reasoning benchmarks.

[원문](https://arxiv.org/abs/2310.06825v1) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Albert Q. Jiang, Alexandre Sablayrolles, Arthur Mensch, Chris Bamford, Devendra Singh Chaplot, Diego de las Casas, Florian Bressand, Gianna Lengyel, Guillaume Lample, Lucile Saulnier, Lélio Renard Lavaud, Marie-Anne Lachaux, Pierre Stock, Teven Le Scao, Thibaut Lavril, Thomas Wang, Timothée Lacroix, William El Sayed · Mistral 7B · 원문 그림 인용 · 원본 PDF 4쪽에서 그림 영역을 추출했습니다.

표 2의 수치로 보면 MMLU(5-shot) 점수는 Mistral 7B가 60.1%이고 LLaMA 2 13B Pretrained가 55.6%입니다. GSM8K(8-shot, maj@8) 점수는 Mistral 7B가 52.2%이고 LLaMA 2 13B Pretrained가 34.3%입니다. 이 비교는 같은 평가 설정에서 재실행된 값들이며, 표의 값은 위 설정과 함께 읽어야 합니다.

![Table 2: Comparison of Mistral 7B with Llama. Mistral 7B outperforms Llama 2 13B on all metrics, and approaches the code performance of Code-Llama 7B without s…](https://refivu.com/papers/9993f1cb-8618-4aeb-9dc5-d4a5aa598381/figures/figure-d60fdbd9df54d90c1b51c7da90838c63.png?thumb=512)

**Table 2** : Comparison of Mistral 7B with Llama. Mistral 7B outperforms Llama 2 13B on all metrics, and approaches the code performance of Code-Llama 7B without sacrificing performance on non-code benchmarks.

[원문](https://arxiv.org/abs/2310.06825v1) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Albert Q. Jiang, Alexandre Sablayrolles, Arthur Mensch, Chris Bamford, Devendra Singh Chaplot, Diego de las Casas, Florian Bressand, Gianna Lengyel, Guillaume Lample, Lucile Saulnier, Lélio Renard Lavaud, Marie-Anne Lachaux, Pierre Stock, Teven Le Scao, Thibaut Lavril, Thomas Wang, Timothée Lacroix, William El Sayed · Mistral 7B · 원문 그림 인용 · 원본 PDF 4쪽에서 그림 영역을 추출했습니다.

코드 성능에서 Mistral 7B의 HumanEval 점수는 30.5%이고 Code-Llama 7B는 31.1%입니다. 원문은 Mistral 7B가 Code-Llama 7B의 코드 성능에 근접하면서도 코드가 아닌 벤치마크의 성능을 희생하지 않는다고 설명합니다.

## 모델 크기 대비 효율과 지식 벤치마크의 한계

논문은 Llama 2 계열의 등가 모델 크기를 계산해 Mistral 7B의 비용 대비 성능을 비교합니다. 추론, 독해, STEM 추론 가운데 MMLU에서는 Mistral 7B의 성능이 3배보다 큰 Llama 2 모델에서 기대되는 수준과 비슷하게 나타납니다.

지식 벤치마크에서는 압축률이 1.9x로 낮게 보고됩니다. 저자들은 이 낮은 압축률이 제한된 파라미터 수 때문에 저장할 수 있는 지식의 양이 제한되기 때문일 가능성이 있다고 해석합니다. 그림 5의 캡션도 지식 벤치마크에서 Mistral 7B가 Llama 2 13B와 비슷하다고 설명합니다.

![Figure 5: Results on MMLU, commonsense reasoning, world knowledge and reading comprehension for Mistral 7B and Llama 2 (7B/13B/70B). Mistral 7B largely outperf…](https://refivu.com/papers/9993f1cb-8618-4aeb-9dc5-d4a5aa598381/figures/figure-3c3b9bb1b38bf46a4f63e9688dd06a5e.png?thumb=512)

**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).

[원문](https://arxiv.org/abs/2310.06825v1) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Albert Q. Jiang, Alexandre Sablayrolles, Arthur Mensch, Chris Bamford, Devendra Singh Chaplot, Diego de las Casas, Florian Bressand, Gianna Lengyel, Guillaume Lample, Lucile Saulnier, Lélio Renard Lavaud, Marie-Anne Lachaux, Pierre Stock, Teven Le Scao, Thibaut Lavril, Thomas Wang, Timothée Lacroix, William El Sayed · Mistral 7B · 원문 그림 인용 · 원본 PDF 5쪽에서 그림 영역을 추출했습니다.

## 공개 인스트럭션 데이터로 만든 Mistral 7B – Instruct

Mistral 7B – Instruct는 Hugging Face 저장소의 공개 인스트럭션 데이터셋으로 기반 모델을 미세조정해 만들어졌습니다. 논문은 독점 데이터나 별도의 학습 기법을 쓰지 않았으며, 이 모델을 기반 모델을 쉽게 미세조정할 수 있다는 것을 보여 주는 간단한 시연으로 제시합니다.

채팅 평가인 MT Bench에서 Mistral 7B – Instruct의 점수는 6.84 +/- 0.07입니다. 같은 표에서 Llama 2 13B Chat은 6.65이고, WizardLM 13B v1.2는 7.2입니다. 논문은 Mistral 7B – Instruct가 모든 7B 모델보다 높고 13B – Chat 모델과 비슷한 수준이라고 설명합니다. 이 결과는 13B 계열 모델 중 최고 점수를 가리키지 않으며, 위 표의 비교 범위 안에서 읽어야 합니다.

![Table 3: Comparison of Chat models. Mistral 7B – Instruct outperforms all 7B models on MT-Bench, and is comparable to 13B – Chat models](https://refivu.com/papers/9993f1cb-8618-4aeb-9dc5-d4a5aa598381/figures/figure-b7785a67055370b81f21cffaefeb8f74.png?thumb=512)

**Table 3** : Comparison of Chat models. Mistral 7B – Instruct outperforms all 7B models on MT-Bench, and is comparable to 13B – Chat models.

[원문](https://arxiv.org/abs/2310.06825v1) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Albert Q. Jiang, Alexandre Sablayrolles, Arthur Mensch, Chris Bamford, Devendra Singh Chaplot, Diego de las Casas, Florian Bressand, Gianna Lengyel, Guillaume Lample, Lucile Saulnier, Lélio Renard Lavaud, Marie-Anne Lachaux, Pierre Stock, Teven Le Scao, Thibaut Lavril, Thomas Wang, Timothée Lacroix, William El Sayed · Mistral 7B · 원문 그림 인용 · 원본 PDF 4쪽에서 그림 영역을 추출했습니다.

Table 4는 6.84 ± 0.07이 10회 반복의 공식 MT Bench 평균과 표준편차라고 밝힙니다. Llama 2 13B – Chat의 6.65는 참고용 공식 결과로 함께 제시됩니다.

![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 r…](https://refivu.com/papers/9993f1cb-8618-4aeb-9dc5-d4a5aa598381/figures/figure-e05dd91dc8ba3dc9c2c45ff8bbbe1371.png?thumb=512)

**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.

[원문](https://arxiv.org/abs/2310.06825v1) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Albert Q. Jiang, Alexandre Sablayrolles, Arthur Mensch, Chris Bamford, Devendra Singh Chaplot, Diego de las Casas, Florian Bressand, Gianna Lengyel, Guillaume Lample, Lucile Saulnier, Lélio Renard Lavaud, Marie-Anne Lachaux, Pierre Stock, Teven Le Scao, Thibaut Lavril, Thomas Wang, Timothée Lacroix, William El Sayed · Mistral 7B · 원문 그림 인용 · 원본 PDF 5쪽에서 그림 영역을 추출했습니다.

## 인간 선호 평가

논문은 Mistral 7B – Instruct와 Llama 2 13B – Chat을 독립적인 인간 평가로 비교합니다. 평가는 llmboxing.com에서 이루어졌고, 참가자는 질문과 익명의 두 모델 응답을 보고 선호하는 응답을 고릅니다. 그림 6은 양자 물리학 책 추천 질문에서 두 응답의 차이를 예시로 보여 줍니다.

![Figure 6: Human evaluation of Mistral 7B – Instruct vs Llama 2 13B – Chat Example. An example of human evaluation from llmboxing.com. The question asks for rec…](https://refivu.com/papers/9993f1cb-8618-4aeb-9dc5-d4a5aa598381/figures/figure-381178d1b89cf1eed7e90770b5ab66b1.png?thumb=512)

**Figure 6** : Human evaluation of Mistral 7B – Instruct vs Llama 2 13B – Chat Example. An example of human evaluation from llmboxing.com. The question asks for recommendations of books in quantum physics. Llama 2 13B – Chat recommends a general physics book, while Mistral 7B – Instruct recommends a more relevant book on quantum physics and describes in the contents in more detail.

[원문](https://arxiv.org/abs/2310.06825v1) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Albert Q. Jiang, Alexandre Sablayrolles, Arthur Mensch, Chris Bamford, Devendra Singh Chaplot, Diego de las Casas, Florian Bressand, Gianna Lengyel, Guillaume Lample, Lucile Saulnier, Lélio Renard Lavaud, Marie-Anne Lachaux, Pierre Stock, Teven Le Scao, Thibaut Lavril, Thomas Wang, Timothée Lacroix, William El Sayed · Mistral 7B · 원문 그림 인용 · 원본 PDF 7쪽에서 그림 영역을 추출했습니다.

2023년 10월 6일 기준으로 Mistral 7B의 출력은 5020번 선호되었고, Llama 2 13B의 출력은 4143번 선호되었습니다. 이 값은 선호 횟수이며, 이 평가는 해당 플랫폼의 질문과 참가자 집합에서 얻은 결과로 읽어야 합니다.

## 시스템 프롬프트로 조정하는 가드레일

시스템 프롬프트는 모델이 지침 범위 안에서 답변하도록 유도하는 방법입니다. 논문은 안전하고 존중하며 진실한 답변을 요구하고, 편향되거나 해로운 내용을 피하도록 지시하는 시스템 프롬프트를 제시합니다. 사용자는 이 프롬프트를 켜고 끌 수 있으며, 이를 통해 유용성과 가드레일 강도 사이의 Pareto 곡선 위 지점을 선택할 수 있습니다.

Table 4의 MT Bench 값은 시스템 프롬프트가 없을 때 6.84 ± 0.07, Mistral system prompt에서 6.58 ± 0.05, Llama 2 system prompt에서 6.38 ± 0.07입니다. 이 값은 같은 표에서 보고된 값으로만 비교해야 합니다.

안전성 평가는 175개의 안전하지 않은 프롬프트 집합에서 이루어집니다. 권장 시스템 프롬프트를 사용하면 모델은 유해 질문의 100%에 대해 답변을 적절히 거절합니다. Table 5의 예시에서 Mistral 7B – Instruct는 Linux 프로세스를 종료하는 방법에 올바르게 답하고, Llama 2 13B – Chat은 답변을 거절합니다. 원문은 이 질문에서 두 모델이 시스템 프롬프트를 끄면 모두 올바르게 답한다고 밝힙니다.

![Table 5: Comparison between Mistral and Llama system prompts. Mistral provides the right answer whereas Llama 2 declines to answer to the question How to kill…](https://refivu.com/papers/9993f1cb-8618-4aeb-9dc5-d4a5aa598381/figures/figure-bf1da73ded05652bd867f8c93619b039.png?thumb=512)

**Table 5** : Comparison between Mistral and Llama system prompts. Mistral provides the right answer whereas Llama 2 declines to answer to the question How to kill a linux process.

[원문](https://arxiv.org/abs/2310.06825v1) · [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) · Albert Q. Jiang, Alexandre Sablayrolles, Arthur Mensch, Chris Bamford, Devendra Singh Chaplot, Diego de las Casas, Florian Bressand, Gianna Lengyel, Guillaume Lample, Lucile Saulnier, Lélio Renard Lavaud, Marie-Anne Lachaux, Pierre Stock, Teven Le Scao, Thibaut Lavril, Thomas Wang, Timothée Lacroix, William El Sayed · Mistral 7B · 원문 그림 인용 · 원본 PDF 6쪽에서 그림 영역을 추출했습니다.

## 자기 성찰 기반 콘텐츠 분류

Mistral 7B – Instruct는 콘텐츠 검토자로도 쓰일 수 있습니다. 논문은 자기 성찰 프롬프트를 설계해 모델이 사용자 프롬프트나 생성된 답변을 허용 가능한 내용인지, 아니면 불법 행위, 혐오·괴롭힘·폭력적 내용, 자격 없는 전문 조언 같은 범주인지 분류하도록 합니다. 사용자는 이후 자신의 사용 목적에 맞는 범주를 골라 걸러낼 수 있습니다.

평가에는 수동으로 큐레이션한 균형 잡힌 적대적 프롬프트와 표준 프롬프트 데이터셋이 사용됩니다. 허용 가능한 프롬프트를 양성으로 볼 때 precision은 99.4%, recall은 95.6%입니다. 이 결과는 저자들이 구성한 데이터셋에서 얻은 것이며, 다른 데이터의 분류 성능으로 바로 일반화되지는 않습니다.

## 평가 범위와 남은 질문

논문의 벤치마크 평가는 저자들이 재실행한 평가 파이프라인에서 이루어졌습니다. 원문은 Llama 2 논문과 비교해 두 가지 평가 방식이 다르다고 밝힙니다. MBPP는 손으로 검증된 부분집합을 사용하고, TriviaQA에서는 Wikipedia 문맥을 제공하지 않습니다. 따라서 이 차이가 있는 벤치마크의 점수는 Llama 2 논문의 보고값과 같은 조건으로 읽으면 안 됩니다.

또한 지식 벤치마크의 낮은 압축률은 앞서 설명한 파라미터 수의 제약과 연결되어 있습니다. 가드레일 결과는 175개의 안전하지 않은 프롬프트 집합에서, 자기 성찰 분류 결과는 저자들이 구성한 데이터셋에서, 인간 평가는 한 플랫폼의 질문과 응답에서 얻은 결과입니다. 이 결과들이 다른 사용 환경의 안전성이나 품질을 대표한다는 증거는 이 글의 범위에 없습니다.

## 논문 정보

- **저자**: Albert Q. Jiang, Alexandre Sablayrolles, Arthur Mensch, Chris Bamford, Devendra Singh Chaplot, Diego de las Casas, Florian Bressand, Gianna Lengyel, Guillaume Lample, Lucile Saulnier, Lélio Renard Lavaud, Marie-Anne Lachaux, Pierre Stock, Teven Le Scao, Thibaut Lavril, Thomas Wang, Timothée Lacroix, William El Sayed
- **학회·저널**: arXiv · 프리프린트
- **최초 공개일**: 2023년 10월 10일
- **등록일**: 2026년 10월 20일
- **수정일**: 2023년 10월 10일
- **버전**: v1
- **arXiv**: 2310.06825
- **분류**: cs.CL · cs.AI · cs.LG
- **원문 이용 조건**: [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/)
- **제공 범위**: 논문 정보, 해설, 허용된 원문 그림

[논문 원문 ↗](https://arxiv.org/abs/2310.06825v1) · [원문 PDF ↗](https://arxiv.org/pdf/2310.06825v1)

AI 해설은 논문 원문과 별개의 설명이며 오류가 있을 수 있습니다. 원문과 그림은 각 출처의 이용 조건과 따로 표시된 권리를 따릅니다.

## 초록

We introduce Mistral 7B v0.1, a 7-billion-parameter language model engineered for superior performance and efficiency. Mistral 7B outperforms Llama 2 13B across all evaluated benchmarks, and Llama 1 34B in reasoning, mathematics, and code generation. Our 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 the Llama 2 13B -- Chat model both on human and automated benchmarks. Our models are released under the Apache 2.0 license.

## 원문 인용

Albert Q. Jiang, Alexandre Sablayrolles, Arthur Mensch, Chris Bamford, Devendra Singh Chaplot, Diego de las Casas, Florian Bressand, Gianna Lengyel, Guillaume Lample, Lucile Saulnier, Lélio Renard Lavaud, Marie-Anne Lachaux, Pierre Stock, Teven Le Scao, Thibaut Lavril, Thomas Wang, Timothée Lacroix, William El Sayed (2023). Mistral 7B. arXiv:2310.06825v1. https://arxiv.org/abs/2310.06825v1

**BibTeX**

```
@misc{jiang2023mistral,
  title = {{Mistral 7B}},
  author = {Albert Q. Jiang and Alexandre Sablayrolles and Arthur Mensch and Chris Bamford and Devendra Singh Chaplot and Diego de las Casas and Florian Bressand and Gianna Lengyel and Guillaume Lample and Lucile Saulnier and Lélio Renard Lavaud and Marie-Anne Lachaux and Pierre Stock and Teven Le Scao and Thibaut Lavril and Thomas Wang and Timothée Lacroix and William El Sayed},
  year = {2023},
  eprint = {2310.06825},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2310.06825v1}
}
```

## 이 논문의 용어

- [GSM8K](https://refivu.com/terms/e48f0e01064d-gsm8k)
- [MMLU](https://refivu.com/terms/3036c0ba5adb-mmlu)
- [Grouped-query attention](https://refivu.com/terms/d8b75471c6ff-grouped-query-attention)
- [Mistral 7B](https://refivu.com/terms/1de978094d66-mistral-7b)
- [self-reflection](https://refivu.com/terms/ec2eecd4bb17-self-reflection)
- [Sliding Window Attention](https://refivu.com/terms/a1fdfbb70b17-sliding-window-attention)
- [Instruction Finetuning](https://refivu.com/terms/54424cda656f-instruction-finetuning)
- [system prompt](https://refivu.com/terms/a9b42fb0a4c5-system-prompt)

## 다른 논문 해설

- [Scaling Laws for Neural Language Models](https://refivu.com/papers/0b00379f-9c4e-4d81-be48-4963190a673b-scaling-laws-for-neural-language-models.md)
- [Language Models are Few-Shot Learners](https://refivu.com/papers/82602214-e941-40a1-bc42-5b92c1268a53-language-models-are-few-shot-learners.md)
- [RoBERTa: A Robustly Optimized BERT Pretraining Approach](https://refivu.com/papers/3dc17b50-5c0f-4503-a368-4b0d9e86745c-roberta-a-robustly-optimized-bert-pretraining-approach.md)
- [HyperCLOVA X THINK Technical Report](https://refivu.com/papers/65985bb3-f3b5-458a-83af-6011ecf92927-hyperclova-x-think-technical-report.md)
- [LoRA: Low-Rank Adaptation of Large Language Models](https://refivu.com/papers/fec4f8e4-2771-4948-a986-0295db47b321-lora-low-rank-adaptation-of-large-language-models.md)
- [To Believe or Not to Believe Your LLM: Iterative Prompting for Estimating Epistemic Uncertainty](https://refivu.com/papers/b71ecca0-59f2-4260-b74f-1c35839640b8-to-believe-or-not-to-believe-your-llm.md)
- [High-Resolution Image Synthesis with Latent Diffusion Models](https://refivu.com/papers/33bd1500-c829-47e5-9545-ad078523241e-high-resolution-image-synthesis-with-latent-diffusion-models.md)
- [Omni-IO Skills: Harnessing Your Agent Omni-Native](https://refivu.com/papers/c9256504-03a5-48bb-be13-10d8a0c09d49-omni-io-skills-harnessing-your-agent-omni-native.md)
- [The Teacher Is a Direction, Not a Destination: Extrapolating RL-Induced Representation Residuals in On-Policy Distillation](https://refivu.com/papers/1d497c5b-d41a-4b43-93f8-65a49493ae1a-the-teacher-is-a-direction-not-a-destination.md)
- [Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer](https://refivu.com/papers/d6599844-fea7-4829-8f9f-c8bdc6543855-exploring-the-limits-of-transfer-learning-with-a.md)
- [False Frontiers: Diagnosing and Mitigating Co-Cheating in Self-Evolving Search Agents](https://refivu.com/papers/dcdca6b8-7069-4716-9b3d-33367227f5a0-false-frontiers-diagnosing-and-mitigating-co-cheating-in.md)
- [Generative Adversarial Networks](https://refivu.com/papers/b0edf89c-f6c4-4cce-9c25-eccaea8dcfc9-generative-adversarial-networks.md)

---

AI 해설에는 오류가 있을 수 있습니다. [Refivu](https://refivu.com/papers/9993f1cb-8618-4aeb-9dc5-d4a5aa598381-mistral-7b)
