Llama 3.1 405B与GPT-4o:哪个型号更好?

2024年08月13日 由 alex 发表 106 0

简介

为了从实际使用的角度比较 Llama-3.1-405B 和 GPT-4o 的优势和智能,本文设计了涵盖数学、编码、工具使用、JSON 提取和创意写作五个场景的测试用例。我们对最强的开源模型和闭源模型进行了对比测试。


Llama 3.1 模型简介

7 月 24 日,Meta 正式开源了 Llama 3.1,其中包括带有 8B、70B 和 405B 参数的版本。三种型号的具体信息详见下表。除了 BF16 精度外,405B 型号还有 FP8 量化版本。8B 版本开源了一个额外的内容安全分类调整模型 Llama-Guard-3-8B。这些模型支持 128k 上下文,精通八种语言,包括英语、德语和法语。Llama 3.1 的训练过程包括两个关键阶段:预训练和后训练。在预训练阶段,Llama 3.1 使用定制的 GPU 集群对超过 15 万亿个词块进行了训练。后训练阶段包括监督微调 (SFT)、拒绝采样和直接偏好优化 (DPO)。


2


值得注意的是,SFT 阶段利用高质量的合成数据来提高模型在编码、数学推理和工具使用方面的能力。


3


Llama 3.1 与 Llama 3 对比

从有关 Llama 3.1 和 Llama 3 的论文中可以看出,Llama 3.1 有了显著的改进。3.1 8B 模型在数学和编码方面优于之前的 70B 模型。


4


Llama 3.1 vs GPT-4o vs Claude 3.5 Sonnet

我们在 50 多个数据集上测试了 Llama 3.1 模型的有效性,并进行了人工评估。实验表明,最大的 405B 模型与业界最好的闭源模型(如 GPT-4、GPT-4o 和 Claude 3.5 Sonnet)性能相当。较小的 8B 和 70B 模型也能与参数大小相似的闭源模型相媲美。


基准测试表明,Meta Llama 3.1 在 GSM8K、Hellaswag、boolq、MMLU-humanities、MMLU-other、MMLU-stem 和 winograd 等多项测试中的表现均优于 GPT-4o。但在 HumanEval 和 MMLU-social sciences 中,它落后于 GPT-4o。


5


这些结果来自 Llama 3.1 的基础模型,表明通过进一步微调和优化,该模型的潜力可以进一步释放,有可能在上述基准测试中实现更高的性能。


6


7


8


数学能力比较

为了测试数学能力,我们使用了一个流行的问题: "9.9和9.11哪个大?"来评估模型。此外,我们还设计了一个综合函数计算问题来评估它们的性能。在比较 9.9 和 9.11 时,Llama 3.1 405B 错误地回答 9.11 大于 9.9,而 GPT-4o 则回答正确。在综合函数计算中,两个模型都准确地计算出了结果,并提供了清晰的步骤。


9.11 和 9.9 哪个更大?

首先,我们通过询问 9.9 和 9.11 哪个更大来测试模型?Llama-3.1-405B-Instruct 错误地判断出 9.11 大于 9.9,而 GPT-4o 则回答正确。


提示:


Which is larger, 9.11 or 9.9?is larger, 9.11 or 9.9?


9


为什么模型经常在数学问题上出错?一个重要原因是大型模型在标记化阶段没有正确标记数字。像 9.11 和 9.9 这样的数字会被分割成各个数位和小数点。例如,9.11 可能被标记为三个标记: 9"、". "和 "11",而 9.9 可能会被标记为三个标记符: 9"、". "和 "9"。这种错误的标记化会导致模型错误地比较 11 和 9,从而得出 9.11 大于 9.9 的结论。


复合函数计算

接下来,我们测试了模型计算复合函数的能力。在我们的测试问题中,Llama 3.1 405B Instruct 和 GPT-4o 都正确计算了复合函数的值。他们的回答包括准确而清晰的步骤。


