模型选择
本指南将探讨性能和成本的权衡,并讨论如何为不同的用例选择合适的模型。我们将深入研究需要考虑的各种因素,为您选择满足特定需求的正确模型提供指导。
如今,Mistral 模型已成为许多规模化 LLM 应用的基石。以下是我们常见的一些用例类型及其相应的 Mistral 模型概览:
- Mistral Nemo 可以支持批量处理的简单任务(分类、客户支持或文本生成)。
- 需要适度推理的中间任务(数据提取、文档摘要、撰写电子邮件、撰写职位描述或撰写产品描述)由 Mistral Small 支持。
- 需要强大推理能力或高度专业化的复杂任务(合成文本生成、代码生成、RAG 或代理)由 Mistral Large 支持。
我们较旧的模型目前可以由我们最新的高质量模型取代。如果您正在考虑升级,以下是一些可能对您有所帮助的一般性建议:
- Mistral Nemo 目前优于 Mistral 7B,且更具成本效益。
- Mistral Small 目前优于 Mixtral 8x7B,且更具成本效益。
- Mistral Large 目前优于 Mixtral 8x22B,同时保持相同的价格比。
性能和成本权衡
在选择模型时,评估性能和成本权衡至关重要。根据您的应用最重要的因素,您的选择可能会有很大差异。请注意,模型会随时间更新,下面分享的信息仅反映模型的当前状态。
值得注意的是,Mistral Large v2 目前在几乎所有基准测试中都优于我们所有其他模型。通过考虑性能、速度和成本详情,希望您能找到最适合您应用需求的模型。
一般而言,如果您是大型语言模型的新手,始终可以先从 Mistral Large 开始。这将使您能够评估其成本和性能,并确定是否需要降级到 Mistral Small 甚至 Mistral Nemo。如果您已经在使用其他大型语言模型并正在寻找替代一个特别强大的模型,那么 Mistral Large 可能是您的最佳选择。
用例
Mistral Nemo:可批量处理的简单任务
Mistral Nemo 是处理批量简单任务(如分类、客户支持或文本生成)的理想选择。它以可承受的价格提供出色的性能。例如,它可以有效地用于分类任务,以判断电子邮件是否是垃圾邮件。
提示
Classify the following email to determine if it is spam or not. Only respond with the exact words "Spam" or "Not spam".
🎉 Urgent! You've Won a $1,000,000 Cash Prize! 💰 To claim your prize, please click on the link below: https://bit.ly/claim-your-prize
我们所有的模型都可以准确地将这封电子邮件正确分类为“垃圾邮件”。Mistral Nemo 能够像更大的模型一样提供正确的分类。因此,对于此类任务而言,它是最有效且最经济实惠的选择。
Mistral Small:需要语言转换的中间任务
Mistral Small 是需要适度推理的中间任务的理想选择,例如数据提取、文档摘要、撰写职位描述或撰写产品描述。Mistral Small 在性能和能力之间取得了平衡,使其适用于仅需要语言转换的广泛任务。例如,Mistral Small 可以撰写电子邮件。
提示
Compose a welcome email for new customers who have just made their first purchase with your product.
Start by expressing your gratitude for their business, and then convey your excitement for having them as a customer.
Include relevant details about their recent order. Sign the email with "The Fun Shop Team".
Order details:
- Customer name: Anna
- Product: hat
- Estimate date of delivery: Feb. 25, 2024
- Return policy: 30 days
输出
Subject: Welcome to The Fun Shop, Anna! Your Hat is on its Way!
Dear Anna,
We hope this message finds you well. We are thrilled to welcome you to The Fun Shop family! We are incredibly grateful for your business and are excited to have you as our new customer.
We are processing your recent order for the fabulous hat you've selected. Your new accessory is set to be delivered by Feb. 25, 2024. We hope it arrives just in time to add a touch of fun and style to your outfits!
Please remember that our return policy allows you to return any item within 30 days of receipt if you are not completely satisfied. We want you to love every item you purchase from us, so if there's any issue, please don't hesitate to reach out.
Thank you once again for choosing The Fun Shop. We look forward to serving you and making your shopping experience a fun and enjoyable one!
Best Regards,
The Fun Shop Team
Mistral Large:需要强大推理能力或高度专业化的复杂任务
Mistral Large 是需要强大推理能力或高度专业化的复杂任务(如合成文本生成、代码生成、RAG 或代理)的理想选择。
- 复杂推理
Mistral Large 在常识和推理基准测试中优于我们其他四个模型,使其成为复杂推理任务的最佳选择。
在此示例中,我们要求 Mistral Large 计算给定数据集中付款金额最接近的两位客户之间付款日期的差异。Mistral Large 可以轻松自动地将问题分解为更小的步骤:识别两个最接近的付款金额,找到各自的付款日期,然后计算日期差异。Mistral Large 是需要复杂推理和解决问题能力的任务的绝佳选择。
提示
Calculate the difference in payment dates between the two customers whose payment amounts are closest to each other in the given dataset:
'{
"transaction_id":{"0":"T1001","1":"T1002","2":"T1003","3":"T1004","4":"T1005"},
"customer_id":{"0":"C001","1":"C002","2":"C003","3":"C002","4":"C001"},
"payment_amount":{"0":125.5,"1":89.99,"2":120.0,"3":54.3,"4":210.2},
"payment_date":{"0":"2021-10-05","1":"2021-10-06","2":"2021-10-07","3":"2021-10-05","4":"2021-10-08"},
"payment_status":{"0":"Paid","1":"Unpaid","2":"Paid","3":"Paid","4":"Pending"}
}'
输出
To find the difference in payment dates between the two customers whose payment amounts are closest to each other, we first need to identify the two closest payment amounts and then find their respective payment dates.
The payment amounts are: 125.5, 89.99, 120.0, 54.3, 210.2
The two closest payment amounts are 125.5 and 120.0. The payment date for the payment amount 125.5 is '2021-10-05' and for the payment amount 120.0 is '2021-10-07'.
The difference in payment dates can be calculated as follows:
Date difference = |'2021-10-07' - '2021-10-05'| = 2 days
So, the difference in payment dates between the two customers whose payment amounts are closest to each other is 2 days.
让我们再试一个我们在网上找到的需要推理和逻辑理解的提示。Mistral Large 能够正确回答。
提示
There's an apple inside a blue box. There's also a red box inside the blue box. The red box has a lid on it. How can I get the apple?
输出
You can get the apple by opening the blue box. The apple is not inside the red box, so you don't need to open the red box. Simply reach into the blue box and take the apple.
这是另一个示例。Mistral Large 能够正确回答。
提示
Which one is heavier a pound of iron or a kilogram of feather
输出
A kilogram of feathers is heavier than a pound of iron.
A pound is a unit of weight that is equivalent to approximately 0.453592 kilograms. Therefore, a pound of iron weighs less than a kilogram of feathers.
这可能看起来违反直觉,因为我们通常认为铁是重材料而羽毛是轻材料,但物体的重量取决于其质量和作用在其上的重力,而不是取决于其材料或构成。
- 编程
Mistral Large 是编程任务中的顶尖表现者,对于在模型选择中优先考虑编程能力的用户来说是理想的选择。
这是一个 Mistral Large 根据提示提供正确代码的示例。
提示
Write a function to find the maximum number of segments of lengths a, b and c that can be formed from n.
输出
# Here is a possible function in Python to find the maximum number of segments that can be formed from a given length `n` using segments of lengths `a`, `b`, and `c`:
def max_segments(n, a, b, c):
# Initialize the maximum number of segments to 0
max_num_segments = 0
# Loop through all possible combinations of segments
for i in range(n // a + 1):
for j in range(n // b + 1):
for k in range(n // c + 1):
# Check if the combination is valid and update the maximum number of segments
if i * a + j * b + k * c == n:
max_num_segments = max(max_num_segments, i + j + k)
return max_num_segments
# This function uses nested loops to generate all possible combinations of segments of lengths `a`, `b`, and `c`, respectively. For each combination, it checks if the total length of the segments is equal to `n`, and if so, it updates the maximum number of segments found so far. The function returns the maximum number of segments that can be formed from `n`.
这是另一个 Mistral Large 使用巴比伦法编写计算平方根函数的示例。
提示
You are an expert Python programmer, and here is your task: Write a function for computing square roots using the babylonian method. Your code should pass these tests:
assert math.isclose(babylonian_squareroot(10), 3.162277660168379, rel_tol=0.001)
assert math.isclose(babylonian_squareroot(2), 1.414213562373095, rel_tol=0.001)
assert math.isclose(babylonian_squareroot(9), 3.0, rel_tol=0.001)
输出
def babylonian_squareroot(number):
if(number == 0):
return 0;
g = number/2.0;
g2 = g + 1;
while(g != g2):
n = number/ g;
g2 = g;
g = (g + n)/2;
return g;"
- 多语言任务
除了在复杂推理任务和编程任务中表现出色外,Mistral Large 在处理多语言任务方面也展现出卓越的能力。Mistral-large 经过专门训练,能够理解和生成多种语言的文本,尤其是在法语、德语、西班牙语和意大利语方面。对于需要使用多种语言进行交流的企业和用户来说,Mistral Large 尤其有价值。
提示
Lequel est le plus lourd une livre de fer ou un kilogramme de plume
输出
Un kilogramme de plumes est plus lourd qu'une livre de fer.
Pour comprendre cela, il est important de se rappeler que :
1. Une livre (lb) est une unité de mesure de masse principalement utilisée aux États-Unis et dans d'autres systèmes de mesure impériaux, tandis qu'un kilogramme (kg) est l'unité de base de masse dans le système international d'unités (SI).
2. 1 kilogramme est approximativement égal à 2,2 livres.
Donc, un kilogramme de plumes est plus lourd qu'une livre de fer, car il correspond à environ 2,2 livres de plumes.