# 我应该用什么模型进行微调？

## Llama、Qwen、Mistral、Phi 还是？

在准备微调时，你首先要面临的决定之一是选择合适的模型。以下是一份分步指南，帮助你做出选择：

{% stepper %}
{% step %}
**选择与您的使用案例一致的模型**

* 例如：对于基于图像的训练，选择诸如视觉模型 *Llama 3.2 视觉*. 对于代码数据集，选择像这样的专用模型 *Qwen Coder 2.5*.
* **许可和要求**: 不同模型可能有特定的许可条款和 [系统要求](/docs/zh/kai-shi-shi-yong/fine-tuning-for-beginners/unsloth-requirements.md#system-requirements). 请务必仔细审查这些内容以避免兼容性问题。
  {% endstep %}

{% step %}
**评估您的存储、计算能力和数据集**

* 使用我们的 [显存指导](/docs/zh/kai-shi-shi-yong/fine-tuning-for-beginners/unsloth-requirements.md#approximate-vram-requirements-based-on-model-parameters) 来确定您正在考虑的模型所需的显存要求。
* 您的数据集将反映您将使用的模型类型以及训练所需的时间
  {% endstep %}

{% step %}
**选择模型和参数**

* 我们建议使用最新模型以获得最佳性能和功能。例如，截至 2025 年 1 月，领先的 70B 模型是 *Llama 3.3*.
* 您可以通过浏览我们的 [模型目录](/docs/zh/kai-shi-shi-yong/unsloth-model-catalog.md) 来查找最新和相关的选项并保持更新。
  {% endstep %}

{% step %}
**在 Base 模型和 Instruct 模型之间选择**

更多细节如下：
{% endstep %}
{% endstepper %}

## Instruct 模型还是 Base 模型？

在准备微调时，你首先要面临的决定之一是使用 instruct 模型还是 base 模型。

### Instruct 模型

Instruct 模型在预训练时已内置指令，使其无需任何微调即可使用。这些模型（包括 GGUF 等常见格式）针对直接使用进行了优化，能够开箱即用地对提示做出有效响应。Instruct 模型可与 ChatML 或 ShareGPT 等会话聊天模板配合使用。

### **Base 模型**

另一方面，Base 模型是未经过指令微调的原始预训练版本。它们专为通过微调进行自定义而设计，允许你将其调整为特定需求。Base 模型兼容像 [Alpaca 或 Vicuna](/docs/zh/ji-chu/chat-templates.md)这样的指令式模板，但通常开箱即用时不支持会话聊天模板。

### 我应该选择 Instruct 还是 Base？

决定通常取决于你的数据的数量、质量和类型：

* **1000+ 行数据**: 如果你有一个超过 1000 行的大型数据集，通常最好对 Base 模型进行微调。
* **300–1000 行高质量数据**: 对于中等规模的高质量数据集，对 Base 或 Instruct 模型进行微调都是可行的选择。
* **少于 300 行**: 对于较小的数据集，通常选择 Instruct 模型更为合适。对 Instruct 模型进行微调可以使其与特定需求对齐，同时保留其内置的指令能力。这可确保它在不需要额外输入的情况下遵循一般指令，除非你打算显著改变其功能。
* 有关你的数据集应有多大信息， [见此处](/docs/zh/kai-shi-shi-yong/fine-tuning-llms-guide/datasets-guide.md#how-big-should-my-dataset-be)

## 使用 Unsloth 进行微调模型

你可以通过将模型名称与 Hugging Face 上的模型名称匹配来更改为你喜欢的任何模型，例如 'unsloth/llama-3.1-8b-unsloth-bnb-4bit'。

我们建议从 **Instruct 模型**开始，因为它们允许使用会话聊天模板（ChatML、ShareGPT 等）直接进行微调，并且与 **Base 模型** （使用 Alpaca、Vicuna 等）相比需要更少的数据。了解更多关于 [instruct 与 base 模型之间差异的信息请见此处](#instruct-or-base-model).

* 以以下后缀结尾的模型名称 **`unsloth-bnb-4bit`** 表示它们是 [**Unsloth 动态 4 位**](https://unsloth.ai/blog/dynamic-4bit) **量化**。这些模型比标准的 BitsAndBytes 4 位模型消耗稍多的显存，但提供显著更高的准确性。
* 如果模型名称仅以 **`bnb-4bit`**&#x7ED3;尾，而没有包含 "unsloth"，则表示它指的是标准的 BitsAndBytes 4 位量化。
* 没有 **后缀** 的模型处于其原始的 **16 位或 8 位格式**。虽然它们是来自官方模型创建者的原始模型，但我们有时会包含重要修复——例如聊天模板或分词器修复。因此建议在可用时使用我们的版本。

### 实验很关键

{% hint style="info" %}
我们建议在可能的情况下对两种模型进行实验。微调每个模型并评估输出，以查看哪个更符合你的目标。
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://unsloth.ai/docs/zh/kai-shi-shi-yong/fine-tuning-llms-guide/what-model-should-i-use.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
