DeepSeek-Coder-V2

0

Описание

DeepSeek-Coder-V2: Breaking the Barrier of Closed-Source Models in Code Intelligence

Языки

  • SVG100%
README.md
DeepSeek-V2

Model Download | Evaluation Results | API Platform | How to Use | License | Citation

Paper Link👁️

DeepSeek-Coder-V2: Breaking the Barrier of Closed-Source Models in Code Intelligence

1. Introduction

We present DeepSeek-Coder-V2, an open-source Mixture-of-Experts (MoE) code language model that achieves performance comparable to GPT4-Turbo in code-specific tasks. Specifically, DeepSeek-Coder-V2 is further pre-trained from an intermediate checkpoint of DeepSeek-V2 with additional 6 trillion tokens. Through this continued pre-training, DeepSeek-Coder-V2 substantially enhances the coding and mathematical reasoning capabilities of DeepSeek-V2, while maintaining comparable performance in general language tasks. Compared to DeepSeek-Coder-33B, DeepSeek-Coder-V2 demonstrates significant advancements in various aspects of code-related tasks, as well as reasoning and general capabilities. Additionally, DeepSeek-Coder-V2 expands its support for programming languages from 86 to 338, while extending the context length from 16K to 128K.

In standard benchmark evaluations, DeepSeek-Coder-V2 achieves superior performance compared to closed-source models such as GPT4-Turbo, Claude 3 Opus, and Gemini 1.5 Pro in coding and math benchmarks. The list of supported programming languages can be found here.

2. Model Downloads

We release the DeepSeek-Coder-V2 with 16B and 236B parameters based on the DeepSeekMoE framework, which has actived parameters of only 2.4B and 21B , including base and instruct models, to the public.

Model#Total Params#Active ParamsContext LengthDownload
DeepSeek-Coder-V2-Lite-Base16B2.4B128k🤗 HuggingFace
DeepSeek-Coder-V2-Lite-Instruct16B2.4B128k🤗 HuggingFace
DeepSeek-Coder-V2-Base236B21B128k🤗 HuggingFace
DeepSeek-Coder-V2-Instruct236B21B128k🤗 HuggingFace

3. Evaluation Results

3.1 Code Generation

#TP#APHumanEvalMBPP+LiveCodeBenchUSACO
Closed-Source Models
Gemini-1.5-Pro--83.574.634.14.9
Claude-3-Opus--84.272.034.67.8
GPT-4-Turbo-1106--87.869.337.111.1
GPT-4-Turbo-0409--88.272.245.712.3
GPT-4o-0513--91.073.543.418.8
Open-Source Models
CodeStral22B22B78.168.231.04.6
DeepSeek-Coder-Instruct33B33B79.370.122.54.2
Llama3-Instruct70B70B81.168.828.73.3
DeepSeek-Coder-V2-Lite-Instruct16B2.4B81.168.824.36.5
DeepSeek-Coder-V2-Instruct236B21B90.276.243.412.1

3.2 Code Completion

Model#TP#APRepoBench (Python)RepoBench (Java)HumanEval FIM
CodeStral22B22B46.145.783.0
DeepSeek-Coder-Base7B7B36.243.386.1
DeepSeek-Coder-Base33B33B39.144.886.4
DeepSeek-Coder-V2-Lite-Base16B2.4B38.943.386.4

3.3 Code Fixing

#TP#APDefects4JSWE-BenchAider
Closed-Source Models
Gemini-1.5-Pro--18.619.357.1
Claude-3-Opus--25.511.768.4
GPT-4-Turbo-1106--22.822.765.4
GPT-4-Turbo-0409--24.318.363.9
GPT-4o-0513--26.126.772.9
Open-Source Models
CodeStral22B22B17.82.751.1
DeepSeek-Coder-Instruct33B33B11.30.054.5
Llama3-Instruct70B70B16.2-49.2
DeepSeek-Coder-V2-Lite-Instruct16B2.4B9.20.044.4
DeepSeek-Coder-V2-Instruct236B21B21.012.773.7