提示:


Given the functions \( f(x) = x^2 + 2x + 1 \) and \( g(x) = \sqrt{x} + 3 \), compute the composite function \( f(g(x)) \), i.e., \( f(g(x)) \). Find the value of the composite function \( f(g(x)) \) at \( x = 1 \).f(x) = x^2 + 2x + 1 \) and \( g(x) = \sqrt{x} + 3 \), compute the composite function \( f(g(x)) \), i.e., \( f(g(x)) \). Find the value of the composite function \( f(g(x)) \) at \( x = 1 \).


10


代码生成能力:编写俄罗斯方块游戏

为了评估代码生成能力,我们选择了俄罗斯方块游戏作为测试案例,以检验生成代码的完整性和准确性。根据执行结果,Llama 3.1 无法在一次尝试中生成足够完整的游戏逻辑。方块下落的速度太快,无法移动或旋转,导致游戏虽然在技术上可以运行,但无法玩。相比之下,GPT-4o 的游戏程序运行得非常完美。


提示:


Write a python Tetris gamea python Tetris game


11


12


工具利用能力

通过调用外部工具,大型模型可以执行更复杂、更多样的任务。在此,我们设计了两个测试问题,以评估模型通过调用工具解决数学问题的能力。结论是,Llama 3.1 405B Instruct 和 GPT-4o 在调用单个工具时都能准确确定函数和参数值。但是,在解决需要使用多个函数的问题时,特别是当第二个函数需要第一个函数的值时,就会出现错误。


1. 调用函数计算阶乘

在第一个测试问题中,我们设置了三个函数:计算阶乘、求两个数的最大公约数(GCD)和确定一个数是否是质数。我们要求模型计算 10 和 8 的阶乘。Llama 3.1 405B Instruct 和 GPT-4o 都能准确调用正确的工具并提供参数值。


Llama 3.1 405B Instruct 的回答更为精确,提供了明确的参数名称和参数值,而 GPT-4o 则直接提供了参数值。在分配多个参数时,Llama 3.1 的这种方法更为准确。


提示:


Write "Action:", followed by the list of actions you want to call, in the following format:"Action:", followed by the list of actions you want to call, in the following format:
Action:
'''
[
    {
        "tool_name": "Tool name (choose from [calculate_factorial, calculate_gcd, is_prime])",
        "parameters": "Input parameters for the tool"
    }
]
'''
Please help me calculate the factorial of 10 and 8.


13


2.调用函数计算阶乘和最大公约数

在第一个测试问题的基础上,我们增加了难度,要求模型在计算阶乘后找出最大公约数(GCD)。Llama 3.1 405B Instruct 和 GPT-4o 都能分解任务,首先调用阶乘函数,然后调用 GCD 函数。不过,这两个模型都出现了错误,未能准确地将 10 和 8 的阶乘值作为参数传递给 GCD 函数。


提示:


Write "Action:", followed by the list of actions you want to call, in the following format:"Action:", followed by the list of actions you want to call, in the following format:
Action:
'''
[
    {
        "tool_name": "Tool name (choose from [calculate_factorial, calculate_gcd, is_prime])",
        "parameters": "Input parameters for the tool"
    }
]
'''
Please help me calculate the factorial of 10 and 8, and then further find their greatest common divisor (GCD).


14


JSON 信息提取功能

JSON 信息提取在智能客户服务系统等场景中的应用至关重要,在这些场景中,需要从用户查询中提取产品名称和问题类型等关键信息,并以 JSON 格式输出,以便后续处理和响应。我设计了两个问题:从给定文本中提取公司名称和地址等信息;提取医学术语、实体和关系。结果表明,Llama 3.1 405B Instruct 和 GPT-4o 在提取关键信息方面都很出色。不过,GPT-4o 在提取实体和关系方面更为准确和清晰。


关键信息提取

