# Unsloth 文档

Unsloth 让你可以在自己的本地硬件上运行和训练 AI 模型。

我们的文档将引导你在本地运行并训练自己的模型。

<a href="fine-tuning-for-beginners" class="button primary">开始使用</a> <a href="https://github.com/unslothai/unsloth" class="button secondary">我们的 GitHub</a>

<table data-view="cards" data-full-width="true"><thead><tr><th></th><th></th><th data-hidden data-card-cover data-type="image">封面图</th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>Qwen3.6</strong></td><td>全新的 35B-A3B MoE 模型来了！</td><td><a href="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fdy7z03AUFzXHKqqOY7kC%2Fqwen3.6%20logo.png?alt=media&#x26;token=a894c047-a9ea-4f9c-824a-be86ec81f54d">qwen3.6 logo.png</a></td><td><a href="../mo-xing/qwen3.6">qwen3.6</a></td></tr><tr><td><h4>Google Gemma 4</h4></td><td>运行并训练 Google 全新的 Gemma 4 模型！</td><td><a href="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FkEjWOJqBWCtIN9Cg6CdI%2FGemma%204%20landscape.png?alt=media&#x26;token=57d3f596-dae8-4eab-80e6-0847794ffc8d">Gemma 4 landscape.png</a></td><td><a href="../mo-xing/gemma-4">gemma-4</a></td></tr><tr><td><h4><strong>介绍 Unsloth Studio</strong></h4></td><td>一个用于训练和运行 LLM 的全新、无代码网页界面。</td><td><a href="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FstfdTMsoBMmsbQsgQ1Ma%2Flandscape%20clip%20gemma.gif?alt=media&#x26;token=eec5f2f7-b97a-4c1c-ad01-5a041c3e4013">landscape clip gemma.gif</a></td><td><a href="../xin-zeng/studio">studio</a></td></tr></tbody></table>

<table data-view="cards" data-full-width="false"><thead><tr><th></th><th></th><th data-hidden data-card-cover data-type="image">封面图</th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>Qwen3.5</strong></td><td>全新的 Qwen3.5 Small 和 Medium LLM 来了！</td><td><a href="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fvw6yRxJDCeBl1CIsQkki%2Fqwen35.png?alt=media&#x26;token=28fe0357-351a-49e1-a176-bb21ecc8542a">qwen35.png</a></td><td><a href="../mo-xing/qwen3.5">qwen3.5</a></td></tr><tr><td><strong>GLM-5.1</strong></td><td>在本地运行全新的 SOTA 开源模型。</td><td><a href="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FK69rPUGatLzCBK9uaqxU%2Fglm51%20logo.png?alt=media&#x26;token=934ef701-0233-47fd-ad49-6c1a5959b684">glm51 logo.png</a></td><td><a href="../mo-xing/glm-5.1">glm-5.1</a></td></tr><tr><td><strong>MiniMax-M2.7</strong></td><td>运行全新 230B 规模模型。</td><td><a href="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FoWNqL9cQDvNtxEcwGfLY%2Fm27.png?alt=media&#x26;token=aed5db72-4961-4089-b93a-01d9c4d19f0c">m27.png</a></td><td><a href="../mo-xing/minimax-m27">minimax-m27</a></td></tr><tr><td><strong>NVIDIA Nemotron 3</strong></td><td>运行 NVIDIA 全新的 4B 和 120B 模型。</td><td><a href="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FllPS7l6rpEr68mytlxXU%2Fnemotron%203%20logo.png?alt=media&#x26;token=7bd05673-6b97-41c2-b657-530b7e6e4e3c">nemotron 3 logo.png</a></td><td><a href="../mo-xing/nemotron-3">nemotron-3</a></td></tr><tr><td><strong>更快的 MoE 来了！</strong></td><td>用更少的 VRAM，将 MoE LLM 的训练速度提升 12 倍。</td><td><a href="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fh9BrTJR8CZghHOe1Yrgj%2Ffaster%20moe%201920.png?alt=media&#x26;token=404e70ea-6aa1-4af0-a01c-7490d8147c4e">faster moe 1920.png</a></td><td><a href="../ji-chu/faster-moe">faster-moe</a></td></tr><tr><td><strong>Claude Code 与 Codex</strong></td><td>学习通过 Claude 和 OpenAI 运行本地 LLM。</td><td><a href="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FM3el6W6XCMc0iBEgdeov%2Fclaude%20code%20codex.png?alt=media&#x26;token=e45dbc05-9af6-40f7-bcf8-59b79ac44909">claude code codex.png</a></td><td><a href="../ji-chu/claude-code">claude-code</a></td></tr></tbody></table>

