DeepSeek V4 Prompting Guide: System Prompts and Examples

How to prompt DeepSeek V4: system prompts, CO-STAR, chain-of-thought, V4-Pro vs V4-Flash routing, schema-first outputs and 1M-context workflows, with examples.

Nikhil M

6 min read

On this page 21

DeepSeek V4 Preview (April 2026)

DeepSeek released V4 Preview on April 24, 2026 with two models: deepseek-v4-pro (1.6T parameters, 49B active) for complex tasks and deepseek-v4-flash (284B parameters, 13B active) for speed. Both support a 1M token context, up from 128K in V3.

What’s new in V4:

  • deepseek-v4-pro: full reasoning for complex coding, analysis and multi-step planning
  • deepseek-v4-flash: fast and cheap, non-thinking by default, with reasoning when you ask for it
  • 1M token context for codebases, long documents and research archives
  • OpenAI ChatCompletions API compatibility, so most SDKs work as drop-in clients
  • Anthropic API support, for teams that run Claude alongside DeepSeek

Migration note: the legacy aliases retire on July 24, 2026. deepseek-chat maps to V4-Flash (non-thinking) and deepseek-reasoner to V4-Flash (thinking). Update your model names before then.

This guide covers the prompting patterns that work on V4, each with an example you can run against the API.

System Prompts

A system prompt sets the job, the scope and the output format once, so each user message can stay short. Keep it about the task, not a persona: role lines such as “you are a witty developer” made outputs less consistent (see What Didn’t Work).

System: You review pull requests for a TypeScript backend.
Review only the diff in the user message.
For each issue, return the severity (high, medium or low), the line number
and a one-sentence fix.
If the diff has no issues, reply "No issues found."

The same structure works for other jobs: name the task, limit what the model should look at, and define the output.

Prompt Patterns That Work

CO-STAR Framework

V4 responds well to structured context. The CO-STAR framework (Context, Objective, Style, Tone, Audience, Response) gives the model every dimension of the output in one prompt.

Before (generic):

Write a story about Paris.

After (CO-STAR):

Context: 1920s Paris detective noir.
Objective: Write a 500-word mystery scene.
Style: Hard-boiled detective fiction.
Tone: Tense, atmospheric.
Audience: Adults who enjoy classic mystery.
Response: Markdown prose with dialogue.

The same applies to technical questions. Compare a vague prompt:

User: What's binary search's speed?

with a specific one:

User: Analyze the time complexity of a binary search algorithm and give the Big O notation with an explanation.
Assistant: <answer>
Time complexity is O(log n) because the search space is halved each iteration.
</answer>

Give the Context

Include framework versions, libraries and requirements. The model cannot guess them.

User: Given a Python web application using Flask 2.0.1 with SQLAlchemy for database operations, implement error handling for database connection failures.

Break Down the Task

Split complex requests into parts the model can check off.

User: Create a function that validates an email address. Consider:
1. Format verification ([email protected])
2. Domain validation
3. Special character handling
4. Length requirements

Chain-of-Thought for V4-Pro

V4-Pro does better when you lay out the reasoning path. V4-Flash does better with direct answers.

Before (no reasoning structure):

Find the bug in this code and explain how to fix it.

After (explicit reasoning):

Solve step-by-step:
1. Identify what the code is trying to do
2. Walk through execution with the provided input
3. Find where behavior diverges from expected
4. Propose the minimal fix

Code:
${code}

Input: ${input}
Expected output: ${expected}

For longer analysis, separate the parts with delimiters:

### Task
Analyze the system logs for anomalies.

### Reasoning Format
1. First, identify baseline behavior
2. Second, flag deviations
3. Third, correlate with known issues

### Output
List each anomaly with timestamp, severity, and root cause.

The AI prompt engineering guide for beginners covers the general concepts behind these patterns.

Model-Routing Prompts

Send each task to the model that fits it. V4-Flash costs less, so simple tasks should not go to V4-Pro.

For complex reasoning or coding:

Use V4-Pro. This requires multi-step reasoning:

1. What are the explicit requirements?
2. What assumptions must I state?
3. What is the recommended solution?
4. What are the trade-offs?

For speed and lower cost:

Use V4-Flash. Provide a concise, direct answer.
Focus on speed. No step-by-step reasoning needed.

Dual-Mode Prompting

Ask for reasoning only when the task needs it. Reasoning steps add tokens and latency.

When you need reasoning:

Show your reasoning step-by-step.
Then provide the final answer.

