特别引人注目的是它出色的数学推理能力。在由美国数学协会 (MAA) 主办的美国数学竞赛 (AMC) 中,Phi-4 在需要逻辑思维的问题上表现优于大型模型,例如解决复杂方程和数学证明。
这一结果显示了在科学研究、工程和金融建模等需要准确数值计算的领域中的应用潜力。
Phi-4 基准测试结果如下:
此外,Phi-4 的架构和训练过程非常强调精确性和效率。其 140 亿参数的解码器仅模型是在总计 9.8 万亿个来自协调和合成数据集的标记上进行训练的。
在训练方法方面,微软团队使用了监督微调和直接偏好优化(DPO)方法,以确保稳固的性能并解决公平性和稳定性等问题。
微软强调,Phi-4 的训练过程考虑了负责任的人工智能发展,并经过广泛的安全评估,包括攻击测试,以降低偏见、有害内容和虚假信息的风险。
Hugging Face 中的模型相当大,约 30GB,在我的机器上运行有点困难。
我在想是否可以通过应用 4 位量化或其他方法让它在我的机器上运行,我发现 Ollama 有一个已经量化到 Q4_K_M 的模型,因此我非常感激能够借用它,并想分享我在使用过程中记录的工作笔记。
ollamarunphi4
注意:当下载的模型扩展到内存中时,大小会略超过10GB,因此如果您在CPU上运行它,您需要至少有那么多的可用内存空间;如果您在GPU上运行它,您需要至少那么多的GPU内存,否则会出现错误。
如果模型成功下载,您应该会看到以下提示:
>>>Sendamessage(/?forhelp)
当您看到这个提示时,尝试发送一条消息。如果您使用的是GPU加速环境,您可能会很快得到响应。
>>>Hello!
Hello! Please let me know how I can assist you. If you haveanyquestions, feel free to ask.
>>>Send a message (/?forhelp)有了这个,我现在可以在本地使用Phi-4了!这非常有帮助。
现在,您可以使用Ollama轻松地在自己的机器上运行Phi-4!它甚至带有REST API!
这意味着具有相当于大约70B参数的LLM性能的模型可以在便携式PC上运行,而Ollama的REST API功能可以快速设置一个环境,以便可以从其他应用程序和库本地调用它。我期待在未来以各种方式利用这一点。
让我们比较 o1 和GPT-4o,并验证 Phi-4 的性能。
接下来,我想提出一些应用问题,并验证结果是否与 LLMs GPT-4o 和 o1 的结果不同,以及它们是否更简单。
需要检查的应用问题如下:
问题 1:将测试你的准确性、简洁性和响应时间。
问题 2:将测试你计算利率的准确性。
问题 3:将测试你的几何推理能力。
接下来,让我们尝试解决这个问题,并在提示中输入以下内容:
The sequence givenisthe Fibonacci sequence, where each termisthesumof the two preceding ones, startingwith1and1.The first few terms are:
( F_1 =1)
( F_2 =1)
( F_3 = F_1 + F_2 =1+1=2)
( F_4 = F_2 + F_3 =1+2=3)
( F_5 = F_3 + F_4 =2+3=5)
( F_6 = F_4 + F_5 =3+5=8)
We need to find the 20th term, ( F_{20} ).
Continuing the sequence:
( F_7 = F_5 + F_6 =5+8=13)
( F_8 = F_6 + F_7 =8+13=21)
( F_9 = F_7 + F_8 =13+21=34)
( F_{10} = F_8 + F_9 =21+34=55)
( F_{11} = F_9 + F_{10} =34+55=89)
( F_{12} = F_{10} + F_{11} =55+89=144)
( F_{13} = F_{11} + F_{12} =89+144=233)
( F_{14} = F_{12} + F_{13} =144+233=377)
( F_{15} = F_{13} + F_{14} =233+377=610)
( F_{16} = F_{14} + F_{15} =377+610=987)
( F_{17} = F_{15} + F_{16} =610+987=1597)
( F_{18} = F_{16} + F_{17} =987+1597=2584)
( F_{19} = F_{17} + F_{18} =1597+2584=4181)
( F_{20} = F_{18} + F_{19} =2584+4181=6765)
Thus, the 20th value of the sequenceis( \boxed{6765} ).给定的序列是斐波那契数列,其中每个项是前两个项的和,从1和1开始。前几个项是:
( F_1 =1)
( F_2 =1)
( F_3 = F_1 + F_2 =1+1=2)
( F_4 = F_2 + F_3 =1+2=3)
( F_5 = F_3 + F_4 =2+3=5)
( F_6 = F_4 + F_5 =3+5=8)
我们需要找到第20项,( F_{20} )。
继续序列:
( F_7 = F_5 + F_6 =5+8=13)
( F_8 = F_6 + F_7 =8+13=21)
( F_9 = F_7 + F_8 =13+21=34)
( F_{10} = F_8 + F_9 =21+34=55)
( F_{11} = F_9 + F_{10} =34+55=89)
( F_{12} = F_{10} + F_{11} =55+89=144)
( F_{13} = F_{11} + F_{12} =89+144=233)
( F_{14} = F_{12} + F_{13} =144+233=377)
( F_{15} = F_{13} + F_{14} =233+377=610)
( F_{16} = F_{14} + F_{15} =377+610=987)
( F_{17} = F_{15} + F_{16} =610+987=1597)
( F_{18} = F_{16} + F_{17} =987+1597=2584)
( F_{19} = F_{17} + F_{18} =1597+2584=4181)
( F_{20} = F_{18} + F_{19} =2584+4181=6765)
因此,序列的第20个值是 ( \boxed{6765} )。给定的序列是**斐波那契数列**,其中每个项是前两项的和:
\[F(n) = F(n-1) + F(n-2) \quad \text{当 } n \geq3\]
且 \( F(1) =1\) 和 \( F(2) =1\)。
我们需要计算这个序列的**第20个值**。
前几项是:
1.\( F(1) =1\)
2.\( F(2) =1\)
3.\( F(3) =2\)
4.\( F(4) =3\)
5.\( F(5) =5\)
6.\( F(6) =8\)
7.\( F(7) =13\)
8.\( F(8) =21\)
9.\( F(9) =34\)
10.\( F(10) =55\)
11.\( F(11) =89\)
12.\( F(12) =144\)
13.\( F(13) =233\)
14.\( F(14) =377\)
15.\( F(15) =610\)
16.\( F(16) =987\)
17.\( F(17) =1597\)
18.\( F(18) =2584\)
19.\( F(19) =4181\)
20.\( F(20) =6765\)
因此,序列中的第20个值是:6765The given sequenceisthe Fibonacci sequence, defined by:
\[F_1 =1, \quad F_2 =1, \quad \text{and} \quad F_{n} = F_{n-1} + F_{n-2} \text{for} n >2.\]
To find the 20th term, let's list them out (or recall the known values):
1. \( F_1 = 1 \)
2. \( F_2 = 1 \)
3. \( F_3 = 2 \)
4. \( F_4 = 3 \)
5. \( F_5 = 5 \)
6. \( F_6 = 8 \)
7. \( F_7 = 13 \)
8. \( F_8 = 21 \)
9. \( F_9 = 34 \)
10. \( F_{10} = 55 \)
11. \( F_{11} = 89 \)
12. \( F_{12} = 144 \)
13. \( F_{13} = 233 \)
14. \( F_{14} = 377 \)
15. \( F_{15} = 610 \)
16. \( F_{16} = 987 \)
17. \( F_{17} = 1597 \)
18. \( F_{18} = 2584 \)
19. \( F_{19} = 4181 \)
20. \( F_{20} = 6765 \)
Therefore, the 20th value in the sequence is: 6765所有模型都能给出正确答案,但Phi-4的解法适合没有强数学背景的人。得到答案所需的时间差别不大。
让我们尝试解决第二个问题,并在您的聊天机器人中使用这个提示
A bank offers an annual interest rate of5%, compounded semi-annually.
Whatisthe final amountif1million dollarisdepositedfor10years?To calculate the final amount when interestiscompounded semi-annually, we can use the compound interest formula:
[ A = P \left(1+ \frac{r}{n}\right)^{nt} ]
where:
( A )isthe final amount
( P )isthe principal amount (initial deposit)
( r )isthe annual interest rate (indecimal form)
( n )isthe number of times the interestiscompounded per year
( t )isthe number of years
For this problem:
( P =1,000,000) dollars
( r =0.05) (5%asa decimal)
( n =2) (compounded semi-annually)
( t =10) years
Plugging the values into the formula:
[ A =1,000,000\left(1+ \frac{0.05}{2}\right)^{2\times10} ]
[ A =1,000,000\left(1+0.025\right)^{20} ]
[ A =1,000,000\times (1.025)^{20} ]
Now, calculate ( (1.025)^{20} ):
[ (1.025)^{20} \approx1.638616]
Therefore:
[ A \approx1,000,000\times1.638616]
[ A \approx1,638,616]
The final amount after10yearsisapproximately $1,638,616.要计算复利的最终金额,可以使用以下公式:
\[ A = P \left(1+ \frac{r}{n}\right)^{nt} \]
其中:
- \( A \) 是最终金额,
- \( P \) 是本金(初始存款),
- \( r \) 是年名义利率(以小数表示),
- \( n \) 是每年复利的次数,
- \( t \) 是年数。
给定:
- \( P =1,000,000\) 美元,
- \( r =0.05\)(5%),
- \( n =2\)(因为利息是半年复利),
- \( t =10\)。
将这些值代入公式:
\[ A =1,000,000\left(1+ \frac{0.05}{2}\right)^{2\times10} \]
\[ A =1,000,000\left(1+0.025\right)^{20} \]
\[ A =1,000,000\times (1.025)^{20} \]
现在计算 \( (1.025)^{20} \):
\[ (1.025)^{20} \approx1.6386164403\]
现在找到最终金额 \( A \):
\[ A \approx1,000,000\times1.6386164403\]
\[ A \approx1,638,616.44\]
10年后的最终金额将约为 \$1,638,616.44。要计算一个 \$1,000,000存款在年利率为5%、每年复利两次的情况下,经过10年后的最终金额,可以使用复利公式:
\[
A = P \left(1+ \frac{r}{n}\right)^{nt}
\]
其中:
- \( A \) = n 年后累积的金额,包括利息。
- \( P \) = 本金 (\$1,000,000)。
- \( r \) = 年利率(小数)(5% 或0.05)。
- \( n \) = 每年复利的次数(每年两次为2)。
- \( t \) = 投资的年数(10年)。
代入数值:
\[
A =1,000,000\times \left(1+ \frac{0.05}{2}\right)^{2\times10} =1,000,000\times (1.025)^{20}
\]
计算 \( (1.025)^{20} \):
\[
(1.025)^{20} \approx1.63862
\]
现在,将其乘以本金:
\[
A \approx1,000,000\times1.63862=1,638,620
\]
**最终金额:**经过10年,投资将增长到大约 **\$1,638,620**。最后,我们将测试几何推理能力的测试。请在您的聊天机器人中使用此提示
If the volume of a rectangular prismis120cubic centimetres,
its heightis6cm,andits widthis4cm, whatisits length?要找到矩形棱柱的长度,我们可以使用矩形棱柱体积的公式:
[ \text{Volume} = \text{Length} \times \text{Width} \times \text{Height} ]
已知:
体积 =120立方厘米
高度 =6cm
宽度 =4cm
将已知值代入公式:
[120= \text{Length} \times4\times6]
简化方程:
[120= \text{Length} \times24]
要解出长度,将两边都除以24:
[ \text{Length} = \frac{120}{24} ]
计算除法:
[ \text{Length} =5]
因此,矩形棱柱的长度为5cm。To find the length of the rectangular prism, you can use the formulaforthe volume of a rectangular prism:
\[ \text{Volume} = \text{length} \times \text{width} \times \text{height} \]
You are given the volume (120cubic centimeters), the height (6cm),andthe width (4cm). Plug these values into the formula:
\[120= \text{length} \times4\times6\]
First, calculate \(4\times6\):
\[120= \text{length} \times24\]
Next, solveforthe length by dividing both sides of the equation by24:
\[ \text{length} = \frac{120}{24} \]
\[ \text{length} =5\]
Thus, the length of the rectangular prismis5centimeters.要找到矩形棱柱的**长度**,可以使用矩形棱柱体积的公式:
\[
\text{体积} = \text{长度} \times \text{宽度} \times \text{高度}
\]
给定:
- **体积 (V)** =120立方厘米 (cm³)
- **高度 (h)** =6厘米 (cm)
- **宽度 (w)** =4厘米 (cm)
**步骤1:写下包含已知值的公式。**
\[
120= \text{长度} \times4\times6
\]
**步骤2:简化方程以求解长度。**
\[
\text{长度} = \frac{120}{4\times6}
\]
\[
\text{长度} = \frac{120}{24}
\]
\[
\text{长度} =5\text{ cm}
\]
**答案:** 矩形棱柱的长度是**5厘米**。所有模型都给出了正确的结果,但O1和Phi-4在推理方面更优秀。它们逐步解决问题,就像人类思考一样。我很惊讶GPT-4o在推理方面不如O1和Phi-4。
我比较了Phi-4与GPT-4o和O1,发现速度几乎相同。Phi-4是开源的,我更喜欢开源而不是GPT-4o和O1。尽管O1速度更快、性能更好,但我还是选择了Phi-4。我认为Phi-4与其他模型之间没有太大差别,而且Phi-4足够小,可以在我的笔记本电脑上运行,这一点非常重要,因为我没有一台强大的计算机。
| 欢迎光临 链载Ai (https://www.lianzai.com/) | Powered by Discuz! X3.5 |