> For the complete documentation index, see [llms.txt](https://docs.clore.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.clore.ai/guides/guides_v2-zh/yu-yan-mo-xing/deepseek-v4.md).

# DeepSeek V4（1.6T MoE，多模态）

在 Clore.ai 上部署 DeepSeek V4——MIT 许可的前沿 MoE，更新为 Flash-0731 和 Pro-0813

{% hint style="info" %}
**状态（2026年8月）：** DeepSeek V4 首次发布于 **2026年4月22日** 在 **MIT**，此后两个层级都已更新。当前检查点是 [deepseek-ai/DeepSeek-V4-Flash-0731](https://huggingface.co/deepseek-ai/DeepSeek-V4-Flash-0731) (**2026年7月31日**，167GB FP8，100万上下文，附带推测解码模块）以及 [deepseek-ai/DeepSeek-V4-Pro-0813](https://huggingface.co/deepseek-ai/DeepSeek-V4-Pro-0813) (**2026年8月13日**，893GB FP8，100万上下文）。4月的仓库仍然保留，作为预览版本。
{% endhint %}

## 自4月以来有什么变化

|       | 4月预览版               | 当前                                                                               |
| ----- | ------------------- | -------------------------------------------------------------------------------- |
| Flash | `DeepSeek-V4-Flash` | **`DeepSeek-V4-Flash-0731`** — 167GB FP8，43层，256个专家（6个激活），100万上下文，附带 DSpark 推测解码 |
| Pro   | `DeepSeek-V4-Pro`   | **`DeepSeek-V4-Pro-0813`** — 893GB FP8，61层，384个专家（6个激活），100万上下文                  |
| 推理控制  | —                   | `reasoning_effort`: `低`, `高`, `最大`                                               |
| 聊天模板  | Jinja               | **没有 Jinja 模板。** 该仓库附带一个 `encoding/` 文件夹，其中包含用于构建提示词和解析输出的 Python 辅助工具           |

**Flash-0731 在 DeepSeek 自家基准上超越了4月的 Pro 预览版，** 尽管激活参数只占一小部分：Terminal-Bench 2.1 **82.7** （对比 72.1），NL2Repo **54.2** （对比 38.5），DeepSWE **54.4** （对比 12.8），Toolathlon-Verified **70.3** （对比 55.9）。这些是厂商报告的数据，使用 DeepSeek 自家的测试框架在 `reasoning_effort: max`.

如果你部署了4月预览版，那么现在迁移到 `-0731` 是你目前能为 DeepSeek 部署做出的单项最高价值改动。

### 使用推测解码来提供 Flash-0731

```bash
vllm serve deepseek-ai/DeepSeek-V4-Flash-0731 \
  --trust-remote-code --kv-cache-dtype fp8 --block-size 256 \
  --data-parallel-size 4 --enable-expert-parallel \
  --speculative-config '{"method":"dspark","num_speculative_tokens":7,"draft_sample_method":"greedy"}'
```

{% hint style="warning" %}
**167GB 的权重需要的是整机，而不是一张卡。** 在 Clore.ai 市场上，这意味着 6× RTX 5090（186GB）或 8× RTX 4090（192GB）——在最近一次快照中，列出的 72 台服务器里有 26 台可用、内存 ≥167GB。量化后的 GGUF 构建还能进一步降低需求。Pro-0813 的 893GB 则是一个 [裸机](https://clore.ai/bare-metal) 部署。
{% endhint %}

DeepSeek V4 是 2026 年首个以 **双层发布**. **V4-Pro** 是旗舰版本——一个 **1.6 万亿参数的混合专家模型** ，每个 token 大约有 **490 亿激活参数**，一个 **100 万 token 上下文窗口**，并采用混合注意力设计，将压缩稀疏注意力与一种新的高度压缩注意力头结合起来，用于低成本的长上下文预填充。 **V4-Flash** 是实用型兄弟版本—— **总参数 2840 亿 / 激活参数 130 亿**，同样的架构，量化后可在单张 80GB GPU 上运行，并且借助 Unsloth GGUF 构建，在 2×48GB 的机器上也能舒适运行。

架构是最大亮点。DeepSeek 的混合注意力在长上下文下大幅降低了 KV 缓存内存占用，而 MoE 路由器也重新训练过以获得更精准的专家选择——早期独立测试报告称，Pro 以大约一半的激活参数计算量达到了 V3 级别的代码分数。对 Clore.ai 用户来说，这很重要，因为 **V4-Flash 是首次将低于 150 亿激活参数的前沿级模型与完整权重一起发布**，让严肃的开源推理能力能够在单张 H100 或一台便宜的多 4090 机器上实现。

对大多数团队来说，现实可行的 Clore 部署是 **在 1× A100 80GB 或 2× RTX 4090 上运行 V4-Flash** ——这就是性价比所在。如果你一直在运行 [DeepSeek V3](/guides/guides_v2-zh/yu-yan-mo-xing/deepseek-v3.md) 或 [DeepSeek-R1](/guides/guides_v2-zh/yu-yan-mo-xing/deepseek-r1.md)，迁移路径很直接——同一模型家族、同一聊天模板，在 vLLM 上可直接替换。

### 关键规格

| 属性          | DeepSeek V4-Pro                                                                   | DeepSeek V4-Flash                                                                     |
| ----------- | --------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- |
| 总参数         | 1.6T（MoE）                                                                         | 284B（MoE）                                                                             |
| 激活参数        | 每个 token 约 \~49B                                                                  | 每个 token 约 \~13B                                                                      |
| 上下文窗口       | 1,000,000 个 token                                                                 | 256,000 个 token                                                                       |
| 注意力机制       | 压缩稀疏 + 高度压缩注意力                                                                    | 压缩稀疏 + HCA                                                                            |
| 许可证         | MIT                                                                               | MIT                                                                                   |
| 发布日期        | 2026年4月22日                                                                        | 2026年4月22日                                                                            |
| HuggingFace | [deepseek-ai/DeepSeek-V4-Pro](https://huggingface.co/deepseek-ai/DeepSeek-V4-Pro) | [deepseek-ai/DeepSeek-V4-Flash](https://huggingface.co/deepseek-ai/DeepSeek-V4-Flash) |
| 主要工具链       | vLLM、SGLang（首发日支持）                                                                | vLLM、SGLang、llama.cpp（Unsloth GGUF）                                                   |

### 为什么选择 DeepSeek V4？

* **真正开放的前沿权重** — MIT 许可证，无使用限制，允许完全商业使用
* **Pro 支持 100万 上下文，Flash 支持 256K** — 一次即可处理整个代码库、书籍或长达数小时的转录内容
* **混合稀疏注意力** — KV 缓存在长上下文下的增长是次线性的，预填充成本很低
* **双层发布** — Flash 是首个足以在大多数工作流中替代 V3 的 130 亿激活参数 MoE 模型
* **首发日即支持 vLLM 和 SGLang** — 无需等待社区补丁，只需 `pip install -U` 然后开始使用
* **MoE 效率** — 你支付的是 13B/49B 的推理成本，而不是 284B/1.6T

***

## 需求

{% hint style="warning" %}
**Clore.ai 市场上未列出多 GPU 的 80GB 级机型。** 目前列出的最大配置是 4× RTX PRO 6000 Blackwell（每张 96GB，共 380GB）以及 8–11× RTX 5090（每张 32GB）。A100 / H200 / B200 容量可按 [裸机](https://clore.ai/bare-metal) 需求提供。部署前请查看 [GPU 价格与可用性](/guides/guides_v2-zh/ru-men-zhi-nan/pricing.md) 。
{% endhint %}

{% hint style="warning" %}
**V4-Pro 是前沿模型。** 完整 BF16 权重大约 3.2TB，需要多节点 H100/H200 或 8× B200 NVLink。没有单服务器 BF16 路径。如果你没有多节点基础设施，就运行 V4-Flash——它能以 5% 的硬件成本提供约 80% 的质量。
{% endhint %}

| 组件     | 最低配置（V4-Flash，GGUF Q4） | 推荐配置（V4-Flash FP8）          | 完整 V4-Pro（BF16）              |
| ------ | ---------------------- | --------------------------- | ---------------------------- |
| GPU 显存 | 1× 80GB 或 2× 48GB      | 1× H100 80GB 或 1× A100 80GB | 8× H100 80GB 或 4× H200 141GB |
| 内存     | 64GB                   | 128GB                       | 1TB+                         |
| 磁盘     | 200GB NVMe             | 600GB NVMe                  | 4TB NVMe                     |
| CUDA   | 12.8+                  | 12.8+                       | 12.8+                        |
| 网络     | —                      | —                           | 多节点需要 NVLink / 400Gb IB      |

**硬件适配：** 对 95% 的用户来说， **在 80GB 级显卡上运行 FP8 的 V4-Flash** 是最佳平衡点——完整 256K 上下文，没有量化损失， [裸机](https://clore.ai/bare-metal) 在市场上即可获得。转向 [H100](https://clore.ai/rent-h100.html) 或 [H200](https://clore.ai/rent-h200.html) 张量并行配置，只有在你确实需要 V4-Pro 的 100万 上下文或额外推理余量时才需要。

***

## 选项 A —— Ollama / GGUF（量化版，仅 V4-Flash）

Unsloth 在发布后 48 小时内就发布了 V4-Flash 的 GGUF 量化版本。Q4\_K\_M 是最佳平衡点——可在 1× 80GB 或 2× 48GB 上运行，并且质量接近 FP8。

```bash
# 拉取 Unsloth 的 Q4_K_M 构建
docker exec ollama ollama pull hf.co/unsloth/DeepSeek-V4-Flash-GGUF:Q4_K_M
docker exec ollama ollama run hf.co/unsloth/DeepSeek-V4-Flash-GGUF:Q4_K_M

# 或者直接用 llama.cpp 运行已下载的 GGUF
docker run --gpus all -it --rm -p 8080:8080 \
  -v $(pwd)/models:/models \
  ghcr.io/ggerganov/llama.cpp:server-cuda \
  -m /models/DeepSeek-V4-Flash-Q4_K_M.gguf \
  --n-gpu-layers 99 --ctx-size 65536 \
  --port 8080 --host 0.0.0.0
```

{% hint style="info" %}
V4-**Pro** 的 GGUF 量化版本确实存在，但并不实用——即使是 Q2\_K 也大约有 400GB，而且卸载性能对聊天来说不可用。量化部署请坚持使用 Flash。
{% endhint %}

***

## 选项 B —— vLLM（生产 API，推荐）

vLLM 0.7.x 已为两个 V4 检查点加入首发日支持。混合注意力内核需要 `--trust-remote-code` 以及 Hopper 或 Blackwell 硬件才能发挥全部速度。

**单张 H100 / A100 80GB 上的 V4-Flash：**

```yaml
version: "3.8"
services:
  vllm:
    image: vllm/vllm-openai:latest
    ports:
      - "8000:8000"
    volumes:
      - hf_cache:/root/.cache/huggingface
    command: >
      --model deepseek-ai/DeepSeek-V4-Flash
      --tensor-parallel-size 1
      --max-model-len 131072
      --dtype bfloat16
      --gpu-memory-utilization 0.92
      --enable-chunked-prefill
      --served-model-name deepseek-v4-flash
      --trust-remote-code
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: all
              capabilities: [gpu]
    shm_size: "16gb"

volumes:
  hf_cache:
```

**8× H100 80GB 上的 V4-Pro：** 将命令替换为：

```yaml
    command: >
      --model deepseek-ai/DeepSeek-V4-Pro
      --tensor-parallel-size 8
      --max-model-len 262144
      --dtype bfloat16
      --gpu-memory-utilization 0.90
      --enable-chunked-prefill
      --enable-prefix-caching
      --served-model-name deepseek-v4-pro
      --trust-remote-code
```

```bash
# 测试 API
curl http://localhost:8000/v1/chat/completions \\
  -H "Content-Type: application/json" \\
  -d '{
    "model": "deepseek-v4-flash",
    "messages": [{"role": "user", "content": "Write a Rust async TCP echo server with graceful shutdown."}],
    "max_tokens": 2048,
    "temperature": 0.6
  }'
```

{% hint style="info" %}
从 `--max-model-len 131072` 开始，即使你最终想要完整的 100万 ctx——长上下文会显著增加预填充时间和 KV 内存。只有在基线稳定后再把它调大。
{% endhint %}

***

## 选项 C —— SGLang（替代方案，通常在 Hopper 上更快）

SGLang 的 RadixAttention 和前缀缓存与 V4 的混合注意力配合得很好——对于共享提示词的智能体工作负载，预计 tok/s 会明显优于 vLLM。

```bash
docker pull lmsysorg/sglang:latest

# 单张 H100/A100 上的 V4-Flash
python3 -m sglang.launch_server \\
  --model-path deepseek-ai/DeepSeek-V4-Flash \
  --tp-size 1 \\
  --context-length 131072 \
  --mem-fraction-static 0.90 \
  --enable-torch-compile \
  --served-model-name deepseek-v4-flash \
  --trust-remote-code

# 8× H100 上的 V4-Pro
python3 -m sglang.launch_server \\
  --model-path deepseek-ai/DeepSeek-V4-Pro \
  --tp-size 8 \\
  --context-length 262144 \
  --mem-fraction-static 0.88 \
  --enable-torch-compile \
  --served-model-name deepseek-v4-pro \
  --trust-remote-code
```

SGLang 的 `--enable-torch-compile` 通常在 Hopper 上经过初始热身后还能再提升 10–20% 的吞吐量。

***

## Clore.ai GPU 推荐

| 配置                                                         | 模型                            | 显存        | 预期吞吐量             | Clore.ai 成本                       |
| ---------------------------------------------------------- | ----------------------------- | --------- | ----------------- | --------------------------------- |
| 2× [RTX 4090](https://clore.ai/rent-4090.html) （Q4 GGUF）   | V4-Flash                      | 48GB      | 业余使用，单流           | $0.14–0.42/小时                     |
| 1× [A100 80GB](https://clore.ai/rent-a100-80gb.html) （FP8） | V4-Flash                      | 80GB      | 稳定的生产单租户          | [裸机](https://clore.ai/bare-metal) |
| 1× RTX 5090 32GB（Q4 GGUF，部分卸载）                             | V4-Flash                      | 32GB + 内存 | 受限，仅开发用途          | 高峰期 $0.25–0.77/小时                 |
| 4× [H100 80GB](https://clore.ai/rent-h100.html)            | V4-Flash FP8（大材小用）或 V4-Pro Q4 | 320GB     | 多租户 Flash，单流 Pro  | 约 $1.04/小时                        |
| 8× [H100 80GB](https://clore.ai/rent-h100.html)            | V4-Pro BF16                   | 640GB     | 生产级前沿推理           | 约 $1.04/小时                        |
| 4× [H200 141GB](https://clore.ai/rent-h200.html)           | V4-Pro BF16 + 100万 ctx        | 564GB     | 完整 100万 上下文，最大吞吐量 | [裸机](https://clore.ai/bare-metal) |

{% hint style="success" %}
**Clore.ai 上最划算的选择：** 1× A100 80GB 运行 V4-Flash FP8。你可以获得 256K 上下文、约 130 亿激活参数的推理成本、没有量化损失，而且账单大致相当于 Claude Sonnet API 订阅的价格——但权重仍然保留在你自己的机器上。
{% endhint %}

***

## 应用场景

* **整代码库推理** — V4-Pro 的 100万 上下文足以一次容纳一个典型的 50 万行代码单体仓库及其测试
* **长文本 RAG** — 将整本书、法庭文件或年度报告直接放入上下文，跳过分块流程
* **智能体编程** — V4-Flash 以极低的推理成本达到与 V3 相当的 SWE-Bench 成绩；可搭配 SWE-agent 或 OpenHands
* **多文档综合** — 以前需要 Gemini 2.5 Pro 的研究工作流，现在可以在你自己的硬件上运行
* **自托管 Cursor / Copilot 替代品** — 单张 A100 上的 V4-Flash 足以满足 5 人开发团队的使用需求
* **微调基础模型** — MIT 许可证 + 干净的 MoE 架构，使其成为领域微调的强大起点

***

## 基准

{% hint style="warning" %}
**这是厂商声称——请独立核实。** 以下数据来自 DeepSeek 于 2026 年 4 月 22 日的公告和模型卡。独立复现仍在持续发布；请将其视为参考趋势，而非绝对结论。
{% endhint %}

| 基准                 | V4-Pro | V4-Flash | DeepSeek V3 | GLM-5.1 |
| ------------------ | ------ | -------- | ----------- | ------- |
| MMLU-Pro           | \~84%  | \~78%    | \~76%       | \~80%   |
| SWE-Bench Verified | \~82%  | \~74%    | \~70%       | \~79%   |
| HumanEval          | \~96%  | \~92%    | \~91%       | \~94%   |
| MATH-500           | \~94%  | \~88%    | \~85%       | \~90%   |
| LiveCodeBench      | \~76%  | \~68%    | \~62%       | \~72%   |
| 长上下文（100万 检针入海）    | \~98%  | 不适用      | 不适用         | 不适用     |

如果想看开放权重的同类对比，请参阅 [GLM-5.1 指南](/guides/guides_v2-zh/yu-yan-mo-xing/glm-5-1.md) — V4-Pro 和 GLM-5.1 会根据不同基准交替领先。

***

## 故障排查

| 问题                                     | 解决方案                                                                                                                             |
| -------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
| `OutOfMemoryError` 在 8×H100 上加载 V4-Pro | BF16 需要约 3.2TB——你无法把 Pro 放进单个 8×H100 节点。请使用 4× H200 141GB 或多节点。                                                                  |
| `不受支持的注意力后端`                           | V4 需要 vLLM ≥ 0.7.0 或 SGLang ≥ 0.4.4。运行 `pip install -U vllm` （或者拉取 `:latest` Docker 镜像）。                                         |
| HuggingFace 下载很慢                       | 使用 `huggingface-cli download deepseek-ai/DeepSeek-V4-Flash --local-dir ./weights --resume-download`。Pro 约为 3.2TB；Flash 约为 570GB。 |
| `--trust-remote-code` 被拒绝              | 混合注意力模块以仓库中的自定义代码形式提供—— `--trust-remote-code` 在上游 Transformers 中内核落地之前，两个引擎都需要它。                                                 |
| GGUF Q4 输出乱码                           | 请确保你使用的是 Unsloth 构建（`unsloth/DeepSeek-V4-Flash-GGUF`），而不是早期社区量化版本。MoE 路由器需要特殊处理，早期量化版本在这方面做错了。                                   |
| V4-Pro 的 100万 上下文 OOM                  | 降到 `--max-model-len 262144` 并添加 `--enable-prefix-caching`。真正的 100万 服务需要 H200 或 B200。                                             |
| 长上下文下的预填充很慢                            | 这是正常的——即使有混合注意力，50万+ 的预填充也要按分钟算，而不是秒。请使用 `--enable-chunked-prefill` 和前缀缓存来摊销。                                                    |

***

## 下一步

* **前代：** [DeepSeek V3](/guides/guides_v2-zh/yu-yan-mo-xing/deepseek-v3.md) — V4-Flash 实际上替代的是这个模型
* **推理兄弟模型：** [DeepSeek-R1](/guides/guides_v2-zh/yu-yan-mo-xing/deepseek-r1.md) — 针对思维链优化，对数学密集型工作流仍然很有用
* **开放权重替代品：** [GLM-5.1](/guides/guides_v2-zh/yu-yan-mo-xing/glm-5-1.md) — 7440 亿 MoE，SWE-Bench Pro 顶级，性价比相当
* **多模态替代品：** [Qwen3.5-Omni](/guides/guides_v2-zh/yu-yan-mo-xing/qwen35-omni.md) — 如果你需要同一个模型同时具备视觉/音频能力
* **租用硬件：** [Clore.ai 市场](https://clore.ai/marketplace) — H100/H200/A100/RTX 4090，每小时 $0.14–0.42

### 链接

* [HuggingFace 上的 DeepSeek-V4-Pro](https://huggingface.co/deepseek-ai/DeepSeek-V4-Pro)
* [HuggingFace 上的 DeepSeek-V4-Flash](https://huggingface.co/deepseek-ai/DeepSeek-V4-Flash)
* [Unsloth 的 V4-Flash GGUF 量化版本](https://huggingface.co/unsloth/DeepSeek-V4-Flash-GGUF)
* [DeepSeek GitHub](https://github.com/deepseek-ai)
* [vLLM 文档](https://docs.vllm.ai)
* [SGLang 仓库](https://github.com/sgl-project/sglang)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.clore.ai/guides/guides_v2-zh/yu-yan-mo-xing/deepseek-v4.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
