Falcon3开放基础模型系列是一组预训练和指令调优的大型语言模型,参数规模从10亿到100亿不等。
本仓库包含Falcon3-7B-Instruct模型。该模型在推理、语言理解、指令遵循、代码和数学任务上(发布时)达到了最先进的结果。 Falcon3-7B-Instruct支持4种语言(英语、法语、西班牙语、葡萄牙语),上下文长度可达32K。
from transformers import AutoTokenizer, AutoModelForCausalLM
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "tiiuae/Falcon3-7B-Instruct"
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype="auto",
device_map="auto"]
)
tokenizer = AutoTokenizer.from_pretrained(model_name)
prompt = "How many hours in one day?"
messages = [
{"role": "system", "content": "You are a helpful friendly assistant Falcon3 from TII, try to follow instructions as much as possible."},
{"role": "user", "content": prompt}
]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
generated_ids = model.generate(
**model_inputs,
max_new_tokens=1024
)
generated_ids = [
output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
]
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
print(response)我们在下表中报告了官方HuggingFace排行榜的标准化评估结果,具体可参考Open LLM Leaderboard Evaluation Results。
| 基准测试 | Llama-3.1-8B-Instruct | Qwen2.5-7B-Instruct | Falcon3-7B-Instruct |
|---|---|---|---|
| IFEval | 78.56 | 75.85 | 76.12 |
| BBH(3-shot) | 29.89 | 34.89 | 37.92 |
| MATH Lvl-5(4-shot) | 19.34 | 0.00 | 31.87 |
| GPQA(0-shot) | 2.35 | 5.48 | 8.05 |
| MUSR(0-shot) | 8.41 | 8.45 | 21.17 |
| MMLU-PRO(5-shot) | 30.68 | 36.52 | 34.30 |
此外,我们在下表中报告了内部流水线基准测试结果。
| 类别 | 基准测试 | Llama-3.1-8B-Instruct | Qwen2.5-7B-Instruct | Falcon3-7B-Instruct |
|---|---|---|---|---|
| 通用能力 | MMLU(5-shot) | 68.2 | 73.5 | 70.5 |
| MMLU-PRO(5-shot) | 36.4 | 43.1 | 40.7 | |
| IFEval | 78.8 | 74.7 | 76.5 | |
| 数学能力 | GSM8K(5-shot) | 82.6 | 72.0 | 81.4 |
| GSM8K(8-shot,COT) | 85.4 | 76.6 | 79.7 | |
| MATH Lvl-5(4-shot) | 15.4 | - | 29.4 | |
| 推理能力 | Arc Challenge(25-shot) | 58.6 | 57.8 | 62.6 |
| GPQA(0-shot) | 33.5 | 32 | 31.9 | |
| GPQA(0-shot,COT) | 9.6 | 13.8 | 22.3 | |
| MUSR(0-shot) | 38.6 | 41 | 46.4 | |
| BBH(3-shot) | 48.6 | 54.1 | 52.4 | |
| 常识理解 | PIQA(0-shot) | 78.9 | 73.7 | 78.8 |
| SciQ(0-shot) | 80.2 | 50.9 | 94.7 | |
| Winogrande(0-shot) | - | - | 70.4 | |
| OpenbookQA(0-shot) | 46.2 | 42.4 | 45.8 | |
| 指令遵循 | MT-Bench(平均) | 7.9 | 8.5 | 8.4 |
| Alpaca(WC) | 26.6 | 31.5 | 26.1 | |
| 工具使用 | BFCL AST(平均) | 90.6 | 91.4 | 72.3 |
即将发布....
如果 Falcon3 系列对您的工作有所帮助,欢迎引用我们。
@misc{Falcon3,
title = {The Falcon 3 family of Open Models},
author = {TII Team},
month = {December},
year = {2024}
}