Prompt Engineering for Chinese AI Models: Best Practices and Techniques (2026)

August 13, 2026 · 19 min read

Prompt engineering is the difference between mediocre and exceptional AI outputs. Chinese AI models — DeepSeek, GLM-4, Qwen, Kimi — each respond differently to prompting techniques. This guide distills the most effective patterns we've tested across thousands of production queries through TokenEase.

Core Principles

  1. Be specific — Vague prompts produce vague outputs
  2. Provide context — The model only knows what you tell it
  3. Use structured formats — JSON, XML, or markdown improve consistency
  4. Iterate and test — Small prompt changes can yield large output improvements

Technique 1: Zero-Shot Prompting

The simplest approach — ask the model directly without examples.

# Effective zero-shot prompt
prompt = """Summarize the following article in 3 bullet points, each under 20 words:

Article:
{article_text}

Format your response as:
- Point 1
- Point 2
- Point 3"""

# Ineffective zero-shot prompt
bad_prompt = "Summarize this."  # Too vague
Best for: Simple, well-defined tasks where the desired output format is obvious.

Technique 2: Few-Shot Prompting

Provide examples to guide the model's output style and format.

few_shot_prompt = """Extract named entities from text. Return as JSON.

Example 1:
Text: "Apple Inc. announced a partnership with TSMC in Cupertino."
Output: {
  "organizations": ["Apple Inc.", "TSMC"],
  "locations": ["Cupertino"],
  "people": []
}

Example 2:
Text: "Elon Musk visited Beijing to meet with CATL executives."
Output: {
  "organizations": ["CATL"],
  "locations": ["Beijing"],
  "people": ["Elon Musk"]
}

Now extract from:
Text: "{input_text}"
Output:"""

response = requests.post(
    f"{BASE_URL}/chat/completions",
    headers={"Authorization": f"Bearer {TOKEN}"},
    json={
        "model": "deepseek-v4",
        "messages": [{"role": "user", "content": few_shot_prompt}],
        "temperature": 0.1  # Low temp for consistent formatting
    }
)
Performance gain: Few-shot prompting improves accuracy by 15-30% on structured extraction tasks compared to zero-shot.

Technique 3: Chain-of-Thought (CoT)

Ask the model to think step-by-step before answering. Critical for reasoning tasks.

cot_prompt = """Solve the following math problem step by step.
Show your reasoning, then provide the final answer.

Problem: A store has a 20% off sale. An item originally costs $80.
After the discount, there's an additional 10% off with a coupon.
What is the final price?

Step 1:"""

# For models that support reasoning (DeepSeek-V4, GLM-4)
response = requests.post(
    f"{BASE_URL}/chat/completions",
    json={
        "model": "deepseek-v4",
        "messages": [{"role": "user", "content": cot_prompt}],
        "temperature": 0.3
    }
)

Auto-CoT: Let the Model Generate Its Own Examples

auto_cot_prompt = """You are an expert problem solver. For the question below:
1. First, generate 3 similar but simpler example problems and solve them
2. Then solve the actual problem using the same approach

Question: {complex_question}

Let's work through this:"""

# Auto-CoT often outperforms manual few-shot on novel problem types

Technique 4: Role-Based Prompting

Assign a specific role to improve output quality and relevance.

roles = {
    "technical_writer": "You are a senior technical writer with 10 years of experience. Write clear, concise documentation.",
    "code_reviewer": "You are a principal engineer at a top tech company. Review code for correctness, performance, and security.",
    "data_analyst": "You are a data scientist specializing in business analytics. Interpret data and provide actionable insights.",
    "legal_advisor": "You are a corporate lawyer. Provide legal analysis with appropriate caveats.",
    "translator": "You are a professional translator fluent in Chinese and English. Preserve tone, nuance, and technical accuracy."
}

# Example usage
prompt = f"""{roles['code_reviewer']}

Review the following Python function for potential issues:

```python
def process_user_data(data):
    query = f"SELECT * FROM users WHERE id = {data['user_id']}"
    return db.execute(query)
```

Identify:
1. Security issues
2. Performance concerns
3. Code style improvements"""
RoleUse CaseQuality Improvement
Technical WriterDocumentation+25% clarity
Senior EngineerCode review+40% issue detection
Data ScientistAnalysis+30% insight depth
Legal AdvisorContract review+20% accuracy

Technique 5: Structured Output (JSON Mode)

Force the model to return valid JSON for programmatic use.

json_prompt = """Analyze the following customer review and return ONLY a JSON object.
Do not include any text before or after the JSON.

Review: "The product is amazing! Shipping was fast but the packaging was damaged. Customer service was helpful."

Return this exact structure:
{
  "sentiment": "positive|neutral|negative",
  "sentiment_score": 0.0 to 1.0,
  "aspects": [
    {
      "aspect": "aspect name",
      "sentiment": "positive|neutral|negative",
      "quote": "relevant quote from review"
    }
  ],
  "key_phrases": ["phrase 1", "phrase 2"]
}"""