3.4 Mathematical Reasoning

#TP#APGSM8KMATHAIME 2024Math Odyssey
Closed-Source Models
Gemini-1.5-Pro--90.867.72/3045.0
Claude-3-Opus--95.060.12/3040.6
GPT-4-Turbo-1106--91.464.31/3049.1
GPT-4-Turbo-0409--93.773.43/3046.8
GPT-4o-0513--95.876.62/3053.2
Open-Source Models
Llama3-Instruct70B70B93.050.41/3027.9
DeepSeek-Coder-V2-Lite-Instruct16B2.4B86.461.80/3044.4
DeepSeek-Coder-V2-Instruct236B21B94.975.74/3053.7

3.5 General Natural Language

BenchmarkDomainDeepSeek-V2-Lite ChatDeepSeek-Coder-V2-Lite InstructDeepSeek-V2 ChatDeepSeek-Coder-V2 Instruct
BBHEnglish48.161.279.783.9
MMLUEnglish55.760.178.179.2
ARC-EasyEnglish86.188.998.197.4
ARC-ChallengeEnglish73.477.492.392.8
TriviaQAEnglish65.259.586.782.3
NaturalQuestionsEnglish35.530.853.447.5
AGIEvalEnglish42.828.761.460
CLUEWSCChinese80.076.589.985.9
C-EvalChinese60.161.678.079.4
CMMLUChinese62.562.781.680.9
Arena-Hard-11.438.141.665.0
AlpaceEval 2.0-16.917.738.936.9
MT-Bench-7.377.818.978.77
Alignbench-6.026.837.917.84

3.6 Context Window

Evaluation results on the

Needle In A Haystack
(NIAH) tests. DeepSeek-Coder-V2 performs well across all context window lengths up to 128K.

4. Chat Website

You can chat with the DeepSeek-Coder-V2 on DeepSeek's official website: chat.deepseek.com

5. API Platform

We also provide OpenAI-Compatible API at DeepSeek Platform: platform.deepseek.com, and you can also pay-as-you-go at an unbeatable price.

6. How to run locally

Here, we provide some examples of how to use DeepSeek-Coder-V2-Lite model. If you want to utilize DeepSeek-Coder-V2 in BF16 format for inference, 80GB*8 GPUs are required.

Inference with Huggingface's Transformers

You can directly employ Huggingface's Transformers for model inference.

Code Completion

Code Insertion

Chat Completion

The complete chat template can be found within

tokenizer_config.json
located in the huggingface model repository.

An example of chat template is as belows:

You can also add an optional system message:

In the last round of dialogue, note that "Assistant:" has no space after the colon. Adding a space might cause the following issues on the 16B-Lite model:

  • English questions receiving Chinese responses.
  • Responses containing garbled text.
  • Responses repeating excessively.

Older versions of Ollama had this bug (see https://github.com/deepseek-ai/DeepSeek-Coder-V2/issues/12), but it has been fixed in the latest version.

SGLang currently supports MLA optimizations, FP8 (W8A8), FP8 KV Cache, and Torch Compile, offering the best latency and throughput among open-source frameworks. Here are some example commands to launch an OpenAI API-compatible server:

After launching the server, you can query it with OpenAI API

import openai client = openai.Client( base_url="http://127.0.0.1:30000/v1", api_key="EMPTY") # Chat completion response = client.chat.completions.create( model="default", messages=[ {"role": "system", "content": "You are a helpful AI assistant"}, {"role": "user", "content": "List 3 countries and their capitals."}, ], temperature=0, max_tokens=64, ) print(response)

To utilize vLLM for model inference, please merge this Pull Request into your vLLM codebase: https://github.com/vllm-project/vllm/pull/4650.

7. License

This code repository is licensed under the MIT License. The use of DeepSeek-Coder-V2 Base/Instruct models is subject to the Model License. DeepSeek-Coder-V2 series (including Base and Instruct) supports commercial use.

8. Citation

9. Contact

If you have any questions, please raise an issue or contact us at service@deepseek.com.