DeepSeek 网摘deepseek.wang
EN
📄 查看英文原文

模型 · 2026-04-24 · 机器翻译,仅供参考

DeepSeek Coder:模型家族实践指南

Models·April 24, 2026·By DS Guide Editorial
DeepSeek Coder model card showing the headline specs of DeepSeek's November 2023 first code-specialist family: dense models from 1.3 billion to 33 billion parameters, trained from scratch on 2 trillion tokens at 87 percent code and 13 percent natural language, with a 16,000-token context window — the lineage that DeepSeek 编码器 V2 later replaced with MoE.

如果您来到这里是为了弄清楚DeepSeek Coder在2026年是否仍然值得运行——以及您应该从Hugging Face下载哪个版本——简短的答案是,原始的Coder系列已被DeepSeek 编码器 V2所取代,而V2又反过来被大量整合到通用的V4模型中,现在这些模型在API上处理编码工作负载。原始权重仍然有效,在特定基准测试中仍然表现良好,并且仍然可以在较小的尺寸上运行单个GPU。但重心已经转移。本指南将介绍每个版本实际发布的内容、原始论文中的基准测试数字、Coder系列如何映射到今天的V4 API,以及DeepSeek Coder在2026年工作流程中的适用性。

DeepSeek Coder是什么?

Developer accepting a DeepSeek Coder inline code completion in a modern editor on an external monitor

DeepSeek Coder 是DeepSeek推出的一个开源的代码专用语言模型系列,首次发布于2023年底。该系列包括一系列从头开始训练的代码语言模型,其中87%为代码,13%为英文和中文的自然语言,每个模型在2T个token上进行预训练,版本从1B到33B不等。第二代——DeepSeek 编码器 V2——于2024年6月发布,并将架构转向了混合专家(MoE)。从那时起,编码能力已被整合到DeepSeek的通用旗舰模型中,包括 DeepSeek V4 现在提供托管API上最强的编码基准。

Architecture and lineage

DeepSeek Coder名称下有两个不同的版本,还有一个通过通用模型运行的后续路径。

第一代:DeepSeek Coder(2023年11月)

原始发布是一个密集的仅解码器Transformer系列。该系列包括从87种编程语言中收集的2万亿个token从头开始训练的开源代码模型,规模从1.3B到33B不等,包括每个规模的基版和指令版。每个模型都是基于来自GitHub和CommonCrawl的87种编程语言的2万亿个token从头开始训练的,预训练数据在存储库级别组织,以增强对存储库内跨文件上下文的理解。除了预测下一个token的损失外,训练还采用了填充中间(FIM)方法。上下文窗口为16K个token。

第二代:DeepSeek 编码器 V2(2024年6月)

V2是在DeepSeek-MoE骨干上的完全重构。DeepSeek基于DeepSeekMoE框架发布了具有16B和236B总参数的Coder V2,其中基版和指令版的活跃参数分别为2.4B和21B。预训练数据集包括60%的源代码、10%的数学语料库和30%的自然语言。源代码由来自GitHub和CommonCrawl的1170B个与代码相关的token组成。与原始DeepSeek Coder相比,语料库从86种编程语言扩展到338种。上下文扩展到128K,允许处理大型代码存储库和复杂问题。

接下来发生了什么

DeepSeek没有发布“Coder V3”。相反,编码能力被吸收到了通用推理模型中—— DeepSeek V3, DeepSeek R1, V3.2,现在还有V4系列。如果您想在今天的API上获得最强的DeepSeek编码性能,请调用 deepseek-v4-pro or deepseek-v4-flash,不是一个专门的Coder端点。

来自主要来源的基准测试

Diagram of the DeepSeek Coder model family lineup across five parameter sizes from 1.3B to 33B

以下数字直接来自相应的技术报告。这些是原始评估环境中的历史基准;竞争模型的版本(GPT-4-Turbo、Claude 3 Opus、GPT-3.5-Turbo)被明确命名,以避免跨代混淆。

DeepSeek Coder(Gen 1)——基础模型

Benchmark DeepSeek-Coder-Base-33B 对比
HumanEval(多语言平均) 50.3% 与CodeLlama-34B相比:41.0%
MBPP 66.0% 与CodeLlama-34B相比:~55%
DS-1000 ~40.2% 与CodeLlama-34B相比:~34.3%