response = requests.post(
    f"{BASE_URL}/chat/completions",
    json={
        "model": "glm-4",
        "messages": [{"role": "user", "content": json_prompt}],
        "temperature": 0.1,
        "response_format": {"type": "json_object"}  # Force JSON output
    }
)
Pro Tip: Always include the exact JSON schema in your prompt. Models perform better when they can see the expected structure rather than inferring it.

Technique 6: Self-Consistency

Generate multiple answers and take the majority vote for higher accuracy.

def self_consistent_answer(question, n_samples=5):
    """Generate multiple answers and return the most common one"""
    answers = []
    
    for _ in range(n_samples):
        response = requests.post(
            f"{BASE_URL}/chat/completions",
            json={
                "model": "deepseek-v4",
                "messages": [
                    {"role": "system", "content": "Answer the question concisely."},
                    {"role": "user", "content": question}
                ],
                "temperature": 0.7  # Higher temp for diversity
            }
        )
        answer = response.json()["choices"][0]["message"]["content"]
        answers.append(answer.strip().lower())
    
    # Return most common answer
    from collections import Counter
    most_common = Counter(answers).most_common(1)[0][0]
    return most_common

# Use case: Fact-checking, math problems, classification
# Cost: 5× normal, but accuracy improvement often worth it

Technique 7: Prompt Chaining

Break complex tasks into sequential prompts, using each output as the next input.

def prompt_chain(document):
    """Multi-step document analysis pipeline"""
    
    # Step 1: Extract key facts
    step1 = f"""Extract the 5 most important facts from this document:
    {document}
    
    Return as a numbered list."""
    
    facts = call_llm(step1)
    
    # Step 2: Analyze sentiment
    step2 = f"""Based on these facts, what is the overall sentiment?
    Facts: {facts}
    
    Return: positive, neutral, or negative."""
    
    sentiment = call_llm(step2)
    
    # Step 3: Generate summary
    step3 = f"""Write a 2-sentence summary of this document.
    Key facts: {facts}
    Sentiment: {sentiment}
    
    Summary:"""
    
    summary = call_llm(step3)
    
    return {"facts": facts, "sentiment": sentiment, "summary": summary}

Model-Specific Prompting Tips

DeepSeek-V4

GLM-4

Qwen-Max

Kimi-K2

Common Mistakes to Avoid

MistakeWhy It FailsFix
"Be creative" without constraintsOutput is too randomAdd style guidelines and examples
Overloading contextModel loses track of instructionsUse prompt chaining instead
Inconsistent formattingHard to parse programmaticallyUse JSON mode with schema
Assuming domain knowledgeModel hallucinates factsProvide context or use RAG
Ignoring temperatureToo random or too rigid0.1 for structured, 0.7 for creative

Temperature and Top-P Guidelines

prompt_configs = {
    "structured_extraction": {
        "temperature": 0.1,
        "top_p": 0.1,
        "description": "Low randomness for consistent formatting"
    },
    "factual_qa": {
        "temperature": 0.3,
        "top_p": 0.5,
        "description": "Slightly higher for natural language"
    },
    "code_generation": {
        "temperature": 0.2,
        "top_p": 0.3,
        "description": "Low randomness, deterministic code"
    },
    "creative_writing": {
        "temperature": 0.8,
        "top_p": 0.9,
        "description": "High randomness for creativity"
    },
    "brainstorming": {
        "temperature": 1.0,
        "top_p": 1.0,
        "description": "Maximum diversity for ideas"
    }
}

Testing and Evaluation

def evaluate_prompt(prompt_template, test_cases, model="deepseek-v4"):
    """Systematic prompt evaluation"""
    results = []
    
    for test in test_cases:
        prompt = prompt_template.format(**test["inputs"])
        
        response = requests.post(
            f"{BASE_URL}/chat/completions",
            json={
                "model": model,
                "messages": [{"role": "user", "content": prompt}],
                "temperature": 0.3
            }
        )
        
        output = response.json()["choices"][0]["message"]["content"]
        
        # Check formatting
        format_correct = validate_format(output, test["expected_format"])
        
        # Check content (using another LLM call or heuristic)
        content_score = score_relevance(output, test["expected_content"])
        
        results.append({
            "input": test["inputs"],
            "output": output,
            "format_correct": format_correct,
            "content_score": content_score
        })
    
    avg_score = sum(r["content_score"] for r in results) / len(results)
    format_accuracy = sum(r["format_correct"] for r in results) / len(results)
    
    return {
        "avg_content_score": avg_score,
        "format_accuracy": format_accuracy,
        "details": results
    }

Cost-Effective Prompting

Next Steps

Apply these techniques with TokenEase:

  1. Get your free API key and test different prompting strategies
  2. Start with zero-shot + structured format for simple tasks
  3. Add few-shot examples for complex extractions
  4. Use CoT for reasoning tasks
  5. Measure performance with test suites

For advanced patterns, see our guides on RAG implementation and AI agent development.

Last updated: August 2026. Optimal prompts vary by model version and use case.