Instructions to use deepseek-ai/DeepSeek-V4-Pro with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use deepseek-ai/DeepSeek-V4-Pro with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="deepseek-ai/DeepSeek-V4-Pro") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("deepseek-ai/DeepSeek-V4-Pro") model = AutoModelForCausalLM.from_pretrained("deepseek-ai/DeepSeek-V4-Pro") - Inference
- HuggingChat
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use deepseek-ai/DeepSeek-V4-Pro 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-Pro" # 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-Pro", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/deepseek-ai/DeepSeek-V4-Pro
- SGLang
How to use deepseek-ai/DeepSeek-V4-Pro 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-Pro" \ --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-Pro", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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-Pro" \ --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-Pro", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use deepseek-ai/DeepSeek-V4-Pro with Docker Model Runner:
docker model run hf.co/deepseek-ai/DeepSeek-V4-Pro
Question about causal safety in DeepSeek-V4 CSA prefill retrieval
possible causality ambiguity during the prefill phase.
From the public implementation, the Lightning Indexer computes top-k retrieval over all compressed memories:
scores = q @ compressed_kv.transpose(-1, -2)
scores = F.relu(scores)
index_scores = (scores * weights.unsqueeze(-1)).sum(dim=2)
topk = index_scores.topk(k, dim=-1).indices
However, I could not find an explicit causal masking step before topk selection.
During prefill (seq_len > 1), this seems to imply that an earlier query token could potentially retrieve compressed memories corresponding to future token regions. For example:
q0 could retrieve M3
where M3 summarizes future tokens later in the prompt
I understand that later attention masking may block some retrieved entries, but I could not find discussion in the paper/blog about:
1 whether top-k retrieval itself is causally constrained
2 whether future compressed blocks are masked before retrieval
3 how causal safety is guaranteed during prefill for CSA sparse retrieval
Am I missing something or misunderstood
Would appreciate clarification from anyone familiar with the implementation details.