DeepSeek-Coder-Base在发布时实现了强大的基准性能,在HumanEval上的平均准确率为50.3%,在MBPP上的准确率为66.0%。与同样规模的开源模型CodeLlama-Base 34B相比,它在准确率上分别提高了9%和11%。DeepSeek-Coder-Instruct 33B是当时唯一一个在LeetCode风格任务上优于OpenAI的GPT-3.5-Turbo的开源模型,尽管与GPT-4-Turbo之间仍有较大差距。

DeepSeek 编码器 V2——236B MoE

Benchmark DeepSeek-Coder-V2(236B / 21B 活跃)
HumanEval 90.2%
MBPP+(EvalPlus管道) 76.2%
LiveCodeBench(2023年12月 – 2024年6月) 43.4%
SWE-Bench >10%(第一个通过这一门槛的开源模型)

DeepSeek 编码器 V2在HumanEval上取得了90.2%的分数,在MBPP+上取得了76.2%的分数(在EvalPlus评估管道上创下了新高),在2023年12月至2024年6月的问题上,在LiveCodeBench(Jain等人,2024)上取得了43.4%的分数。此外,DeepSeek-Coder-V2是第一个在SWE-Bench上超过10%分数的开源模型。关于V4-Pro(在DeepSeek的V4公告中为80.6%)的当前SWE-Bench验证数字,请参阅 DeepSeek benchmarks 2026 roundup.

Strengths

  • 仓库级别训练。 两代模型都在仓库级别而不是文件级别组织了预训练,这有助于模型在导入和共享类型之间进行推理。原始模型使用了16K窗口;V2扩展到了128K。
  • 中间填充(Fill-in-the-Middle)是原生支持的。 FIM自第一天起就是一流的预训练目标。这对于编辑器集成很重要,因为模型需要在现有缓冲区内部完成一个跨度,而不仅仅是继续从光标位置开始。如果您正在将补全功能集成到编辑器中,请参阅 DeepSeek 与 VS Code walkthrough.
  • 小模型效率。 6.7B和Lite-16B级别在性能上远超其规模。尽管DeepSeek-Coder-V2-Lite-Base只有24亿个活跃参数,但其在Python中的代码补全能力与DeepSeek-Coder-Base 33B模型相当。
  • 允许商业用途。 代码仓库采用MIT许可证。DeepSeek Coder模型的使用受模型许可证约束。DeepSeek Coder支持商业用途。请注意, 权重 它们位于单独的DeepSeek模型许可证之下,针对原始Coder和Coder V2——而非MIT——因此在发布派生产品之前请阅读LICENSE文件。

Weaknesses

  • 这是一个2023/2024年的模型。 训练截止日期早于现代框架版本的大部分。对于使用最新API的代码,通常当前前沿模型表现更佳。
  • 没有推理模式。 Coder V2不是一个推理模型。它提供直接响应,而不涉及扩展的推理步骤。对于复杂的多文件重构,需要具备推理能力的模型返回 reasoning_content alongside the final content 倾向于产生更好的计划。
  • 大型变体对硬件要求高。 要使用DeepSeek-Coder-V2的BF16格式进行推理,需要80GB×8个GPU。这意味着236B模型需要640GB的VRAM——这不是家庭实验室部署。
  • 基准测试落后于V4。 对于任何新的生产编码工作负载,V4系列当前的SWE-Bench验证数据使得使用通用API更具优势。

如何访问DeepSeek Coder

Open 权重 on Hugging Face

所有原始的Coder和Coder V2权重仍然在Hugging Face上的DeepSeek组织活跃。实用的选择:

  • deepseek-ai/deepseek-coder-6.7b-instruct —— 在单个消费级GPU上运行并进行了量化;合理的中间填充(FIM)。
  • deepseek-ai/deepseek-coder-33b-instruct — 最佳一代质量;BF16格式下约66 GB的VRAM。
  • deepseek-ai/DeepSeek-Coder-V2-Lite-Instruct — 总计16B / 激活2.4B;在单个80 GB GPU上具有良好的性价比。
  • deepseek-ai/DeepSeek-Coder-V2-Instruct — 236B MoE;仅支持多GPU。

