Text Generation
Transformers
Safetensors
deepseek_v4
deepseek-v4
nvfp4
blackwell
Mixture of Experts
8-bit precision
fp8
Instructions to use MJPansa/DeepSeek-V4-Flash-0731-NVFP4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use MJPansa/DeepSeek-V4-Flash-0731-NVFP4 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="MJPansa/DeepSeek-V4-Flash-0731-NVFP4")# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("MJPansa/DeepSeek-V4-Flash-0731-NVFP4") model = AutoModelForCausalLM.from_pretrained("MJPansa/DeepSeek-V4-Flash-0731-NVFP4", device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use MJPansa/DeepSeek-V4-Flash-0731-NVFP4 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "MJPansa/DeepSeek-V4-Flash-0731-NVFP4" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "MJPansa/DeepSeek-V4-Flash-0731-NVFP4", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/MJPansa/DeepSeek-V4-Flash-0731-NVFP4
- SGLang
How to use MJPansa/DeepSeek-V4-Flash-0731-NVFP4 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "MJPansa/DeepSeek-V4-Flash-0731-NVFP4" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "MJPansa/DeepSeek-V4-Flash-0731-NVFP4", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "MJPansa/DeepSeek-V4-Flash-0731-NVFP4" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "MJPansa/DeepSeek-V4-Flash-0731-NVFP4", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use MJPansa/DeepSeek-V4-Flash-0731-NVFP4 with Docker Model Runner:
docker model run hf.co/MJPansa/DeepSeek-V4-Flash-0731-NVFP4
Update model card with conversion and vLLM validation details
Browse files
README.md
CHANGED
|
@@ -6,19 +6,28 @@ tags:
|
|
| 6 |
- nvfp4
|
| 7 |
- blackwell
|
| 8 |
- moe
|
| 9 |
-
license:
|
| 10 |
---
|
| 11 |
|
| 12 |
-
# DeepSeek V4 Flash 0731
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
> [!IMPORTANT]
|
| 15 |
-
> This is a community conversion of the official
|
| 16 |
-
> [`deepseek-ai/DeepSeek-V4-Flash-0731`](https://huggingface.co/deepseek-ai/DeepSeek-V4-Flash-0731)
|
| 17 |
> checkpoint. DeepSeek's architecture, tokenizer, DSpark/MTP configuration,
|
| 18 |
> attention, shared experts, router, head, and other excluded tensors are
|
| 19 |
> preserved. This repository is not affiliated with or endorsed by DeepSeek or
|
| 20 |
> NVIDIA.
|
| 21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
## What was converted
|
| 23 |
|
| 24 |
- Calibrated routed-expert inputs across all 43 main transformer layers.
|
|
@@ -50,16 +59,138 @@ The complete conversion receipt is included as `conversion-receipt.json`.
|
|
| 50 |
|
| 51 |
## Runtime status
|
| 52 |
|
| 53 |
-
The checkpoint
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
|
| 59 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
|
| 61 |
-
|
| 62 |
|
| 63 |
-
|
| 64 |
-
the source model's terms and the terms of any downstream runtime or kernel used
|
| 65 |
-
with this checkpoint.
|
|
|
|
| 6 |
- nvfp4
|
| 7 |
- blackwell
|
| 8 |
- moe
|
| 9 |
+
license: mit
|
| 10 |
---
|
| 11 |
|
| 12 |
+
# DeepSeek V4 Flash 0731-NVFP4
|
| 13 |
+
|
| 14 |
+
<div align="center">
|
| 15 |
+
<img src="https://github.com/deepseek-ai/DeepSeek-V2/blob/main/figures/logo.svg?raw=true" width="60%" alt="DeepSeek-V4" />
|
| 16 |
+
</div>
|
| 17 |
+
|
| 18 |
+
## Community NVIDIA-style NVFP4 version
|
| 19 |
|
| 20 |
> [!IMPORTANT]
|
| 21 |
+
> This is a community conversion of the official DeepSeek V4 Flash 0731
|
|
|
|
| 22 |
> checkpoint. DeepSeek's architecture, tokenizer, DSpark/MTP configuration,
|
| 23 |
> attention, shared experts, router, head, and other excluded tensors are
|
| 24 |
> preserved. This repository is not affiliated with or endorsed by DeepSeek or
|
| 25 |
> NVIDIA.
|
| 26 |
|
| 27 |
+
<p align="center">
|
| 28 |
+
<a href="https://arxiv.org/abs/2606.19348"><b>Technical Report</b> 👁️</a>
|
| 29 |
+
</p>
|
| 30 |
+
|
| 31 |
## What was converted
|
| 32 |
|
| 33 |
- Calibrated routed-expert inputs across all 43 main transformer layers.
|
|
|
|
| 59 |
|
| 60 |
## Runtime status
|
| 61 |
|
| 62 |
+
The checkpoint was verified to load and generate through vLLM on two NVIDIA DGX
|
| 63 |
+
Spark systems using tensor parallelism across both machines. An
|
| 64 |
+
OpenAI-compatible chat smoke test completed successfully. The following is the
|
| 65 |
+
tested configuration; it favors compatibility and deterministic startup over
|
| 66 |
+
maximum throughput (`--enforce-eager` disables CUDA graphs and compilation
|
| 67 |
+
optimizations).
|
| 68 |
+
|
| 69 |
+
- vLLM: `0.26.1rc1.dev191+gaef9bd1e9.d20260731`
|
| 70 |
+
- Tensor parallel size: `2` across `2` nodes
|
| 71 |
+
- Maximum model length: `250000` tokens
|
| 72 |
+
- Maximum sequences: `8`
|
| 73 |
+
- Maximum batched tokens / chunked prefill: `4096`
|
| 74 |
+
- GPU memory utilization: `0.83`
|
| 75 |
+
- KV cache: FP8, block size `256`
|
| 76 |
+
- Load format: `instanttensor`
|
| 77 |
+
|
| 78 |
+
Start the rank-1 worker first:
|
| 79 |
+
|
| 80 |
+
```bash
|
| 81 |
+
vllm serve /path/to/DeepSeek-V4-Flash-0731-NVFP4 \
|
| 82 |
+
--host 0.0.0.0 --port 8000 \
|
| 83 |
+
--trust-remote-code --tokenizer-mode deepseek_v4 \
|
| 84 |
+
--tensor-parallel-size 2 --nnodes 2 --node-rank 1 \
|
| 85 |
+
--master-addr <rank-0-address> --master-port 29513 \
|
| 86 |
+
--headless --distributed-executor-backend mp \
|
| 87 |
+
--load-format instanttensor \
|
| 88 |
+
--max-model-len 250000 --max-num-seqs 8 \
|
| 89 |
+
--max-num-batched-tokens 4096 \
|
| 90 |
+
--gpu-memory-utilization 0.83 --kv-cache-dtype fp8 \
|
| 91 |
+
--block-size 256 --enforce-eager
|
| 92 |
+
```
|
| 93 |
+
|
| 94 |
+
Then start rank 0 with the same command, changing `--node-rank 1` to
|
| 95 |
+
`--node-rank 0` and removing `--headless`.
|
| 96 |
+
|
| 97 |
+
This runtime check confirms loading and basic generation compatibility. It is
|
| 98 |
+
not a claim of production performance certification; the tested eager-mode
|
| 99 |
+
configuration produced low decode throughput.
|
| 100 |
+
|
| 101 |
+
## Introduction
|
| 102 |
+
|
| 103 |
+
**DeepSeek-V4-Flash-0731** is the official release of **DeepSeek-V4-Flash**, superseding the preview version, with substantially enhanced agentic capabilities. It has the same model structure as DeepSeek-V4-Flash-DSpark, i.e. it comes with a speculative decoding module attached.
|
| 104 |
+
|
| 105 |
+
DeepSeek-V4-Flash-0731 outperforms DeepSeek-V4-Pro (Preview) on benchmarks listed below despite its far smaller activated parameter count, and is broadly competitive with the strongest proprietary models available.
|
| 106 |
+
|
| 107 |
+
<div align="center">
|
| 108 |
+
|
| 109 |
+
| Benchmark | DeepSeek-V4-Flash-0731 | DeepSeek-V4-Flash (Preview) | DeepSeek-V4-Pro (Preview) | GLM-5.2 | Opus-4.8 |
|
| 110 |
+
| :--- | :---: | :---: | :---: | :---: | :---: |
|
| 111 |
+
| Terminal Bench 2.1 | 82.7 | 61.8 | 72.1 | 81.0 | 85.0 |
|
| 112 |
+
| NL2Repo | 54.2 | 39.4 | 38.5 | 48.9 | 69.7 |
|
| 113 |
+
| Cybergym | 76.7 | 38.7 | 52.7 | - | 83.1 |
|
| 114 |
+
| DeepSWE | 54.4 | 7.3 | 12.8 | 46.2 | 58.0 |
|
| 115 |
+
| Toolathlon-Verified | 70.3 | 49.7 | 55.9 | 59.9 | 76.2 |
|
| 116 |
+
| Agents' Last Exam | 25.2 | 15.8 | 16.5 | 23.8 | 25.7 |
|
| 117 |
+
| AutomationBench Public | 25.1 | 10.8 | 12.8 | 12.9 | 27.2 |
|
| 118 |
+
| DSBench-FullStack † | 68.7 | 37.0 | 41.8 | 61.8 | 71.6 |
|
| 119 |
+
| DSBench-Hard † | 59.6 | 25.8 | 31.1 | 54.5 | 71.7 |
|
| 120 |
+
|
| 121 |
+
</div>
|
| 122 |
+
|
| 123 |
+
Notes:
|
| 124 |
+
|
| 125 |
+
1. For the Code Agent tasks among the public benchmarks above, DeepSeek-V4-Flash-0731 is evaluated with the minimal mode of DeepSeek Harness (to be released) as the agent framework, using the `max` reasoning effort level with `temperature = 1.0, top_p = 0.95`.
|
| 126 |
+
2. † DSBench-FullStack is an internal full-stack development test set; DSBench-Hard is an internal test set of difficult coding-agent problems.
|
| 127 |
+
|
| 128 |
+
## Chat Template
|
| 129 |
+
|
| 130 |
+
This release does not include a Jinja-format chat template. Instead, we provide a dedicated `encoding` folder with Python scripts and test cases demonstrating how to encode messages in OpenAI-compatible format into input strings for the model, and how to parse the model's text output. Please refer to the [`encoding`](encoding/README.md) folder for full documentation.
|
| 131 |
+
|
| 132 |
+
The `reasoning_effort` parameter now supports three levels — `low`, `high`, and `max` — which control how much deliberation the model spends before answering.
|
| 133 |
+
|
| 134 |
+
A brief example:
|
| 135 |
+
|
| 136 |
+
```python
|
| 137 |
+
from encoding_dsv4 import encode_messages, parse_message_from_completion_text
|
| 138 |
+
|
| 139 |
+
messages = [
|
| 140 |
+
{"role": "user", "content": "hello"},
|
| 141 |
+
{"role": "assistant", "content": "Hello! I am DeepSeek.", "reasoning_content": "thinking..."},
|
| 142 |
+
{"role": "user", "content": "1+1=?"}
|
| 143 |
+
]
|
| 144 |
+
|
| 145 |
+
# messages -> string
|
| 146 |
+
prompt = encode_messages(messages, thinking_mode="thinking", reasoning_effort="max")
|
| 147 |
+
|
| 148 |
+
# string -> tokens
|
| 149 |
+
import transformers
|
| 150 |
+
tokenizer = transformers.AutoTokenizer.from_pretrained("MJPansa/DeepSeek-V4-Flash-0731-NVFP4")
|
| 151 |
+
tokens = tokenizer.encode(prompt)
|
| 152 |
+
```
|
| 153 |
+
|
| 154 |
+
## How to Run with vLLM
|
| 155 |
+
|
| 156 |
+
For the upstream DeepSeek deployment recipe, DSpark speculative decoding is
|
| 157 |
+
enabled with a single flag — add `--speculative-config` with method `dspark` to
|
| 158 |
+
your vLLM launch command. For this NVFP4 conversion, use the tested
|
| 159 |
+
two-node command in the Runtime status section above.
|
| 160 |
+
|
| 161 |
+
```bash
|
| 162 |
+
vllm serve deepseek-ai/DeepSeek-V4-Flash-0731 \
|
| 163 |
+
--trust-remote-code --kv-cache-dtype fp8 --block-size 256 \
|
| 164 |
+
--data-parallel-size 4 --enable-expert-parallel \
|
| 165 |
+
--moe-backend deep_gemm_mega_moe \
|
| 166 |
+
--attention-config '{"use_fp4_indexer_cache": true}' \
|
| 167 |
+
--speculative-config '{"method":"dspark","num_speculative_tokens":7,"draft_sample_method":"greedy"}'
|
| 168 |
+
```
|
| 169 |
+
|
| 170 |
+
For example, the command above serves the upstream model on a single 4×GB300
|
| 171 |
+
node. See the vLLM recipe for detailed instructions and other hardware
|
| 172 |
+
configurations.
|
| 173 |
+
|
| 174 |
+
## How to Run Locally
|
| 175 |
+
|
| 176 |
+
Please refer to the [inference](inference/README.md) folder for detailed instructions on running DeepSeek-V4 locally, including model weight conversion and interactive chat demos.
|
| 177 |
+
|
| 178 |
+
For local deployment, we recommend setting the sampling parameters to `temperature = 1.0`, with `top_p = 0.95` for agentic scenarios and `top_p = 1.0` otherwise. For the `high` and `max` reasoning effort levels, we recommend a maximum output length of **384K** tokens.
|
| 179 |
+
|
| 180 |
+
## License
|
| 181 |
+
|
| 182 |
+
This repository and the model weights are licensed under the [MIT License](LICENSE).
|
| 183 |
+
|
| 184 |
+
## Citation
|
| 185 |
|
| 186 |
+
```text
|
| 187 |
+
@misc{deepseekai2026deepseekv4,
|
| 188 |
+
title={DeepSeek-V4: Towards Highly Efficient Million-Token Context Intelligence},
|
| 189 |
+
author={DeepSeek-AI},
|
| 190 |
+
year={2026},
|
| 191 |
+
}
|
| 192 |
+
```
|
| 193 |
|
| 194 |
+
## Contact
|
| 195 |
|
| 196 |
+
If you have any questions, please raise an issue or contact us at [service@deepseek.com](mailto:service@deepseek.com).
|
|
|
|
|
|