在从文本中提取公司名称、成立年份、地址和其他信息时,Llama 3.1 405B Instruct 和 GPT-4o 的表现同样出色,都能准确、清晰地提取关键信息。


提示:


Please extract the key information from the following text and output it in JSON format, including the following fields: Company Name, Year of Establishment, Headquarters Address, Main Business Areas, Number of Employees, Percentage of R&D Personnel, Annual Revenue, Contact Phone Number, and Email Address.key information from the following text and output it in JSON format, including the following fields: Company Name, Year of Establishment, Headquarters Address, Main Business Areas, Number of Employees, Percentage of R&D Personnel, Annual Revenue, Contact Phone Number, and Email Address.
Tech Innovation Co., Ltd. was established in 2010 and is headquartered in the Timezone Technology Park in Melbourne. The company focuses on the fields of artificial intelligence and big data, with main businesses including the research and application of technologies such as intelligent speech recognition, computer vision, and natural language processing. Currently, it has more than 500 employees, with R&D personnel accounting for 70%. The company's annual revenue is approximately 200 million AUD, making it a leader in the industry. Contact information: phone 09812345678, email info@techcompany.com.


15


医学实体提取

大型模型与知识图谱相结合,可广泛应用于医疗场景。例如,大型模型可以提高构建知识图谱的效率。在此,我们将测试模型在从病人诊断信息中提取专业术语、实体和关系方面的性能。


结果表明,Llama 3.1 405B Instruct 在提取专业术语方面表现良好,但在提取实体和关系方面有些模糊。它提取的实体较少,而且包括一些相关性较低的实体,如 "医生 "和 "医院"。另一方面,GPT-4o 在构建信息结构和提取关系方面表现出色,能更好地将文本信息组织成清晰的 JSON 格式。


提示:


From the following text, extract professional terms, entities, and relationships, and output in JSON format:
The patient Wang, male, 45 years old, was admitted to the hospital due to persistent chest pain for 3 days. He has a 5-year history of type 2 diabetes and is currently taking metformin to control his blood sugar. Physical examination shows blood pressure of 140/90 mmHg. The ECG indicates ST-segment elevation. Laboratory tests show elevated troponin I. The diagnosis is acute ST-segment elevation myocardial infarction (anterior wall). Aspirin and clopidogrel were administered for antiplatelet therapy, and percutaneous coronary intervention (PCI) was performed. After surgery, the symptoms were relieved, and the patient's condition stabilized.


16


创意写作能力

为了比较 Llama 3.1 405B Instruct 和 GPT-4o 的创意写作能力,我们分析了它们对阿尔卑斯山日出的描述。在这次写作测试中,Llama 3.1 和 GPT-4o 都表现出了良好的描述能力。不过,GPT-4o 提供了更丰富、更详细的描述。


提示:


Description of the sunrise scenery in the Alps


17


结论

总之,本研究比较了开源的 Llama-3.1-405B 和专有的 GPT-4o 模型在五个场景中的表现:数学、代码生成、工具调用、JSON 信息提取和创意写作。虽然 Llama-3.1-405B 是目前最强的开源模型,但在整体性能上与 GPT-4o 相比略有不足。对于消费者和普通用户来说,GPT-4o 是更优越的选择,因为它对本地使用的硬件要求较低,而且具有完善的产品体验,包括先进的视觉和语音功能。Llama-3.1-405B 则更具学术性和原始性,更适合作为进一步开发和定制的基础模型。相比之下,GPT-4o 是一款成熟、稳定、功能强大的开箱即用产品,是大多数实际应用的首选。

文章来源:https://medium.com/@researchgraph/llama-3-1-405b-vs-gpt-4o-which-model-is-better-659662234b3e
欢迎关注ATYUN官方公众号
商务合作及内容投稿请联系邮箱:bd@atyun.com
评论 登录
热门职位
Maluuba
20000~40000/月
Cisco
25000~30000/月 深圳市
PilotAILabs
30000~60000/年 深圳市
写评论取消
回复取消