关于逐步本地部署的详细说明,请参阅 how to install DeepSeek locally or the running DeepSeek on Ollama 量化路径指南。

托管API——当前模型ID

目前DeepSeek不将Coder模型作为独立的API端点公开。聊天请求会撞击 POST /chat/completions, the OpenAI-compatible endpoint, at https://api.deepseek.com, and the model 字段,取其一:

  • deepseek-v4-pro — 总计1.6T / 激活49B,前沿级别(发布日期:2026年4月24日)。
  • deepseek-v4-flash — 总计284B / 激活13B,成本效益级别。
  • deepseek-chat and deepseek-reasoner — 当前路由到的旧版ID deepseek-v4-flash (分别对应非思考模式和思考模式)。这些ID将在 2026-07-24 at 15:59 UTC; migrating is a one-line model= swap.

使用OpenAI SDK进行的最小Python调用,演示 reasoning_effort 以及适合编码的 temperature of 0.0:

from openai import OpenAI

client = OpenAI(
    base_url="https://api.deepseek.com",
    api_key="YOUR_KEY",
)

resp = client.chat.completions.create(
    model="deepseek-v4-pro",
    messages=[
        {"role": "system", "content": "You write idiomatic Python."},
        {"role": "user", "content": "Refactor this module for async IO: ..."},
    ],
    temperature=0.0,
    max_tokens=8000,
    reasoning_effort="high",
    extra_body={"thinking": {"type": "enabled"}},
)

print(resp.choices[0].message.reasoning_content)
print(resp.choices[0].message.content)

The API is stateless ——您的客户端必须在每次请求时重新发送会话历史。与网页聊天和应用程序不同,在调用之间服务器端没有任何内容被记住。V4两个级别默认为 1,000,000-token context window with output up to 384,000 tokens。FIM完成(Beta)和聊天前缀完成(Beta)在非思考模式下可用。对于完整表面,请参阅 DeepSeek API documentation.

Pricing snapshot

Coder特定的定价级别不再存在。编码工作负载支付标准V4费率。截至2026年4月,每1M个令牌:

Tier Input (cache hit) Input (cache miss) Output
deepseek-v4-flash $0.0028 $0.14 $0.28
deepseek-v4-pro $0.003625 (promo, list $0.0145) $0.435 (promo, list $1.74) $0.87 (promo, list $3.48)

以V4 Flash费率工作的示例,每月1,000,000次调用,带有2,000个令牌的缓存系统提示,200个令牌的差异,以及300个令牌的审查:

  • Cached input: 2,000 × 1,000,000 = 2,000,000,000 tokens × $0.0028/M = $5.60
  • Uncached input: 200 × 1,000,000 = 200,000,000 tokens × $0.14/M = $28.00
  • Output: 300 × 1,000,000 = 300,000,000 tokens × $0.28/M = $84.00
  • 总计:每月117.60美元

总是单独为未缓存的用户消息计费——系统提示缓存命中不包括每次调用的差异。高峰时段折扣已于2025年9月5日结束,尚未恢复。在承诺预算之前,请先在官方DeepSeek定价页面上确认当前价格;您还可以使用Coder-V2-Lite或6.7B原始模型进行场景建模。 DeepSeek pricing calculator.

Best use cases

  • 在通用硬件上的本地代码补全 ——当互联网往返不可接受时,Coder-V2-Lite或6.7B原始模型仍然是一个不错的选择。参见 DeepSeek for coding 用于工作流程模式。
  • 境内合规工作负载 — enterprises that cannot send code off-site run the open 权重 behind their firewall.
  • 微调基础编码器 ——Coder V2-Lite-Base是针对特定领域微调的实用起点。请参阅 微调指南.
  • 集成开发环境助手和代理编码器 ——通过API,针对硬任务目标V4-Pro,针对自动完成目标V4-Flash。

Alternatives worth comparing

如果您在DeepSeek Coder和一款商业助手之间做选择,那么这场面对面的比较将是: DeepSeek Coder vs Copilot 涵盖延迟、隐私和完成质量。欲了解更广泛的开源调查,请参阅 DeepSeek alternatives for coding将Coder系列纳入DeepSeek全系列,请浏览 DeepSeek models hub.

Verdict

DeepSeek 编码器 V2 — pass-rate scorecard

