Image-Text-to-Text
Transformers
Safetensors
deepseek_v41
text-generation
conversational
Eval Results
8-bit precision
fp8
Instructions to use deepseek-ai/DeepSeek-V4.1-Flash with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use deepseek-ai/DeepSeek-V4.1-Flash with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="deepseek-ai/DeepSeek-V4.1-Flash") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("deepseek-ai/DeepSeek-V4.1-Flash", device_map="auto") - Inference
- HuggingChat
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use deepseek-ai/DeepSeek-V4.1-Flash with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "deepseek-ai/DeepSeek-V4.1-Flash" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "deepseek-ai/DeepSeek-V4.1-Flash", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/deepseek-ai/DeepSeek-V4.1-Flash
- SGLang
How to use deepseek-ai/DeepSeek-V4.1-Flash 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 "deepseek-ai/DeepSeek-V4.1-Flash" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "deepseek-ai/DeepSeek-V4.1-Flash", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'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 "deepseek-ai/DeepSeek-V4.1-Flash" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "deepseek-ai/DeepSeek-V4.1-Flash", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use deepseek-ai/DeepSeek-V4.1-Flash with Docker Model Runner:
docker model run hf.co/deepseek-ai/DeepSeek-V4.1-Flash
马 仕镕 commited on
Commit ·
df42c10
1
Parent(s): fb2764a
Update README.md & encoding/README.md
Browse files- README.md +8 -8
- encoding/README.md +5 -5
- encoding/encoding.py +4 -5
- encoding/test_encoding.py +3 -4
- encoding/tests/test_output_1.txt +1 -1
README.md
CHANGED
|
@@ -37,7 +37,7 @@ pipeline_tag: image-text-to-text
|
|
| 37 |
</div>
|
| 38 |
|
| 39 |
<p align="center">
|
| 40 |
-
<a href="DeepSeek_V41_Tech_Report.pdf"><b>Technical Report</b> 👁️</a>
|
| 41 |
</p>
|
| 42 |
|
| 43 |
## Introduction
|
|
@@ -108,7 +108,7 @@ All base models are evaluated in our internal framework under the same evaluatio
|
|
| 108 |
|
| 109 |
DeepSeek-V4.1-Flash supports a continuously controllable reasoning effort from 1 to 100. All instruct results below use the maximum effort setting (`reasoning_effort=100`). Evaluations use `temperature=1.0, top_p=0.95`.
|
| 110 |
|
| 111 |
-
For code agent benchmarks (Terminal
|
| 112 |
|
| 113 |
#### Comparison with frontier models (Max reasoning effort)
|
| 114 |
|
|
@@ -122,9 +122,9 @@ For code agent benchmarks (Terminal Bench 2.1/3.0/4.0, DeepSWE v1.1, NL2Repo-Ben
|
|
| 122 |
| Codeforces (Rating) | — | — | — | — | 3348 | 3289 | **3471** |
|
| 123 |
| MathArena Apex (Pass@1) | — | — | **65.6** | — | 65.3 | 58.6 | **65.6** |
|
| 124 |
| **Agentic** | | | | | | | |
|
| 125 |
-
| Terminal
|
| 126 |
-
| Terminal
|
| 127 |
-
| Terminal
|
| 128 |
| DeepSWE v1.1 (Resolved) | 74.0 | 73.0 | 67.5 | 66.9 | 62.7 | 54.4 | **74.2** |
|
| 129 |
| ProgramBench (Almost@1) | **37.0** | 23.0 | 17.5 | 19.0 | 15.5 | — | 20.3 |
|
| 130 |
| NL2Repo-Bench (Score) | **75.3** | 56.8 | 58.0 | 58.0 | 61.5 | 54.2 | 64.0 |
|
|
@@ -142,16 +142,16 @@ For code agent benchmarks (Terminal Bench 2.1/3.0/4.0, DeepSWE v1.1, NL2Repo-Ben
|
|
| 142 |
|
| 143 |
*† Text-only subset of HLE.*
|
| 144 |
|
| 145 |
-
#### Performance across agent scaffolds (DeepSWE v1.1 and Terminal
|
| 146 |
|
| 147 |
-
All scaffolds use N=8 samples per task on DeepSWE v1.1 and N=3 on Terminal
|
| 148 |
|
| 149 |
<div align="center">
|
| 150 |
|
| 151 |
| Benchmark (Metric) | Claude Code | Codex | OpenCode | Pi | mini-SWE | DSH Minimal | DSH Standard | DSH PTC |
|
| 152 |
| :--- | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
|
| 153 |
| DeepSWE v1.1 (Resolved) | 69.8 | 65.6 | 65.5 | 66.2 | 74.2 | 72.6 | 70.5 | 67.6 |
|
| 154 |
-
| Terminal
|
| 155 |
|
| 156 |
</div>
|
| 157 |
|
|
|
|
| 37 |
</div>
|
| 38 |
|
| 39 |
<p align="center">
|
| 40 |
+
<a href="https://huggingface.co/deepseek-ai/DeepSeek-V4.1-Flash/blob/main/DeepSeek_V41_Tech_Report.pdf"><b>Technical Report</b> 👁️</a>
|
| 41 |
</p>
|
| 42 |
|
| 43 |
## Introduction
|
|
|
|
| 108 |
|
| 109 |
DeepSeek-V4.1-Flash supports a continuously controllable reasoning effort from 1 to 100. All instruct results below use the maximum effort setting (`reasoning_effort=100`). Evaluations use `temperature=1.0, top_p=0.95`.
|
| 110 |
|
| 111 |
+
For code agent benchmarks (Terminal-Bench 2.1/3.0/4.0, DeepSWE v1.1, NL2Repo-Bench, ProgramBench), the model is evaluated with the Minimal mode of DeepSeek Harness and a 1M-token context window. To align with official setup requirements, the mini-SWE harness is used for DeepSWE v1.1, and the Claude Code harness for SEC-Bench Pro. Visual agent benchmarks (Chartography, BabyVision, ZeroBench) use the Claude Code harness with a 512k-token context window. Agent's Last Exam and AutomationBench use their official scaffolds. All agentic evaluations use `temperature=1.0, top_p=0.95`.
|
| 112 |
|
| 113 |
#### Comparison with frontier models (Max reasoning effort)
|
| 114 |
|
|
|
|
| 122 |
| Codeforces (Rating) | — | — | — | — | 3348 | 3289 | **3471** |
|
| 123 |
| MathArena Apex (Pass@1) | — | — | **65.6** | — | 65.3 | 58.6 | **65.6** |
|
| 124 |
| **Agentic** | | | | | | | |
|
| 125 |
+
| Terminal-Bench 2.1 (Pass@1) | 89.1 | 88.8 | 88.3 | 88.2 | 87.9 | 82.7 | **90.6** |
|
| 126 |
+
| Terminal-Bench 3.0 (Pass@1) | **43.3** | 34.4 | 17.7 | 28.3 | 11.8 | 7.6 | 30.0 |
|
| 127 |
+
| Terminal-Bench 4.0 (Pass@1) | **51.8** | 39.9 | 12.6 | 37.9 | 12.4 | 7.0 | 31.2 |
|
| 128 |
| DeepSWE v1.1 (Resolved) | 74.0 | 73.0 | 67.5 | 66.9 | 62.7 | 54.4 | **74.2** |
|
| 129 |
| ProgramBench (Almost@1) | **37.0** | 23.0 | 17.5 | 19.0 | 15.5 | — | 20.3 |
|
| 130 |
| NL2Repo-Bench (Score) | **75.3** | 56.8 | 58.0 | 58.0 | 61.5 | 54.2 | 64.0 |
|
|
|
|
| 142 |
|
| 143 |
*† Text-only subset of HLE.*
|
| 144 |
|
| 145 |
+
#### Performance across agent scaffolds (DeepSWE v1.1 and Terminal-Bench 2.1, Max reasoning effort)
|
| 146 |
|
| 147 |
+
All scaffolds use N=8 samples per task on DeepSWE v1.1 and N=3 on Terminal-Bench 2.1, with Linux containers, `temperature=1.0`, `top_p=0.95`, a 1M-token context limit, and max_steps=500 per agent. Terminal-Bench 2.1 is evaluated without network access.
|
| 148 |
|
| 149 |
<div align="center">
|
| 150 |
|
| 151 |
| Benchmark (Metric) | Claude Code | Codex | OpenCode | Pi | mini-SWE | DSH Minimal | DSH Standard | DSH PTC |
|
| 152 |
| :--- | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
|
| 153 |
| DeepSWE v1.1 (Resolved) | 69.8 | 65.6 | 65.5 | 66.2 | 74.2 | 72.6 | 70.5 | 67.6 |
|
| 154 |
+
| Terminal-Bench 2.1 (Pass@1) | 88.0 | 84.1 | 85.0 | 86.1 | 90.3 | 90.6 | 85.8 | 85.8 |
|
| 155 |
|
| 156 |
</div>
|
| 157 |
|
encoding/README.md
CHANGED
|
@@ -17,8 +17,8 @@ Three prompt-format changes distinguish V4.1 from V4:
|
|
| 17 |
2. **Reasoning effort is a numeric budget (1–100).** The effort prefix is
|
| 18 |
rendered as `Reasoning Effort: {budget} (range 1-100, ...)` rather than the
|
| 19 |
verbose natural-language descriptions used in V4. String aliases map as
|
| 20 |
-
follows: `"low"` →
|
| 21 |
-
default is `"high"` (
|
| 22 |
`thinking_mode="thinking"` and only at the beginning of the conversation
|
| 23 |
(index 0).
|
| 24 |
|
|
@@ -39,7 +39,7 @@ messages = [
|
|
| 39 |
prompt, media = encode_messages(
|
| 40 |
messages,
|
| 41 |
thinking_mode="thinking",
|
| 42 |
-
reasoning_effort=75, # integer 1–100, or "low"/"high"/"
|
| 43 |
return_multi_modal_data=True,
|
| 44 |
)
|
| 45 |
# prompt:
|
|
@@ -227,8 +227,8 @@ Tool execution results are wrapped in `<tool_result>` tags within user messages:
|
|
| 227 |
|
| 228 |
### Reasoning effort
|
| 229 |
|
| 230 |
-
Pass `reasoning_effort` as an integer in `[1, 100]` or as one of `"low"` (
|
| 231 |
-
`"high"` (
|
| 232 |
The setting only affects `thinking_mode="thinking"` and is only rendered at the
|
| 233 |
start of the conversation (index 0). Intermediate values may be used to elicit
|
| 234 |
interpolated reasoning behavior.
|
|
|
|
| 17 |
2. **Reasoning effort is a numeric budget (1–100).** The effort prefix is
|
| 18 |
rendered as `Reasoning Effort: {budget} (range 1-100, ...)` rather than the
|
| 19 |
verbose natural-language descriptions used in V4. String aliases map as
|
| 20 |
+
follows: `"low"` → 50, `"high"` → 75, `"max"` → 100. The
|
| 21 |
+
default is `"high"` (75). The effort prefix is only rendered in
|
| 22 |
`thinking_mode="thinking"` and only at the beginning of the conversation
|
| 23 |
(index 0).
|
| 24 |
|
|
|
|
| 39 |
prompt, media = encode_messages(
|
| 40 |
messages,
|
| 41 |
thinking_mode="thinking",
|
| 42 |
+
reasoning_effort=75, # integer 1–100, or "low"/"high"/"max"
|
| 43 |
return_multi_modal_data=True,
|
| 44 |
)
|
| 45 |
# prompt:
|
|
|
|
| 227 |
|
| 228 |
### Reasoning effort
|
| 229 |
|
| 230 |
+
Pass `reasoning_effort` as an integer in `[1, 100]` or as one of `"low"` (50),
|
| 231 |
+
`"high"` (75), or `"max"` (100). The default is `"high"` (75).
|
| 232 |
The setting only affects `thinking_mode="thinking"` and is only rendered at the
|
| 233 |
start of the conversation (index 0). Intermediate values may be used to elicit
|
| 234 |
interpolated reasoning behavior.
|
encoding/encoding.py
CHANGED
|
@@ -10,8 +10,8 @@ V4.1 changes relative to V4:
|
|
| 10 |
1. DSML tag names: tool calls are wrapped in "<|DSML| calls>" blocks with
|
| 11 |
"<|DSML| invoke>" / "<|DSML| parameter>" tags (leading-space tag names).
|
| 12 |
2. Numeric reasoning effort: "Reasoning Effort: {budget} (range 1-100, ...)".
|
| 13 |
-
Accepts an int in [1, 100] or one of "low"/"high"/"
|
| 14 |
-
(mapped to
|
| 15 |
3. Mid-conversation system messages are supported via the "<|System|>" token.
|
| 16 |
A mid-conversation system message behaves like a user message for the purpose
|
| 17 |
of appending the assistant generation header.
|
|
@@ -396,9 +396,8 @@ REASONING_EFFORT_TEMPLATE = (
|
|
| 396 |
)
|
| 397 |
|
| 398 |
REASONING_EFFORT_MAPPINGS: Dict[str, int] = {
|
| 399 |
-
"low":
|
| 400 |
-
"high":
|
| 401 |
-
"xhigh": 75,
|
| 402 |
"max": 100,
|
| 403 |
}
|
| 404 |
DEFAULT_REASONING_EFFORT = "high"
|
|
|
|
| 10 |
1. DSML tag names: tool calls are wrapped in "<|DSML| calls>" blocks with
|
| 11 |
"<|DSML| invoke>" / "<|DSML| parameter>" tags (leading-space tag names).
|
| 12 |
2. Numeric reasoning effort: "Reasoning Effort: {budget} (range 1-100, ...)".
|
| 13 |
+
Accepts an int in [1, 100] or one of "low"/"high"/"max"
|
| 14 |
+
(mapped to 50/75/100). Defaults to "high". Only rendered in thinking mode.
|
| 15 |
3. Mid-conversation system messages are supported via the "<|System|>" token.
|
| 16 |
A mid-conversation system message behaves like a user message for the purpose
|
| 17 |
of appending the assistant generation header.
|
|
|
|
| 396 |
)
|
| 397 |
|
| 398 |
REASONING_EFFORT_MAPPINGS: Dict[str, int] = {
|
| 399 |
+
"low": 50,
|
| 400 |
+
"high": 75,
|
|
|
|
| 401 |
"max": 100,
|
| 402 |
}
|
| 403 |
DEFAULT_REASONING_EFFORT = "high"
|
encoding/test_encoding.py
CHANGED
|
@@ -118,10 +118,9 @@ def test_v41_rejects_image_placeholder_in_text() -> None:
|
|
| 118 |
@pytest.mark.parametrize(
|
| 119 |
("effort", "budget"),
|
| 120 |
[
|
| 121 |
-
(None,
|
| 122 |
-
("low",
|
| 123 |
-
("high",
|
| 124 |
-
("xhigh", 75),
|
| 125 |
("max", 100),
|
| 126 |
(1, 1),
|
| 127 |
(42, 42),
|
|
|
|
| 118 |
@pytest.mark.parametrize(
|
| 119 |
("effort", "budget"),
|
| 120 |
[
|
| 121 |
+
(None, 75),
|
| 122 |
+
("low", 50),
|
| 123 |
+
("high", 75),
|
|
|
|
| 124 |
("max", 100),
|
| 125 |
(1, 1),
|
| 126 |
(42, 42),
|
encoding/tests/test_output_1.txt
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
<|begin▁of▁sentence|><|System|>Reasoning Effort:
|
| 2 |
|
| 3 |
You are a helpful assistant.
|
| 4 |
|
|
|
|
| 1 |
+
<|begin▁of▁sentence|><|System|>Reasoning Effort: 75 (range 1-100, the higher the value, the more thorough the reasoning)
|
| 2 |
|
| 3 |
You are a helpful assistant.
|
| 4 |
|