模型简介
模型特点
模型能力
使用案例
🚀 微软Phi - 4 - reasoning - plus的Llamacpp imatrix量化模型
本项目提供了微软Phi - 4 - reasoning - plus模型的量化版本,解决了大模型在资源有限设备上运行的难题,让用户能在不同硬件条件下高效使用该模型进行文本生成任务。
🚀 快速开始
本项目使用 llama.cpp 的 b5228 版本进行量化。原始模型可访问 这里。
你可以在 LM Studio 中运行这些量化模型,也可以直接使用 llama.cpp 或任何基于llama.cpp的项目来运行。
✨ 主要特性
- 多种量化类型:提供了丰富的量化类型供用户选择,如bf16、Q8_0、Q6_K_L等,满足不同的性能和质量需求。
- 优化嵌入/输出权重:部分量化模型(如Q3_K_XL、Q4_K_L等)将嵌入和输出权重量化为Q8_0,提升了模型性能。
- 在线重打包功能:支持Q4_0的在线重打包,可根据硬件情况自动优化权重,提高ARM和AVX机器的性能。
📦 安装指南
使用huggingface - cli下载
首先,确保你已安装huggingface - cli:
pip install -U "huggingface_hub[cli]"
然后,你可以指定要下载的特定文件:
huggingface-cli download bartowski/microsoft_Phi-4-reasoning-plus-GGUF --include "microsoft_Phi-4-reasoning-plus-Q4_K_M.gguf" --local-dir ./
如果模型大小超过50GB,它会被拆分为多个文件。若要将它们全部下载到本地文件夹,可运行:
huggingface-cli download bartowski/microsoft_Phi-4-reasoning-plus-GGUF --include "microsoft_Phi-4-reasoning-plus-Q8_0/*" --local-dir ./
你可以指定一个新的本地目录(如microsoft_Phi - 4 - reasoning - plus - Q8_0),也可以将它们全部下载到当前目录(./)。
📚 详细文档
提示格式
<|im_start|>system<|im_sep|>You are Phi, a language model trained by Microsoft to help users. Your role as an assistant involves thoroughly exploring questions through a systematic thinking process before providing the final precise and accurate solutions. This requires engaging in a comprehensive cycle of analysis, summarizing, exploration, reassessment, reflection, backtracing, and iteration to develop well-considered thinking process. Please structure your response into two main sections: Thought and Solution using the specified format:<think>{Thought section}</think>{Solution section}. In the Thought section, detail your reasoning process in steps. Each step should include detailed considerations such as analysing questions, summarizing relevant findings, brainstorming new ideas, verifying the accuracy of the current steps, refining any errors, and revisiting previous steps. In the Solution section, based on various attempts, explorations, and reflections from the Thought section, systematically present the final solution that you deem correct. The Solution section should be logical, accurate, and concise and detail necessary steps needed to reach the conclusion. Now, try to solve the following question through the above guidelines:<|im_end|>{system_prompt}<|end|><|user|>{prompt}<|end|><|assistant|>
下载文件选择
文件名 | 量化类型 | 文件大小 | 拆分情况 | 描述 |
---|---|---|---|---|
Phi - 4 - reasoning - plus - bf16.gguf | bf16 | 29.32GB | false | 完整的BF16权重。 |
Phi - 4 - reasoning - plus - Q8_0.gguf | Q8_0 | 15.58GB | false | 极高质量,通常不需要,但为最大可用量化。 |
Phi - 4 - reasoning - plus - Q6_K_L.gguf | Q6_K_L | 12.28GB | false | 嵌入和输出权重使用Q8_0。非常高质量,接近完美,推荐。 |
Phi - 4 - reasoning - plus - Q6_K.gguf | Q6_K | 12.03GB | false | 非常高质量,接近完美,推荐。 |
Phi - 4 - reasoning - plus - Q5_K_L.gguf | Q5_K_L | 10.92GB | false | 嵌入和输出权重使用Q8_0。高质量,推荐。 |
Phi - 4 - reasoning - plus - Q5_K_M.gguf | Q5_K_M | 10.60GB | false | 高质量,推荐。 |
Phi - 4 - reasoning - plus - Q5_K_S.gguf | Q5_K_S | 10.15GB | false | 高质量,推荐。 |
Phi - 4 - reasoning - plus - Q4_K_L.gguf | Q4_K_L | 9.43GB | false | 嵌入和输出权重使用Q8_0。质量良好,推荐。 |
Phi - 4 - reasoning - plus - Q4_1.gguf | Q4_1 | 9.27GB | false | 旧格式,性能与Q4_K_S相似,但在苹果硅芯片上每瓦令牌数有所提升。 |
Phi - 4 - reasoning - plus - Q4_K_M.gguf | Q4_K_M | 9.05GB | false | 质量良好,大多数用例的默认大小,推荐。 |
Phi - 4 - reasoning - plus - Q4_K_S.gguf | Q4_K_S | 8.44GB | false | 质量稍低,但节省更多空间,推荐。 |
Phi - 4 - reasoning - plus - Q4_0.gguf | Q4_0 | 8.41GB | false | 旧格式,为ARM和AVX CPU推理提供在线重新打包。 |
Phi - 4 - reasoning - plus - IQ4_NL.gguf | IQ4_NL | 8.38GB | false | 类似于IQ4_XS,但稍大。为ARM CPU推理提供在线重新打包。 |
Phi - 4 - reasoning - plus - Q3_K_XL.gguf | Q3_K_XL | 8.38GB | false | 嵌入和输出权重使用Q8_0。质量较低但可用,适合低内存情况。 |
Phi - 4 - reasoning - plus - IQ4_XS.gguf | IQ4_XS | 7.94GB | false | 质量尚可,比Q4_K_S小且性能相似,推荐。 |
Phi - 4 - reasoning - plus - Q3_K_L.gguf | Q3_K_L | 7.93GB | false | 质量较低但可用,适合低内存情况。 |
Phi - 4 - reasoning - plus - Q3_K_M.gguf | Q3_K_M | 7.36GB | false | 低质量。 |
Phi - 4 - reasoning - plus - IQ3_M.gguf | IQ3_M | 6.91GB | false | 中低质量,新方法,性能与Q3_K_M相当。 |
Phi - 4 - reasoning - plus - Q3_K_S.gguf | Q3_K_S | 6.50GB | false | 低质量,不推荐。 |
Phi - 4 - reasoning - plus - IQ3_XS.gguf | IQ3_XS | 6.25GB | false | 质量较低,新方法,性能尚可,略优于Q3_K_S。 |
Phi - 4 - reasoning - plus - Q2_K_L.gguf | Q2_K_L | 6.05GB | false | 嵌入和输出权重使用Q8_0。质量非常低,但出人意料地可用。 |
Phi - 4 - reasoning - plus - IQ3_XXS.gguf | IQ3_XXS | 5.85GB | false | 质量较低,新方法,性能尚可,与Q3量化相当。 |
Phi - 4 - reasoning - plus - Q2_K.gguf | Q2_K | 5.55GB | false | 质量非常低,但出人意料地可用。 |
Phi - 4 - reasoning - plus - IQ2_M.gguf | IQ2_M | 5.11GB | false | 质量相对较低,使用最先进技术,出人意料地可用。 |
Phi - 4 - reasoning - plus - IQ2_S.gguf | IQ2_S | 4.73GB | false | 质量较低,使用最先进技术,可用。 |
嵌入/输出权重
部分量化模型(如Q3_K_XL、Q4_K_L等)采用标准量化方法,将嵌入和输出权重量化为Q8_0,而非默认值。
ARM/AVX信息
以前,你会下载Q4_0_4_4/4_8/8_8,这些模型的权重会在内存中交错排列,以便通过一次加载更多数据来提高ARM和AVX机器的性能。
然而,现在有了所谓的权重“在线重打包”功能,详情见 此PR。如果你使用Q4_0,并且你的硬件能从权重重打包中受益,它将自动实时进行重打包。
从llama.cpp构建 b4282 开始,你将无法运行Q4_0_X_X文件,而需要使用Q4_0。
此外,如果你想获得稍好的质量,可以使用IQ4_NL,感谢 此PR,它也会为ARM重新打包权重,不过目前仅适用于4_4。加载时间可能会更长,但会带来整体速度的提升。
选择哪个文件?
点击查看详情
Artefact2在 这里 提供了一篇很棒的文章,带有展示各种性能的图表。
首先要确定你能运行多大的模型。为此,你需要弄清楚你有多少RAM和/或VRAM。
如果你希望模型运行得尽可能快,你需要将整个模型放入GPU的VRAM中。目标是选择一个文件大小比GPU总VRAM小1 - 2GB的量化模型。
如果你追求绝对最高质量,将系统RAM和GPU的VRAM相加,然后选择一个文件大小比该总和小1 - 2GB的量化模型。
接下来,你需要决定是使用“I - 量化”还是“K - 量化”。
如果你不想考虑太多,选择一个K - 量化模型。这些模型的格式为“QX_K_X”,如Q5_K_M。
如果你想深入了解,可以查看这个非常有用的特性图表:
但基本上,如果你目标是低于Q4,并且你使用的是cuBLAS(Nvidia)或rocBLAS(AMD),你应该考虑I - 量化模型。这些模型的格式为IQX_X,如IQ3_M。这些是较新的模型,在相同大小下提供更好的性能。
这些I - 量化模型也可以在CPU上使用,但比同等的K - 量化模型慢,所以你需要在速度和性能之间做出权衡。
🔧 技术细节
ARM/AVX性能优化
之前,为了提高ARM和AVX机器的性能,会下载Q4_0_4_4/4_8/8_8文件,其权重在内存中交错排列,以便一次加载更多数据。现在,有了“在线重打包”功能,使用Q4_0时,若硬件适合重打包权重,会自动实时进行。从llama.cpp构建 b4282 起,不能运行Q4_0_X_X文件,需用Q4_0。此外,IQ4_NL可借助 此PR 为ARM重打包权重,虽加载时间可能变长,但整体速度提升。
量化类型选择依据
对于模型量化类型的选择,首先要考虑能运行的模型大小,这取决于RAM和/或VRAM的容量。若追求最快速度,应选择文件大小比GPU总VRAM小1 - 2GB的量化模型;若追求最高质量,可将系统RAM和GPU的VRAM相加,选择比该总和小1 - 2GB的量化模型。在选择“I - 量化”还是“K - 量化”时,若不想深入考虑,可选择K - 量化(格式为“QX_K_X”);若使用cuBLAS(Nvidia)或rocBLAS(AMD)且目标低于Q4,可考虑I - 量化(格式为IQX_X),其较新且相同大小下性能更好,但在CPU上比K - 量化慢,需在速度和性能间权衡。
📄 许可证
本项目采用MIT许可证,详情见 许可证链接。
致谢
感谢kalomaze和Dampf协助创建imatrix校准数据集。 感谢ZeroWw启发对嵌入/输出进行实验。 感谢LM Studio赞助本项目工作。
如果你想支持我的工作,请访问我的ko - fi页面:https://ko-fi.com/bartowski



