LLaMA 3
当前最强大的开源大模型之一
模型概述
LLaMA 3于2024年4月发布,使用了15T tokens训练数据,是LLaMA 2的7倍, 在各方面性能都有显著提升,被誉为开源模型的新标杆。
LLaMA 3 8B
- • 8K上下文窗口
- • 15T训练tokens
- • 消费级GPU可运行
LLaMA 3 70B
- • 8K上下文窗口
- • 性能接近GPT-4
- • 支持多语言
核心改进
训练数据量提升
从2T增加到15T tokens,数据质量更高
上下文窗口扩大
从4K扩展到8K tokens
词表扩充
词表从32K增加到128K,多语言支持更好
GQA全面采用
所有版本都使用Grouped Query Attention
性能对比
| 基准 | LLaMA 3 8B | LLaMA 2 13B | LLaMA 3 70B |
|---|---|---|---|
| MMLU | 66.6 | 54.8 | 79.5 |
| HumanEval | 62.2 | 18.9 | 81.7 |
| GSM8K | 79.0 | 28.7 | 93.0 |
| MATH | 30.0 | 6.2 | 50.4 |
Instruct版本
LLaMA 3 Instruct经过指令微调,对话能力强,安全性好:
# 对话格式
<|begin_of_text|><|start_header_id|>user<|end_header_id|>
{user_message}
<|eot_id|><|start_header_id|>assistant<|end_header_id|>
使用方式
# Hugging Face
from transformers import AutoModelForCausalLM
model = AutoModelForCausalLM.from_pretrained(
"meta-llama/Meta-Llama-3-8B-Instruct"
)
# Ollama
ollama run llama3
----