{% columns %}
{% column width="50%" %}
{% content-ref url="fine-tuning-llms-guide" %}
[fine-tuning-llms-guide](https://unsloth.ai/docs/zh/kai-shi-shi-yong/fine-tuning-llms-guide)
{% endcontent-ref %}

{% content-ref url="unsloth-notebooks" %}
[unsloth-notebooks](https://unsloth.ai/docs/zh/kai-shi-shi-yong/unsloth-notebooks)
{% endcontent-ref %}
{% endcolumn %}

{% column width="50%" %}
{% content-ref url="unsloth-model-catalog" %}
[unsloth-model-catalog](https://unsloth.ai/docs/zh/kai-shi-shi-yong/unsloth-model-catalog)
{% endcontent-ref %}

{% content-ref url="../mo-xing/tutorials" %}
[tutorials](https://unsloth.ai/docs/zh/mo-xing/tutorials)
{% endcontent-ref %}
{% endcolumn %}
{% endcolumns %}

### 🦥 为什么选择 Unsloth？

* 我们直接与以下团队合作： [gpt-oss](https://docs.unsloth.ai/new/gpt-oss-how-to-run-and-fine-tune#unsloth-fixes-for-gpt-oss), [Qwen3](https://www.reddit.com/r/LocalLLaMA/comments/1kaodxu/qwen3_unsloth_dynamic_ggufs_128k_context_bug_fixes/), [Llama 4](https://github.com/ggml-org/llama.cpp/pull/12889), [Mistral](https://unsloth.ai/docs/zh/mo-xing/tutorials/devstral-how-to-run-and-fine-tune), [Gemma 1-3](https://news.ycombinator.com/item?id=39671146) 和 [Phi-4](https://unsloth.ai/blog/phi4)，我们已经 **修复了关键错误** ，这大幅提升了模型准确率。比如 Andrej Karpathy 就曾 [称赞我们的工作](https://x.com/karpathy/status/1765473722985771335).
* Unsloth 让本地训练、推理、数据和部署更加高效
* Unsloth 支持 500+ 个模型的推理和训练： [视觉](https://unsloth.ai/docs/zh/ji-chu/vision-fine-tuning), [TTS](https://unsloth.ai/docs/zh/ji-chu/text-to-speech-tts-fine-tuning), [嵌入](https://unsloth.ai/docs/zh/ji-chu/embedding-finetuning), [RL](https://unsloth.ai/docs/zh/kai-shi-shi-yong/reinforcement-learning-rl-guide)

### ⭐ 功能

Unsloth 让你可以运行和训练文本模型， [音频](https://unsloth.ai/docs/basics/text-to-speech-tts-fine-tuning), [嵌入](https://unsloth.ai/docs/new/embedding-finetuning), [视觉](https://unsloth.ai/docs/basics/vision-fine-tuning) 等更多类型的模型。Unsloth 为推理和训练提供了许多关键功能：

#### 推理

* 搜索 + 下载 + 运行任意模型，例如 GGUF、LoRA 适配器、safetensors。
* [自我修复式工具调用](https://unsloth.ai/docs/zh/xin-zeng/studio/chat#auto-healing-tool-calling) / 网页搜索并调用与 OpenAI 兼容的 API。
* [自动推理参数](https://unsloth.ai/docs/zh/xin-zeng/studio/chat#auto-parameter-tuning) 调优并编辑聊天模板。
* [导出或保存](https://unsloth.ai/docs/zh/xin-zeng/studio/export) 你的模型为 GGUF、16 位 safetensor 等格式。
* [对比输出](https://unsloth.ai/docs/zh/xin-zeng/studio/chat#model-arena) 并排比较两个不同模型的结果。

#### 训练

* 训练并 [RL](https://unsloth.ai/docs/zh/kai-shi-shi-yong/reinforcement-learning-rl-guide) 让 500+ 个模型的速度提升约 2 倍，同时减少约 70% 的 VRAM 占用（且无准确率损失）
* 支持全量微调、预训练、4 位、16 位和 FP8 训练。
* [自动创建数据集](https://unsloth.ai/docs/zh/xin-zeng/studio/data-recipe) ，来源包括 PDF、CSV、DOCX 文件。可在可视化节点工作流中编辑数据。
* 可观测性：实时监控训练、跟踪损失、GPU 使用情况、自定义图表
* 最高效的 [**强化学习**](https://unsloth.ai/docs/zh/kai-shi-shi-yong/reinforcement-learning-rl-guide) 库，GRPO 仅需更少 80% 的 VRAM， [FP8](https://unsloth.ai/docs/zh/kai-shi-shi-yong/reinforcement-learning-rl-guide/fp8-reinforcement-learning) 等。
* [多 GPU](https://unsloth.ai/docs/zh/ji-chu/multi-gpu-training-with-unsloth) 已经可用，但一个更好的版本即将到来！

### 快速开始

Unsloth 支持 MacOS、Linux、 [Windows](https://unsloth.ai/docs/zh/kai-shi-shi-yong/install/windows-installation), [NVIDIA](https://unsloth.ai/docs/zh/kai-shi-shi-yong/install/pip-install)、Intel 和 CPU 环境。请查看： [unsloth-requirements](https://unsloth.ai/docs/zh/kai-shi-shi-yong/fine-tuning-for-beginners/unsloth-requirements "mention")。使用相同命令进行更新：

#### **MacOS、Linux、WSL：**

```bash
curl -fsSL https://unsloth.ai/install.sh | sh
```

#### **Windows PowerShell：**

```bash
irm https://unsloth.ai/install.ps1 | iex
```

#### Docker

使用我们的官方 **Docker 镜像**: [`unsloth/unsloth`](https://hub.docker.com/r/unsloth/unsloth) ，目前适用于 Windows、WSL 和 Linux。MacOS 支持即将推出。

#### 启动 Unsloth

```bash
unsloth studio -H 0.0.0.0 -p 8888
```

#### 新模型

<table data-view="cards"><thead><tr><th></th><th data-hidden></th><th data-hidden data-card-cover data-type="image">封面图</th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>Kimi K2.5</strong></td><td></td><td><a href="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2FgcSsB0cPhjj8inDt1bqf%2Fkimi%20k25%20logo.png?alt=media&#x26;token=19aec00a-7e0f-4980-b2b7-98b65a23123e">kimi k25 logo.png</a></td><td><a href="../mo-xing/kimi-k2.5">kimi-k2.5</a></td></tr><tr><td><strong>MiniMax-M2.5</strong></td><td></td><td><a href="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2F0yrdjCKbV8qnqyTrQ1pZ%2Fminimax2.5%20logo.png?alt=media&#x26;token=183839fe-6750-4c95-b058-c991ec8a5dec">minimax2.5 logo.png</a></td><td><a href="../mo-xing/tutorials/minimax-m25">minimax-m25</a></td></tr><tr><td><strong>GLM-4.7-Flash</strong></td><td></td><td><a href="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2F6PQZ23CoUdZs1EZCjtYn%2Fglm4.7flash.png?alt=media&#x26;token=d3dc776e-ef3e-4eb3-ad4e-bf45e7b5745a">glm4.7flash.png</a></td><td><a href="../mo-xing/glm-4.7-flash">glm-4.7-flash</a></td></tr></tbody></table>

### 什么是微调和 RL？为什么需要它们？

[**微调** 一个 LLM](https://unsloth.ai/docs/zh/kai-shi-shi-yong/fine-tuning-llms-guide) 可以定制其行为、增强领域知识，并针对特定任务优化性能。通过在数据集上对预训练模型（例如 Llama-3.1-8B）进行微调，你可以：

* **更新知识**：引入新的领域特定信息。
* **定制行为**：调整模型的语气、人格或回复风格。
* **任务优化**：提高特定用例的准确性和相关性。

[**强化学习（RL）**](https://unsloth.ai/docs/zh/kai-shi-shi-yong/reinforcement-learning-rl-guide) 是指一个“智能体”通过与环境交互并接收 **反馈** ，以 **奖励** 或 **惩罚**.

* **的形式来学习做出决策。** 动作：
* **模型生成的内容（例如一句话）。** 奖励：
* **表示模型动作好坏的信号（例如回答是否遵循指令？是否有帮助？）。** 环境：

**模型正在处理的场景或任务（例如回答用户的问题）。**:

* 微调或 RL 的示例用例
* 使 LLM 能够预测标题是否会对公司产生正面或负面影响。
* 可在法律文本上微调 LLM，用于合同分析、判例研究和合规。

你可以把微调后的模型看作一个专门设计来更高效、更有效地执行特定任务的专用智能体。 **微调可以复现 RAG 的全部能力**，但反过来不行。

{% columns %}
{% column width="50%" %}
{% content-ref url="fine-tuning-for-beginners/faq-+-is-fine-tuning-right-for-me" %}
[faq-+-is-fine-tuning-right-for-me](https://unsloth.ai/docs/zh/kai-shi-shi-yong/fine-tuning-for-beginners/faq-+-is-fine-tuning-right-for-me)
{% endcontent-ref %}

{% content-ref url="../ji-chu/inference-and-deployment" %}
[inference-and-deployment](https://unsloth.ai/docs/zh/ji-chu/inference-and-deployment)
{% endcontent-ref %}
{% endcolumn %}

{% column width="50%" %}
{% content-ref url="reinforcement-learning-rl-guide" %}
[reinforcement-learning-rl-guide](https://unsloth.ai/docs/zh/kai-shi-shi-yong/reinforcement-learning-rl-guide)
{% endcontent-ref %}

{% content-ref url="../ji-chu/unsloth-dynamic-2.0-ggufs" %}
[unsloth-dynamic-2.0-ggufs](https://unsloth.ai/docs/zh/ji-chu/unsloth-dynamic-2.0-ggufs)
{% endcontent-ref %}
{% endcolumn %}
{% endcolumns %}

<figure><img src="https://2657992854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FxhOjnexMCB3dmuQFQ2Zq%2Fuploads%2Fgit-blob-134302f2507d4313b9575917c9a43b0a0028856c%2Flarge%20sloth%20wave.png?alt=media" alt="" width="188"><figcaption></figcaption></figure>


---

# 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/readme.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.
