# Codestral

Codestral 是 [Mistral AI](https://www.edgepedia.org/zh/mistral-ai) 开发的一系列专精代码的大语言模型，于 2024 年 5 月首次发布，是该公司首个明确面向代码生成任务设计的模型。<sup>[1](https://mistral.ai/news/codestral/)</sup> 它与 Mistral 的通用模型并列，构成一条专攻编程的独立产品线，既不同于公司本身，也不同于基于其模型构建的任何消费级产品——后者另行介绍。

| 事实 | 详情 |
|---|---|
| 首次发布 | Codestral 22B（24.05），2024 年 5 月推出（发布日期 2024-05-29）<sup>[1](https://mistral.ai/news/codestral/)</sup><sup> • </sup><sup>[2](https://ai-tldr.dev/models/codestral-2405/)</sup> |
| 架构 | 稠密解码器专用 Transformer，约 222 亿参数，Mistral v3 分词器，无专家混合<sup>[2](https://ai-tldr.dev/models/codestral-2405/)</sup> |
| 上下文窗口 | 原始 22B 模型为 32k token<sup>[1](https://mistral.ai/news/codestral/)</sup> |
| 训练语言 | 80 多种编程语言，包括 Python、Java、C、C++、JavaScript 和 Bash<sup>[1](https://mistral.ai/news/codestral/)</sup> |
| 模式 | 指令模式与原生中间填充（FIM）补全<sup>[3](https://huggingface.co/mistralai/Codestral-22B-v0.1)</sup> |
| 许可证 | Codestral 22B 采用 Mistral AI 非生产许可证（MNPL-0.1）；Codestral Mamba 以 Apache 2.0 许可证提供<sup>[1](https://mistral.ai/news/codestral/)</sup><sup> • </sup><sup>[3](https://huggingface.co/mistralai/Codestral-22B-v0.1)</sup><sup> • </sup><sup>[6](https://mistral.ai/news/codestral-mamba/)</sup> |
| 有据可查的最新版本 | Codestral 25.01，2025 年 1 月，速度约为原始版本的 2 倍<sup>[4](https://mistral.ai/news/codestral-2501/)</sup> |

## Codestral 是什么

Codestral 是 Mistral AI 的代码生成模型系列。最初发布的版本是一个 22B 开放权重生成模型，Mistral 将其定位为首个专为代码而非通用文本打造的模型。<sup>[1](https://mistral.ai/news/codestral/)</sup> 与通用助手模型不同，它面向两种编程工作流：响应指令生成代码，以及中间填充补全——即模型预测代码前缀与后缀之间的中间 token，这一模式面向软件开发插件，例如 VS Code 中的插件。<sup>[3](https://huggingface.co/mistralai/Codestral-22B-v0.1)</sup>

该系列还包含一个独立变体 Codestral Mamba，这是一个 7B 模型，采用与主线稠密 Transformer 不同的架构。<sup>[2](https://ai-tldr.dev/models/codestral-2405/)</sup>

## 发布时间线与版本

**Codestral 22B（24.05）** 于 2024 年 5 月推出，模型卡日期为 2024-05-29。<sup>[1](https://mistral.ai/news/codestral/)</sup><sup> • </sup><sup>[2](https://ai-tldr.dev/models/codestral-2405/)</sup> Mistral 列出该版本的退役日期为 2025-06-16。<sup>[2](https://ai-tldr.dev/models/codestral-2405/)</sup>

**Codestral 25.01** 于 2025 年 1 月跟进。据 Mistral 称，它采用更高效的架构和改进的分词器，生成与补全代码的速度约为原始版本的 2 倍。<sup>[4](https://mistral.ai/news/codestral-2501/)</sup>

本文可获得的来源未记录 25.01 之后的任何 Codestral 发布、任何“Codestral 2”版本或任何 2026 年的发布；除提及 Codestral Mamba 是一个采用不同架构的独立 7B 模型外，其发布日期与规格亦未涉及。<sup>[2](https://ai-tldr.dev/models/codestral-2405/)</sup>

## 已公布的架构与训练

原始 Codestral 22B 是一个稠密解码器专用 Transformer，约 222 亿参数，使用 Mistral v3 分词器，上下文窗口为 32k token，无专家混合路由。<sup>[1](https://mistral.ai/news/codestral/)</sup><sup> • </sup><sup>[2](https://ai-tldr.dev/models/codestral-2405/)</sup> 它通过前缀与后缀 token 同时接受指令遵循和原生中间填充补全的训练。<sup>[2](https://ai-tldr.dev/models/codestral-2405/)</sup><sup> • </sup><sup>[3](https://huggingface.co/mistralai/Codestral-22B-v0.1)</sup>

Mistral 披露，训练覆盖了 80 多种编程语言的多样化数据集，包括 Python、Java、C、C++、[JavaScript](https://www.edgepedia.org/zh/javascript) 和 Bash 等最流行的语言。<sup>[1](https://mistral.ai/news/codestral/)</sup>

## 基准测试：厂商声明与独立测量

Codestral 几乎所有已公布的基准数字都来自 Mistral 自身，阅读时这一区别至关重要。

对于最初版本，Mistral 报告了 [HumanEval](https://www.edgepedia.org/zh/humaneval) pass@1、MBPP 清洗版 pass@1、CruxEval 和 RepoBench EM 上的评估，并对照 DeepSeek Coder 33B 评估了 FIM 性能。<sup>[1](https://mistral.ai/news/codestral/)</sup> 该公司声称，凭借 32k 上下文窗口——而竞争对手为 4k、8k 或 16k——Codestral 在 RepoBench 这一长程仓库级代码生成评估上优于所有其他模型。<sup>[1](https://mistral.ai/news/codestral/)</sup> VentureBeat 在报道发布时指出，该模型当时尚未经过公开测试，并将优于 CodeLlama 70B、DeepSeek Coder 33B 和 Llama 3 70B 的说法定性为厂商声明，而非独立验证的结果。<sup>[5](https://venturebeat.com/business/mistral-announces-codestral-its-first-programming-focused-ai-model)</sup>

Mistral 的发布帖中出现了一项第三方结果：在 Kotlin-HumanEval 测试中，Codestral 得分 73.75，Mistral 称其超过了 GPT-4-Turbo 的 72.05 和 GPT-3.5-Turbo 的 54.66。<sup>[1](https://mistral.ai/news/codestral/)</sup>

对于 Codestral 25.01，Mistral 自己的表格报告七种语言 HumanEval 平均 71.4%（Python 86.6%、C++ 78.9%、Java 72.8%、JavaScript 82.6%、Bash 43.0%、TypeScript 82.4%、C# 53.2%），而 Codestral-2405 22B 为 65.6%，DeepSeek Coder V2 lite 为 65.9%。<sup>[4](https://mistral.ai/news/codestral-2501/)</sup> 在 HumanEvalFIM 上，Mistral 的表格给出 25.01 平均 85.89%（Python 80.2%、Java 89.6%、JavaScript 87.96%），而 Codestral-2405 为 82.07%。<sup>[4](https://mistral.ai/news/codestral-2501/)</sup> Mistral 还表示，25.01 在 LMsys copilot arena 排行榜——一个第三方竞技场——上首次亮相即排名第一，但该排名由厂商引用，这些来源中并无独立报道。<sup>[4](https://mistral.ai/news/codestral-2501/)</sup>

Mistral 在 25.01 公告中的 FIM 对比数值内部并不一致：一张表给出 Codestral 25.01 平均 95.3%，而 OpenAI FIM API 为 92.7%，DeepSeek Chat API 为 94.4%；另一张表则给出 85.89%，而 OpenAI FIM API 为 83.7%，DeepSeek 基线约为 84.6–85.3%。

## 许可、可用性与成本

Codestral 22B 采用 Mistral AI 非生产许可证（[Hugging Face](https://www.edgepedia.org/zh/hugging-face) 上为 MNPL-0.1），允许用于研究和测试目的，商业使用需按需从 Mistral 获取许可证；而 Codestral Mamba 以 Apache 2.0 许可证发布，允许商业使用。<sup>[1](https://mistral.ai/news/codestral/)</sup><sup> • </sup><sup>[3](https://huggingface.co/mistralai/Codestral-22B-v0.1)</sup><sup> • </sup><sup>[6](https://mistral.ai/news/codestral-mamba/)</sup> VentureBeat 称该限制将用途限于非商业目的、测试和研究工作。<sup>[5](https://venturebeat.com/business/mistral-announces-codestral-its-first-programming-focused-ai-model)</sup> 这实际上意味着某些版本需要与 Mistral 协商条款，例如 MNPL-0.1 许可证下的 Codestral 22B，但 Apache 2.0 下的 Codestral Mamba 则不需要。<sup>[1](https://mistral.ai/news/codestral/)</sup><sup> • </sup><sup>[6](https://mistral.ai/news/codestral-mamba/)</sup>

发布时，Mistral 提供了一个专用的 codestral.mistral.ai 端点，在等候名单机制下免费开放 8 周测试期，并可通过 api.mistral.ai 按 token 计费。<sup>[1](https://mistral.ai/news/codestral/)</sup> 对于企业部署，Codestral 25.01 可本地部署或在虚拟私有云中部署，以满足数据与模型驻留要求；API 已在 Google Cloud 的 Vertex AI 上提供，在 [Azure AI Foundry](https://www.edgepedia.org/zh/azure-ai-foundry) 上处于私有预览阶段，据公告即将登陆 [Amazon Bedrock](https://www.edgepedia.org/zh/amazon-bedrock)。<sup>[4](https://mistral.ai/news/codestral-2501/)</sup>

## 采用与集成

发布时，Codestral 已集成到 [LlamaIndex](https://www.edgepedia.org/zh/llamaindex)、LangChain、Continue.dev 以及面向 VSCode 和 [JetBrains](https://www.edgepedia.org/zh/jetbrains) 的 Tabnine 中，使开发者可通过成熟的 IDE 插件和应用框架使用。<sup>[1](https://mistral.ai/news/codestral/)</sup>

## References

1. [Codestral | Mistral AI](https://mistral.ai/news/codestral/)
2. [Codestral 22B (24.05): Specs, Benchmarks & Status | AI/TLDR](https://ai-tldr.dev/models/codestral-2405/)
3. [mistralai/Codestral-22B-v0.1 · Hugging Face](https://huggingface.co/mistralai/Codestral-22B-v0.1)
4. [Codestral 25.01 | Mistral AI](https://mistral.ai/news/codestral-2501/)
5. [Mistral announces Codestral, a code-generation LLM it says outperforms all others | VentureBeat](https://venturebeat.com/business/mistral-announces-codestral-its-first-programming-focused-ai-model)
6. [Codestral Mamba, Mistral AI](https://mistral.ai/news/codestral-mamba/)

---
*Initially written Sep 17, 2026 · Reviewed: Sep 19, 2026 · Edited: Sep 19, 2026; Oct 11, 2026; Oct 15, 2026; Oct 21, 2026 · Last review: Sep 19, 2026*

Topic: 技术与人造世界 › 计算技术与数字系统 › 现代人工智能：基础模型、生成式人工智能与人工智能产业 › Model families and named models › Code models and coding agents

Copyright 2026 Edgepedia

License: Edgepedia Community License 1.0, https://www.edgepedia.org/edgepedia/license

Source: https://www.edgepedia.org/zh/codestral

English original: https://www.edgepedia.org/codestral
