# Mistral Large 3（6750亿 MoE）

Mistral Large 3 是 Mistral AI 最强大的开放权重模型，于 2025 年 12 月在 **Apache 2.0 许可证**发布。它是一个混合专家（MoE）模型，总参数量为 675B，但每个 token 仅激活 41B —— 以远低于稠密 675B 模型的计算量提供前沿级性能。凭借原生多模态支持（文本 + 图像）、256K 上下文窗口和一流的代理能力，它可与 GPT-4o 和 Claude 类模型直接竞争，同时完全可自托管。

**HuggingFace：** [mistralai/Mistral-Large-3-675B-Instruct-2512](https://huggingface.co/mistralai/Mistral-Large-3-675B-Instruct-2512) **Ollama：** [mistral-large-3:675b](https://ollama.com/library/mistral-large-3) **许可：** Apache 2.0

## 主要特性

* **总计 675B / 每 token 激活 41B 参数** — MoE 效率意味着无需激活所有参数即可获得前沿性能
* **Apache 2.0 许可证** — 完全开放，可用于商业和个人用途，无限制
* **原生多模态** — 通过 2.5B 的视觉编码器同时理解文本和图像
* **256K 上下文窗口** — 可处理海量文档、代码库和长会话
* **一流的代理能力** — 原生函数调用、JSON 模式、工具使用
* **多种部署选项** — H200/B200 上的 FP8、H100/A100 上的 NVFP4、面向消费级 GPU 的 GGUF 量化

## 模型架构

| 组件    | 详细信息            |
| ----- | --------------- |
| 架构    | 细粒度混合专家（MoE）    |
| 总参数量  | 675B            |
| 激活参数  | 41B（每 token）    |
| 视觉编码器 | 2.5B 参数         |
| 上下文窗口 | 256K token      |
| 训练    | 3,000× H200 GPU |
| 发布    | 2025 年 12 月     |

## 要求

| 配置   | 预算（Q4 GGUF）  | 标准（NVFP4）     | 完整版（FP8）      |
| ---- | ------------ | ------------- | ------------- |
| GPU  | 4× RTX 4090  | 8× A100 80GB  | 8× H100/H200  |
| 显存   | 4×24GB（96GB） | 8×80GB（640GB） | 8×80GB（640GB） |
| 内存   | 128GB        | 256GB         | 256GB         |
| 磁盘   | 400GB        | 700GB         | 1.4TB         |
| CUDA | 12.0+        | 12.0+         | 12.0+         |

**推荐的 Clore.ai 设置：**

* **最佳性价比：** 4× RTX 4090（约 $2–8/天）—— 使用 llama.cpp 或 Ollama 运行 Q4 GGUF 量化
* **生产质量：** 8× A100 80GB（约 $16–32/天）—— 通过 vLLM 使用 NVFP4 并支持完整上下文
* **最高性能：** 8× H100（约 $24–48/天）—— FP8，完整 256K 上下文

## 使用 Ollama 快速入门

在多 GPU Clore.ai 实例上运行 Mistral Large 3 的最快方法：

```bash
# 安装 Ollama
curl -fsSL https://ollama.com/install.sh | sh

# 运行 675B 模型（需要多 GPU，Q4 量化约需 ~96GB 以上显存）
ollama run mistral-large-3:675b

# 对于较小的稠密变体（单 GPU）：
ollama run mistral3:14b    # 14B 稠密 — 可在 RTX 3060+ 上运行
ollama run mistral3:8b     # 8B 稠密 — 适用于任何 GPU
```

## 使用 vLLM 的快速入门（生产）

用于具有 OpenAI 兼容 API 的生产级服务：

```bash
# 安装 vLLM
pip install vllm

# 在 8× A100/H100 上使用 NVFP4 量化进行服务
vllm serve mistralai/Mistral-Large-3-675B-Instruct-2512-NVFP4 \
    --tensor-parallel-size 8 \
    --tokenizer-mode mistral \
    --config-format mistral \
    --load-format mistral \
    --max-model-len 65536 \
    --gpu-memory-utilization 0.90 \
    --enable-auto-tool-choice \
    --tool-call-parser mistral \
    --host 0.0.0.0 \
    --port 8000

# 对于 FP8（原始权重，最高质量）：
vllm serve mistralai/Mistral-Large-3-675B-Instruct-2512 \
    --tensor-parallel-size 8 \
    --tokenizer-mode mistral \
    --config-format mistral \
    --load-format mistral \
    --max-model-len 131072 \
    --host 0.0.0.0 \
    --port 8000
```

## 使用示例

### 1. 聊天补全（OpenAI 兼容 API）

一旦 vLLM 运行，使用任何 OpenAI 兼容客户端：

```python
from openai import OpenAI

client = OpenAI(
    base_url="http://localhost:8000/v1",
    api_key="not-needed"
)

response = client.chat.completions.create(
    model="mistralai/Mistral-Large-3-675B-Instruct-2512-NVFP4",
    messages=[
        {"role": "system", "content": "你是一个乐于助人的编码助理。"},
        {"role": "user", "content": "使用 aiohttp 和 BeautifulSoup 编写一个 Python 异步网页抓取器。"}
    ],
    temperature=0.1,
    max_tokens=4096
)

print(response.choices[0].message.content)
```

### 2. 函数调用 / 工具使用

Mistral Large 3 在结构化工具调用方面表现出色：

```python
import json
from openai import OpenAI

client = OpenAI(base_url="http://localhost:8000/v1", api_key="n/a")

tools = [
    {
        "type": "function",
        "function": {
            "name": "get_weather",
            "description": "获取某地当前天气",
            "parameters": {
                "type": "object",
                "properties": {
                    "location": {"type": "string", "description": "城市名称"},
                    "unit": {"type": "string", "enum": ["celsius", "fahrenheit"]}
                },
                "required": ["location"]
            }
        }
    }
]

response = client.chat.completions.create(
    model="mistralai/Mistral-Large-3-675B-Instruct-2512-NVFP4",
    messages=[{"role": "user", "content": "东京的天气怎么样？"}],
    tools=tools,
    tool_choice="auto"
)

tool_call = response.choices[0].message.tool_calls[0]
print(f"Function: {tool_call.function.name}")
print(f"Args: {tool_call.function.arguments}")
```

### 3. 视觉 — 图像分析

Mistral Large 3 原生理解图像：

```python
import base64
from openai import OpenAI

client = OpenAI(base_url="http://localhost:8000/v1", api_key="n/a")

# 对图像进行编码
with open("diagram.png", "rb") as f:
    image_b64 = base64.b64encode(f.read()).decode()

response = client.chat.completions.create(
    model="mistralai/Mistral-Large-3-675B-Instruct-2512-NVFP4",
    messages=[{
        "role": "user",
        "content": [
            {"type": "text", "text": "详细描述此架构图。"},
            {"type": "image_url", "image_url": {"url": f"data:image/png;base64,{image_b64}"}}
        ]
    }],
    max_tokens=2048
)

print(response.choices[0].message.content)
```

## 给 Clore.ai 用户的提示

1. **在 A100 上从 NVFP4 开始** — 该 `Mistral-Large-3-675B-Instruct-2512-NVFP4` 该 checkpoint 专为 A100/H100 节点设计，在内存占用约为 FP8 一半的情况下提供近乎无损的质量。
2. **使用 Ollama 进行快速实验** — 如果你有 4× RTX 4090 实例，Ollama 会自动处理 GGUF 量化。非常适合在投入 vLLM 生产部署前进行测试。
3. **安全地暴露 API** — 在 Clore.ai 实例上运行 vLLM 时，使用 SSH 隧道（`ssh -L 8000:localhost:8000 root@<ip>`）而不是直接暴露 8000 端口。
4. **降低 `max-model-len` 以节省显存** — 如果你不需要完整的 256K 上下文，请设置 `--max-model-len 32768` 或 `65536` 以显著减少 KV-cache 内存使用。
5. **考虑稠密的替代方案** — 对于单 GPU 设置，Mistral 3 14B（`mistral3:14b` 在 Ollama 中）在单个 RTX 4090 上提供出色性能，且来自同一模型家族。

## # 使用固定种子以获得一致结果

| 问题                                  | 解决方案                                                                                             |
| ----------------------------------- | ------------------------------------------------------------------------------------------------ |
| `CUDA 内存不足（out of memory）` 在 vLLM 上 | 减少 `--max-model-len` （尝试 32768），增加 `--tensor-parallel-size`，或使用 NVFP4 checkpoint                 |
| 生成速度慢                               | 确保已安装 `--tensor-parallel-size` 匹配你的 GPU 数量；使用 Eagle checkpoint 启用推测解码                            |
| Ollama 无法加载 675B                    | 确保你的 GPU 间显存总量为 96GB+；Ollama 需要 `OLLAMA_NUM_PARALLEL=1` 用于大型模型                                   |
| `tokenizer_mode mistral` 错误         | 你必须传入所有三个标志： `--tokenizer-mode mistral --config-format mistral --load-format mistral`            |
| 视觉功能无法工作                            | 确保图像接近 1:1 的宽高比；为获得最佳效果，避免非常宽或非常窄的图像                                                             |
| 下载太慢                                | 使用 `huggingface-cli download mistralai/Mistral-Large-3-675B-Instruct-2512-NVFP4` 与 `HF_TOKEN` 设置 |

## 延伸阅读

* [Mistral 3 发布博客](https://mistral.ai/news/mistral-3) — 官方发布文章与基准测试
* [HuggingFace 模型卡](https://huggingface.co/mistralai/Mistral-Large-3-675B-Instruct-2512) — 部署说明和基准结果
* [NVFP4 量化版本](https://huggingface.co/mistralai/Mistral-Large-3-675B-Instruct-2512-NVFP4) — 针对 A100/H100 优化
* [GGUF 量化（Unsloth）](https://huggingface.co/unsloth/Mistral-Large-3-675B-Instruct-2512-GGUF) — 适用于 llama.cpp 和 Ollama
* [vLLM 文档](https://docs.vllm.ai/) — 生产服务框架
* [Red Hat Day-0 指南](https://developers.redhat.com/articles/2025/12/02/run-mistral-large-3-ministral-3-vllm-red-hat-ai) — 分步 vLLM 部署指南


---

# 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://docs.clore.ai/guides/guides_v2-zh/yu-yan-mo-xing/mistral-large3.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.