When you need speed:

Provide the answer directly.
Skip the reasoning steps.

1M Context Workflows

The 1M token context fits several long documents in one prompt. Give each part a clear header and restate the constraints at the end:

### Section A: Document 1 (chunks 1-5)
Summarize key themes.

### Section B: Document 2 (chunks 6-10)
Summarize key themes.

### Section C: Cross-Document Analysis
Compare themes across Section A and B.
Identify conflicts and agreements.

### Constraints
- Each summary max 100 words
- Use bullet points
- Flag any contradiction explicitly

Agentic Workflows

V4 handles agentic coding well. Structure the prompt as plan, tool use, verification and answer:

### Plan
1. List the files to modify
2. Identify dependencies
3. Propose the change approach

### Tool Use
For each file:
- Read the current content
- Apply the change
- Verify syntax

### Verification
- Check imports remain valid
- Verify function signatures unchanged

### Final Answer
Provide summary of changes made.

Schema-First Outputs

When code reads the output, define the format up front:

{
  "task": "Analyze code quality",
  "output_format": {
    "issues": [
      {
        "severity": "high|medium|low",
        "line": number,
        "description": "string"
      }
    ]
  }
}

Self-Check Prompts

Ask the model to check its answer against the request before it replies:

Before providing your final answer:
1. Re-read the user's request
2. Check your answer covers all requirements
3. Flag any assumptions you made

V4-Pro vs V4-Flash

ModelBest ForContextPrompt StyleAvoid
V4-ProComplex coding, analysis, planning1MExplicit reasoningConcise responses
V4-FlashFast generation, formatting1MDirect and conciseOver-specification

Common Mistakes to Avoid

1. Ambiguous Instructions

Avoid: “Make it better” Use instead: “Optimize this function for better time complexity and add error handling for edge cases”

2. Mixed Language Usage

Keep each prompt in one language. Mixing languages within a prompt can lead to unpredictable results.

3. Inconsistent Formatting

Define units, formats and output structures explicitly. Without them, results come back in mixed formats.

What Didn’t Work

  • Negative constraints such as “don’t hallucinate” had no visible effect. The models respond better to positive instructions about what to include than to lists of what to avoid.
  • Personality prompts such as “you are a witty developer” made outputs less consistent. Keep the system prompt about the task.

How to Roll This Out

Start with your highest-volume prompt and change one thing at a time:

  1. Define success criteria: what makes a good response for this use case?
  2. Build a test set: a representative set of prompts your team actually sends
  3. Apply one pattern: start with structure (CO-STAR or a system prompt)
  4. Rate outputs the same way each time, then add the next pattern, such as delimiters or model routing
  5. Move to the next prompt once results stop improving

The beginner’s guide to learning LLMs shows how evaluation fits into a wider LLM project.

When Prompting Is Not Enough

Prompting has limits:

  • Specialized domain knowledge: fine-tuned models often outperform prompted general models
  • Strict output schemas: prompting alone may not enforce them reliably
  • Latency: long reasoning chains increase response times
  • Cost: heavily engineered prompts consume more tokens

The alternatives have their own costs. Fine-tuning can raise accuracy but takes weeks to set up and needs ongoing maintenance, and it only pays off with thousands of specialized examples. Ensemble prompts (several model calls per request) multiply the cost of every request. For teams already on DeepSeek, better prompts are usually the cheapest improvement; see AI model optimization techniques for when to fine-tune instead.

Looking to put DeepSeek into your product? Lightrains’ LLM integration services cover model selection, prompt and output design, evaluation and fine-tuning. Get a free quote to discuss your project.

This article originally appeared on lightrains.com

Leave a comment

To make a comment, please send an e-mail using the button below. Your e-mail address won't be shared and will be deleted from our records after the comment is published. If you don't want your real name to be credited alongside your comment, please specify the name you would like to use. If you would like your name to link to a specific URL, please share that as well. Thank you.

Comment via email

Share this article

Topic

More on AI Engineering

How production AI systems are built: agents, RAG, MCP, LLM integration, evaluation and guardrails.

Written by

Nikhil M

Managing Director

Entrepreneur / Privacy Freak / Humanist / Blockchain / AI / Digital Security / Online Privacy

Keep reading

Ready to build your next AI product?

Get a free consultation and project quote for AI, software or product development, tailored to your goals.

  • No-obligation consultation
  • Clear scope and timeline
  • Transparent pricing
Get your free project quote