DeepSeek Coder仍能在2026年获得一席之地,但比2024年更窄。对于本地推理、微调或任何无法离开您网络的负载,开放权重——尤其是Coder V2-Lite——是可许可的代码模型中较强大的之一。对于API上的托管编码,现在正确的答案是V4-Flash用于常规工作,当SWE-Bench提升成本回收时使用V4-Pro。

DeepSeek AI Guide is an independent resource and is not affiliated with DeepSeek or its parent company. Model IDs, pricing and API behaviour change; check the official DeepSeek documentation and pricing page before committing to a production decision.

Frequently asked questions

DeepSeek Coder是否免费使用?

是的,开放权重可以免费下载和运行,包括商业用途,但需遵守与权重捆绑的DeepSeek模型许可。托管API按标准V4费率计费——没有单独的Coder端点。如果您想免费尝试DeepSeek进行编码任务而无需任何设置,官方网站上的网络聊天默认使用V4;参见 is DeepSeek free 有关详情。

DeepSeek Coder与DeepSeek 编码器 V2之间的区别是什么?

原始DeepSeek Coder(2023)是一个从1.3B到33B参数的密集Transformer家族,具有16K上下文窗口和87种语言的训练。Coder V2(2024)在专家混合架构上重建了这一系列,扩展到338种编程语言,并将上下文提升到128K,同时大幅提高了基准分数。两个版本的全部详细信息都在 DeepSeek 编码器 V2 page.

DeepSeek Coder与GitHub Copilot相比如何?

DeepSeek Coder是一款您可以自行托管或调用的开放权重模型系列;Copilot是一款紧密集成到编辑器中并由一系列轮换的OpenAI和Anthropic模型支持的管理产品。DeepSeek在许可自由、空气隔离部署和按令牌经济方面胜出。Copilot在即插即用的编辑器用户体验和生态系统方面胜出。详细分析请见 DeepSeek Coder vs Copilot.

DeepSeek Coder能否在笔记本电脑上本地运行?

1.3B和6.7B原始Coder变体在配备量化的现代笔记本电脑GPU或苹果硅Mac上运行。33B原始和Coder V2-Lite在4位量化下需要大约16-24GB的GPU内存。236B Coder V2需要一个多GPU服务器。对于实际设置教程,请参阅 running DeepSeek on Ollama.

2026年我应该使用哪个DeepSeek模型进行编码?

用于托管API使用 deepseek-v4-pro 针对最复杂的多文件任务和 deepseek-v4-flash 用于自动完成和常规完成——两者在当前基准测试中都优于旧的Coder系列。对于本地或空气隔离使用,Coder V2-Lite-Instruct是一个高效的每瓦特性能选择。使用 DeepSeek模型比较工具.

Sources & Methodology

Last source check: April 30, 2026

Primary sources

Technical references

  • Technical reportDeepSeek-V3 technical report (arXiv:2412.19437)V3 architecture and training methodologyLast checked: April 30, 2026
  • Technical reportDeepSeek-R1 paper (arXiv:2501.12948)R1 reasoning approach, distillation resultsLast checked: April 30, 2026
  • BenchmarkSWE-Bench Verified leaderboardSoftware-engineering benchmark scoresLast checked: April 30, 2026
  • BenchmarkLiveCodeBenchLive coding benchmark scoresLast checked: April 30, 2026
  • Technical reportDeepSeek-Coder 原始技术报告1.3B-33B 系列编号(HumanEval 50.3,MBPP 66.0,DS-1000)Last checked: April 30, 2026
  • Technical reportDeepSeek-Coder-V2 技术报告HumanEval 90.2,MBPP+ 76.2,LiveCodeBench 43.4 图表Last checked: April 30, 2026

Methodology

Architecture, parameter counts, context window, and license were checked against the official DeepSeek model card and the corresponding technical report. Benchmark figures are reproduced as they appear in vendor materials and are treated as directional indicators rather than guarantees of real-world performance.

Data confidence

High for official architecture and license; medium for vendor-reported benchmarks; low for projected future capabilities.

Editorial note

Vendor-reported figures are not always independently replicated. Benchmarks at the frontier change quickly; expect this article to need a refresh whenever DeepSeek, OpenAI, Anthropic, or Google ship a new model.