The preview of Llama3..?
์ต๊ทผ์ HuggingFace๋ฅผ ๋ณด๋ค๊ฐ ์๊ฒ ๋ ๋ชจ๋ธ์ด ํ๋ ์๋ค. ๋ฐ๋ก LLM ์์ฅ์ ๋จ๊ฒ๊ฒ ๋ฌ๊ตฐ ๋ชจ๋ธ์ธ Mistral LM์ด๋ค! ํ์ฑ์ฒ๋ผ Open-source LLM ๊ณ์ ๋ํ๋ Mistral 7B๋ ๊ทธ ๋ฑ์ฅ๋ง์ผ๋ก๋ Open-source LLM๊ณ๋ฅผ ๋จ๊ฒ๊ฒ ๋ฌ๊ตฌ์๋ค. ๊ทธ๋ ๋ค๋ฉด Mistral 7B๋ ๋ฌด์์ ์ด๋ป๊ฒ ํ๊ธธ๋ ๋ชจ๋์ ์ด๋ชฉ์ ์ง์ค์ํฌ ์ ์์๋ ๊ฒ์ผ๊น? ๊ทธ๊ฒ์ Mistral 7B๊ฐ ์ด๋ค๋ธ ์ ์ ์ ์ดํด๋ณด๋ฉด ์ ์ ์๋ค:
- ๋ชจ๋ ๋ฒค์น๋งํฌ์์ Llama2 13B๋ฅผ ๋ฅ๊ฐ
- ๋ง์ ๋ฒค์น๋งํฌ์์ Llama1 34B๋ฅผ ๋ฅ๊ฐ(๋น๊ต ๋์์ด Llama2๊ฐ ์๋๋ผ Llama1์ด์๋ ์ด์ ๋ Llama2์ 34B ๋ชจ๋ธ์ด ๊ณต๊ฐ๋์์ง ์๊ธฐ ๋๋ฌธ)
- ์ฝ๋ ๊ด๋ จ ๋ฒค์น๋งํฌ์์ CodeLlama 7B์ ์ฑ๋ฅ์ ๊ทผ์ ํ๋ฉด์, ์์ด task์ ์ฑ๋ฅ๋ ์ข๊ฒ ์ ์ง
- ๋น ๋ฅธ ์ถ๋ก ์ ์ํด Grouped-query attention(GQA)๋ฅผ ์ฌ์ฉ
- ์ ์ ๋น์ฉ์ผ๋ก ๋์ฑ ๊ธด ์ํ์ค๋ฅผ ๋ค๋ฃจ๊ธฐ ์ํด Sliding Window Attention(SWA)๋ฅผ ์ฌ์ฉ
- chat์ ์ํด fine-tune ๋ Mistral 7B ๋ชจ๋ธ์ Llama2 13B Chat์ ๋ฅ๊ฐํจ
์์ ์ ์ ๋ค๋ง ์ดํด๋ณด์๋ Mistral 7B ๋ชจ๋ธ์ ์๋นํ ์์ฒญ๋ ์ ์ฌ๋ ฅ์ ๊ฐ์ง๊ณ ์๋ค๋ ๊ฒ์ ์ ์ ์๋ค. Mistral 7B๋ ๋ง์น Llama3์ ํ๋ฆฌ๋ทฐ ๊ฐ์ ๋ชจ์ต์ ๋ณด์ฌ์คฌ๋ค. ์ด๋ฒ ํฌ์คํ ์์๋ Open-source LLM ํ์ ๋จ๊ฑฐ์ด ๊ฐ์์ธ Mistral 7B์ ๋ํด์ Mistral 7B ์๊ฐ ๋ธ๋ก๊ทธ ํฌ์คํธ๋ฅผ ํ ๋๋ก ์์๋ณด๋ ์๊ฐ์ ๊ฐ์ ธ๋ณด๋๋ก ํ๊ฒ ๋ค.
Performance in details
Mistral 7B ๋ชจ๋ธ๊ณผ Llama2 model familty, Llama1 34B model์ ์ฌ๋ฌ ๋ฒค์น๋งํฌ์์ ๋น๊ตํ ๊ฒฐ๊ณผ๋ ๋ค์๊ณผ ๊ฐ๋ค.
์์ ๊ทธ๋ํ๋ฅผ ๋ณด๋ฉด ์ ์ ์๋ฏ์ด Mistral 7B๋ ๋ ์ฌ์ด์ฆ์ Llama2 7B ๋ชจ๋ธ์ ๋ชจ๋ ๋ฒค์น๋งํฌ์์ ๋ฅ๊ฐํ๊ณ , ์ฌ์ด์ฆ๊ฐ ๋ ํฐ Llama2 13B์ Llama1 34B ๋ชจ๋ธ์ ๋นํด์๋ ๋๋ถ๋ถ์ ๋ฒค์น๋งํฌ์์ ๋ฅ๊ฐํ๋ ์ฑ๋ฅ์ ๋ณด์ฌ์ฃผ๋ ๊ฒ์ ์ ์ ์๋ค. 7B model์์๋ ๋ถ๊ตฌํ๊ณ ์ด ์ ๋์ ์ฑ๋ฅ์ ๋ณด์ฌ์ค ์๋ ์๋ค๋ ๊ฒ์ด ์ ๋ง ๋๋ผ์ด ๊ฒ ๊ฐ๋ค.
๊ทธ๋ฆฌ๊ณ Mistral ์ฐ๊ตฌํ์์๋ ํ ๊ฐ์ง ํฅ๋ฏธ๋ก์ด ํ๊ฐ๋ฅผ ์งํํ๋๋ฐ, Llama2 model์ด Mistral model๊ณผ ๋น์ทํ ์ฑ๋ฅ์ ๋ด๊ธฐ ์ํด์๋ ๋ชจ๋ธ์ ์ฌ์ด์ฆ๋ฅผ ์ผ๋ง๋ scaling up ํด์ผ ํ๋์ง๋ฅผ ํ๊ฐํ๋ "equivalent model sizes"์ด๋ค. ์ด 4๊ฐ์ ๋ฒค์น๋งํฌ์์ ์ด๋ฅผ ํ๊ฐํ์๋๋ฐ, ๊ทธ์ค MMLU, Reasoning, Comprehension์์ ๋๋ต Llama2 model์ด Mistrla 7B๋ณด๋ค 3๋ฐฐ ์ ๋ ๋ ๋ง์ ํ์ดํผํ๋ผ๋ฏธํฐ๋ฅผ ๊ฐ์ง๊ณ ์์ด์ผ ํ๋ค๋ ๊ฒ์ ๋ฐ๊ฒฌํ์๋ค.
Sliding Window Attention(SWA)
Mistral 7B๋ Sliding Window Attention(SWA) ๋ฉ์ปค๋์ฆ์ ์ฌ์ฉํ๋๋ฐ, ์ด method์์ ๊ฐ ๋ ์ด์ด๋ ์ด์ 4,096๊ฐ์ hiddent state๋ฅผ ์ฐธ์กฐํ๋ค. ์ฃผ๋ ๊ฐ์ ์ ๊ณผ ์ด method๊ฐ ์ฒ์์ ๊ณ ์๋ ์ด์ ๋ ์ ํ ๊ณ์ฐ ๋น์ฉ์ ๊ฐ์ง๊ณ ์๊ธฐ ๋๋ฌธ์ด๋ค. (O(sliding_window_length)) ์ด๋ฌํ ๋ณํ๋ FlashAttention๊ณผ xFormers๊ฐ 2๋ฐฐ ๋ ๋น ๋ฅธ ์๋๋ฅผ ๋ผ ์ ์๊ฒ ๋ง๋ค์ด์ฃผ์๋ค.
Sliding Windwo Attention์ ์๋์ฐ ์ฌ์ด์ฆ๋ฅผ ๋์ด์ ๊ณผ๊ฑฐ์ context๋ฅผ ์ฐธ์กฐํ๊ธฐ ์ํด Transformer์ stacked layer๋ฅผ ํ์ฉํ๋ค. ์ด๋ฅผ ํตํด higher layer๋ attention pattern์ด ์๋ฐํ๋ ๊ฒ๋ณด๋ค ๋ ๊ณผ๊ฑฐ์ ์ ๋ณด์ ์ ๊ทผํ ์ ์๋ค.
์ต์ข ์ ์ผ๋ก ๊ณ ์ ๋ attention span์ rotating buffer๋ฅผ ์ฌ์ฉํด์ ์บ์๋ฅผ sliding_window token ์ฌ์ด์ฆ๋ก ์ ํํ ์ ์๋ค๋ ๊ฒ์ ์๋ฏธํ๋ค. ์ด๊ฒ์ ๋ชจ๋ธ ํ๋ฆฌํฐ์ ์ํฅ์ ์ฃผ์ง ์๊ณ , 8,192์ ์ํ์ค ๊ธธ์ด์ ์ถ๋ก ์ ๋ํ ์บ์ ๋ฉ๋ชจ๋ฆฌ๋ฅผ ์ ๋ฐ์ผ๋ก ์ ์ฝํ ์ ์๊ฒ ๋ง๋ค์ด์ค๋ค.
Fine-tuning Mistral 7B for chat
Mistral 7B model์ chat์ ํนํ๋ Mistral 7B Instruct model ๋ํ ๊ณต๊ฐ๋์๋ค. ์ด Instruct model์ ์ด๋ ํ ํธ๋ฆญ๊ณผ ์์ ์ฉ ๋ฐ์ดํฐ๋ฅผ ์ฌ์ฉํ์ง ์๊ณ , HuggingFace์ ๊ณต๊ฐ์ ์ผ๋ก ๊ณต๊ฐ๋์ด ์๋ instruction dataset์์ fine-tune๋์๋ค. ์ด๋ ๊ฒ ํด์ ๋์จ Mistral 7B Instruct ๋ชจ๋ธ์ MT-Bench์์ ๋ค๋ฅธ ๋ชจ๋ 7B model๋ค์ ๋ฅ๊ฐํ์๊ณ , 13B chat model๊ณผ ๋น์ทํ ์ฑ๋ฅ์ ๋ณด์ฌ์คฌ๋ค.
The new paradigm of open-source LLM? ๐ค
์ด๋ ๊ฒ ํด์ Llama์ ์๋ก์ด open-source LLM ๋ํญ๋ง์ธ Mistral 7B์ ๋ํด์ ๊ฐ๋ตํ๊ฒ ์ดํด๋ณด์๋ค. (๋์ฑ ์์ธํ ๋ด์ฉ์ ์๊ณ ์ถ๋ค๋ฉด Misral AI์ ๋ธ๋ก๊ทธ ํฌ์คํธ๋ฅผ ํ์ธํด๋ณผ ์ ์๊ธธ ๋ฐ๋๋ค.) Mistral 7B์ ๋ฒค์น๋งํน ๊ฒฐ๊ณผ๋ฅผ ๋ณด๋ฉด ํ์คํ ์์ฒญ๋ ์ฑ๋ฅ์ ๋ณด์ฌ์ฃผ๋๋ฐ, ๋ง์น Llama3์ ๋ฏธ๋ฆฌ ๋ณด๊ธฐ ๊ฐ์ ๋๋์ ์ฃผ์๋ค. ์ด๋ฌํ ๋ถ๋ถ์ ๋ณด๋ฉด์ ํ์คํ Llama๊ฐ ๋ซ์ด๋์ open-source LLM ์์ฅ์ ์ด์ ๋ ์ฌ๋ฌ ์๋ก ๋ค๋ฅธ open-source LLM๋ค์ด ์ด ๋ถ์ผ๋ฅผ ํ์ฅ์์ผ ๋๊ฐ๋ค๊ณ ์๊ฐํ๋ค. ๋ฐ๋ผ์ ์ด์ ๋ ์์ ํ fine-tuning์ ํด์ ์๋กญ๊ฒ ๋ง๋ open-source model๋ ์ค์ํ์ง๋ง, Mistral model์ฒ๋ผ ์๋ก์ด base model์ ์ ์ํ๋ ๊ฒ๋ ์ค์ํ๋ค๊ณ ์๊ฐํ๋ค.
Proprietray model ๋งํผ์ด๋ ์ค์ํ๋ค๊ณ ์ฌ๊ฒจ์ง๋ open-source model์ ๊ฐ๋ฐํด๋๊ฐ ์ ์๋ ์ข์ ๊ธฐํ๊ฐ ๋๊ธธ ๋ฐ๋ผ๋ฉฐ ํฌ์คํ ์ ๋ง์ณ๋ณด๊ณ ์ ํ๋ค.
References
https://mistral.ai/news/announcing-mistral-7b/
Mistral 7B
The best 7B model to date, Apache 2.0
mistral.ai
HuggingFace Mistral 7B Model: https://huggingface.co/mistralai/Mistral-7B-v0.1
mistralai/Mistral-7B-v0.1 · Hugging Face
Model Card for Mistral-7B-v0.1 The Mistral-7B-v0.1 Large Language Model (LLM) is a pretrained generative text model with 7 billion parameters. Mistral-7B-v0.1 outperforms Llama 2 13B on all benchmarks we tested. For full details of this model please read o
huggingface.co
HuggingFace Mistral 7B Instruct Model: https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.1
mistralai/Mistral-7B-Instruct-v0.1 · Hugging Face
Model Card for Mistral-7B-Instruct-v0.1 The Mistral-7B-Instruct-v0.1 Large Language Model (LLM) is a instruct fine-tuned version of the Mistral-7B-v0.1 generative text model using a variety of publicly available conversation datasets. For full details of t
huggingface.co