Back to blog
ChatGPT19 min read

How to Prompt Qwen Models

Qwen prompting verified against Alibaba's own docs: the six-part framework it publishes, thinking-mode switches, the sampling settings its model cards give, and 30 copy-paste prompts.

NH
Nafiul Hasan
Founder, Prompt Architects

TL;DR: Alibaba does publish official Qwen prompting guidance, on two sites, and it is a plain six-element framework with hash-marked sections. The Qwen-specific parts are the thinking-mode switches, the sampling settings on the open-weight model cards, and the translation controls. Everything below is quoted with a URL and an access date.

Most pages ranking for Qwen prompting were written against models that are two or three generations old. Alibaba's own community docs at qwen.readthedocs.io still document Qwen3, while the model cards Alibaba shipped in August 2026 are Qwen3.8 (both checked 29 August 2026). So before any technique, the landscape.

Which Qwen models are current in August 2026?

The current generation is Qwen3.8. Model Studio's recommended-models page, last updated 26 August 2026, lists qwen3.8-max, qwen3.7-plus and qwen3.8-flash for text generation, qwen3.5-omni-plus for omni-modal work, and qwen-image-3.0-pro for image generation.

The split that matters for prompting is hosted versus open weights, because the two are not the same model with the same defaults.

Hosted vs open weights, from Model Studio and the Hugging Face model card (29 Aug 2026)
FeatureHosted qwen3.8-maxOpen-weight Qwen3.8-27B
Where it runsModel Studio / QwenCloud APIYour hardware, via Transformers, vLLM, SGLang
Context window1M tokens262,144 native, extensible to 1,000,000
Thinking modeHybrid, enabled by defaultOn by default, disableable per request
Published sampling settingsRange only, no recommended valuesTwo named sets on the model card
Structured outputJSON Object and JSON SchemaJSON Object
Licence on the cardNot applicableapache-2.0

Open weights currently in the Qwen org include Qwen3.8-27B, Qwen3.8-2.4T-A95B and Qwen3.8-Flash-Next, plus quantised FP8 and GPTQ variants and the older Qwen3.5, Qwen3.6 and Qwen3 families. The flagship hosted IDs are API-only: the Qwen3.8-2.4T-A95B card states that Qwen3.8-Max is the official version built on it "with more features, such as vision input & non-thinking support, 1M context length by default, official built-in tools, etc."

Self-hosting is therefore genuinely possible. Hardware requirements are a separate question and Alibaba does not publish a minimum VRAM figure on these cards, so do not trust one you find quoted.

Does Alibaba publish an official Qwen prompting guide?

Yes, and it publishes two, which is more than most vendors manage. Neither is easy to find from a search engine, which is why so much Qwen advice online is invented.

  1. Alibaba Cloud Model Studio, Text-to-text prompt guide — last updated 26 August 2026.
  2. QwenCloud, Text-to-text, filed under Accuracy tuning.

They teach the same material. The QwenCloud version is the cleaner read and carries a worked multilingual example the Model Studio version does not.

What neither publishes is a Qwen-specific prompt grammar. There is no magic delimiter, no special token, no vendor-blessed keyword that unlocks a mode. If a page tells you Qwen needs a particular syntax that no Alibaba page mentions, that syntax was made up.

What prompt framework does Alibaba actually document?

Six labelled elements: Context, Objective, Style, Tone, Audience, Response. QwenCloud presents them as a checklist and tells you to mark each with a hash delimiter.

Those six are, element for element, the CO-STAR framework, which originated at GovTech Singapore in 2023. Alibaba never uses that name. If you already write CO-STAR prompts, you are already writing prompts the way Qwen's vendor recommends.

The guide's own framing is blunt about priority: "Clear, specific prompts are the single most important factor in getting useful output from an LLM." It opens with "Vague prompts produce vague results."

#Context#
[BACKGROUND THE MODEL CANNOT INFER]

#Objective#
[THE ONE TASK, STATED AS AN IMPERATIVE]

#Style#
[WHOSE WRITING IT SHOULD RESEMBLE]

#Tone#
[FORMAL / CONVERSATIONAL / CONSTRUCTIVE]

#Audience#
[WHO READS THE OUTPUT AND WHAT THEY ALREADY KNOW]

#Response#
[EXACT OUTPUT SHAPE, INCLUDING LENGTH]

Alibaba adds a caveat worth repeating: "Not every prompt needs all six elements. Adapt the framework to your task."

The other documented techniques are unglamorous and effective. Provide output examples. Break complex tasks into explicit numbered steps. Separate blocks of content with delimiters, using "character sequences that rarely appear in natural language" such as ###, === or >>>. And for reasoning, either ask for chain-of-thought or chain prompts across turns, where QwenCloud notes that "Prompt chaining takes more effort to set up than CoT but performs better and has higher accuracy."

How do you control Qwen's thinking mode?

This is the one Qwen-specific control that changes output the most, and the defaults are not uniform.

enable_thinking is the switch. On the OpenAI-compatible SDKs it is not a standard parameter, so it goes in extra_body. Over raw HTTP it sits at the top level of the request body. Thinking output comes back in reasoning_content, separate from content.

Three things trip people up:

Defaults differ by model. Model Studio's deep-thinking page lists the Qwen3.8 Max and Flash series as hybrid with thinking enabled by default, while the older Qwen3 Max, Plus, Flash and Turbo series are hybrid with thinking disabled by default. Some models cannot be switched at all: anything with a -thinking suffix is thinking-only, and models with an -instruct suffix show thinking mode as unsupported.

There is a prompt-level switch, with a narrow scope. QwenCloud documents it in one line: "With enable_thinking: true, add /no_think to skip thinking for one turn. /think restores it. Last instruction wins. Supported by open-source Qwen3 hybrid models and qwen-plus-2025-04-28." Note the scope. It is not documented for Qwen3.8.

Depth is budgeted two ways, and they conflict. thinking_budget caps reasoning tokens; reasoning_effort sets a level. For Qwen3.8 the levels are low, medium and xhigh, defaulting to xhigh, and QwenCloud is explicit that qwen3.8-max "does not support setting reasoning_effort and thinking_budget simultaneously — doing so returns an error."

The 27B model card adds the counterintuitive part: "In multi-turn agentic tasks, lower reasoning effort does not always reduce overall task completion time." Less thinking can mean more retries.

What sampling settings does Qwen's own model card recommend?

Unusually, the open-weight cards publish exact numbers, and the two modes differ sharply.

SettingThinking modeInstruct / non-thinking mode
temperature1.00.7
top_p0.950.80
top_k2020
min_p0.00.0
presence_penalty0.01.5
repetition_penalty1.01.0

Source: the Qwen/Qwen3.8-27B and Qwen/Qwen3.8-Flash-Next model cards, Hugging Face, accessed 29 August 2026. The card also warns that "the support for sampling parameters varies according to inference frameworks", and that raising presence_penalty to fight repetition "may occasionally result in language mixing and a slight decrease in model performance."

The hosted reference does give a hard range: temperature must be greater than or equal to 0 and less than 2, and top_p sits in the interval above 0 up to 1.0. If you want the underlying mechanics rather than the numbers, see temperature, top-p and top-k explained.

How should you prompt Qwen across Chinese and English?

This is where Qwen earns its reputation, and where Alibaba's guidance is most concrete.

The vendor's own worked example is a Qwen3.5-Flash HR assistant that kept answering in the wrong language. The fix was structural, not lexical. The original prompt buried "Respond in the same language as the user's question" inside a general limitations list. The rewrite promoted it to its own labelled #Multilingual requirements# section and added an explicit #Response# rule to match output language to input language. QwenCloud attributes the fix directly: the change worked "because the model could clearly identify the multilingual instruction as a distinct, high-priority directive rather than a buried afterthought."

That generalises. A language rule competing with nine other bullets in a constraints block is a rule the model will drop first. Give it a heading. The same instinct applies to non-English prompting generally.

For translation specifically, Alibaba ships a separate fine-tune rather than asking you to prompt around it. Qwen-MT supports 92 languages and exposes three controls that are more reliable than prose instructions:

  • terms — a glossary of source/target pairs, so brand and product names translate identically every time.
  • tm_list — translation memory, source/target sentence pairs the model imitates for style.
  • domains — a domain prompt that sets register, for example legal formality versus social-media casualness. QwenCloud flags a real limit: "Domain prompts currently support only English."

Qwen-MT accepts a maximum of 8,192 input tokens, so long documents must be segmented at paragraph boundaries rather than character counts.

How do you get valid JSON out of Qwen?

Two documented modes, with different requirements and different model coverage.

JSON Object mode sets response_format to {"type": "json_object"}. It guarantees valid JSON but not a specific shape, and it has a gotcha: the messages must contain the word "JSON" somewhere, or the API rejects the call. Supported broadly across Qwen, Kimi, GLM and DeepSeek models on the platform.

JSON Schema mode sets response_format to a json_schema object with strict: true, needs no keyword, and enforces the shape. Coverage is narrower: as of 29 August 2026 QwenCloud lists the Qwen3.8-Max, Qwen3.8-Flash, Qwen3.7-Max and Qwen3.7-Plus series, with "More models are coming soon."

There is a trap for thinking models. QwenCloud warns that models labelled non-thinking-mode in its support list "may return content that is not strictly valid JSON" once thinking mode is switched on, and recommends a two-step repair: generate with the thinking model, then pass malformed output through a model that supports JSON Object mode. Its prompt advice is to describe the schema in words as well, naming field types, required versus optional status and format constraints, with examples. If you want the general technique rather than the Qwen API detail, see prompting for tables and structured data.

How do you prompt Qwen over long documents and code?

The current Qwen3.8 and Qwen3.7 hosted models all carry a 1M-token context window. Model Studio's own gloss: 1 million tokens is roughly 750,000 English words. Beyond that there is qwen-long, documented at a 10,000,000-token context window with an 8,192-token maximum output, though HTTP requests cap at 1M tokens and Alibaba recommends file submission above that.

If you self-host, read the card's long-context warning before you copy a config. Extending Qwen3.8-27B past its native 262,144 tokens uses YaRN, and the card notes that "All the notable open-source frameworks implement static YaRN, which means the scaling factor remains constant regardless of input length", with a caution that this can hurt performance on shorter texts. Turn it on only when you actually need the length.

For code there is a small feature most people miss. Partial mode makes the model continue from a prefix rather than restart: you append an assistant message carrying the prefix and set its partial field to true. QwenCloud is explicit that "Thinking mode does not support prefix continuation", so pair it with a non-thinking model. Alibaba also ships Qwen Code, its own terminal coding tool, and the Qwen3.8-Flash description notes compatibility with both OpenAI and Anthropic API protocols.

How do you prompt Qwen-VL for images and video?

Two settings do most of the work, and neither is a prompt.

vl_high_resolution_images raises the visual-token ceiling. With it true on the Qwen3.5 and later series, a single image can use up to 16,384 visual tokens; with it false, which is the default, the ceiling follows max_pixels, defaulting to 2,621,440. Fine print, small objects and dense receipts need the higher setting.

Thinking defaults differ again: Alibaba states thinking is off for qwen3-vl-plus and qwen3-vl-flash, and on for the Qwen3.5 and later series. Qwen3-VL covers 33 languages for text extraction and adds 3D localisation on top of 2D bounding boxes.

The prompts themselves are ordinary. Alibaba's own worked examples are things like "Please solve the math problem in the image step by step" and an extraction prompt that names the exact fields wanted and ends with "Please output in JSON format."

How do you write tool descriptions Qwen will actually use?

Pass tools through the tools parameter. Alibaba's guidance is that the model relies on the description fields to pick the tool and pull the arguments, so description quality is prompt quality: "When the model selects the wrong tool or extracts wrong parameters, refine descriptions and system prompts before upgrading models."

Its other published rules for tool use are operational. Keep the candidate set to no more than 20 tools and route with a pre-filter above that. Default to read-only tools. Require human confirmation for irreversible actions. And note that tool descriptions are billed as input tokens on every call.

If you need direct control, Alibaba documents the system-message form too, with tool signatures wrapped in <tools> tags and each call returned as JSON inside <tool_call> tags. Use it only when the tools parameter genuinely will not do, since the documented recommendation is the parameter.

With thinking mode on, tool_choice supports only "auto" or "none", and you must pass reasoning_content back in subsequent requests.

30 copy-paste Qwen prompt templates

Square-bracket slots are placeholders. These are prompt bodies, not measured results.

Framework starters

1. Full six-element frame

#Context#
[WHAT THE MODEL CANNOT INFER: system, audience, prior decisions]

#Objective#
[ONE TASK, IMPERATIVE MOOD]

#Style#
Write as [ROLE WITH [N] YEARS IN [DOMAIN]].

#Tone#
[FORMAL / DIRECT / CONSTRUCTIVE]

#Audience#
[WHO READS IT AND WHAT THEY ALREADY KNOW]

#Response#
[FORMAT], at most [N] [UNITS]. No preamble.

2. Minimal three-element frame

#Objective#
[TASK]

#Audience#
[READER]

#Response#
[EXACT SHAPE AND LENGTH]

3. Delimited source block

Summarise each section below separately, one sentence per section.

===
[SECTION 1]
===
[SECTION 2]
===
[SECTION 3]
===

4. Explicit steps

#Objective#
[GOAL]

#Steps#
1. [FIRST INTERMEDIATE RESULT]
2. [SECOND, USING THE FIRST]
3. [FINAL ANSWER, USING BOTH]

Show each step's result before moving to the next.

Chinese, English and multilingual

5. Language rule as its own section

#Context#
[TASK BACKGROUND]

#Multilingual requirements#
- Detect the language of the user's message.
- Answer in that same language, in full.
- Do not switch language mid-answer, even for technical terms.

#Response#
[FORMAT]

6. Retrieve in one language, answer in another

#Multilingual requirements#
- Translate the question into [SEARCH LANGUAGE] to search the source below.
- Convert the retrieved content back into the question's language for output.

======
[SOURCE DOCUMENTS]
======

#Objective#
[QUESTION]

7. Chinese-English terminology lock

#Objective#
Translate the text below from [SOURCE] into [TARGET].

#Terminology#
Use exactly these renderings and no synonyms:
- [SOURCE TERM] -> [TARGET TERM]
- [SOURCE TERM] -> [TARGET TERM]

#Response#
Translation only. No notes, no alternatives.

8. Register control

#Objective#
Rewrite the text below for [TARGET LOCALE].

#Tone#
[LEGAL FORMALITY / SOCIAL-MEDIA CASUAL / TECHNICAL NEUTRAL]

#Response#
Keep paragraph breaks and numbering. Do not add or omit information.

9. Bilingual side-by-side output

#Objective#
Produce [SOURCE] and [TARGET] versions of the copy below.

#Response#
A two-column table. Left column [SOURCE], right column [TARGET].
One row per sentence. No merged rows.

Thinking control

10. Force a visible plan before the answer

Before answering, list the sub-questions you must resolve, numbered.
Then answer each in order.
Then give the final answer in one paragraph, prefixed ANSWER:.

Question: [QUESTION]

11. Skip thinking for a trivial turn

[SHORT FACTUAL QUESTION] /no_think

12. Restore thinking mid-conversation

That last answer was too shallow. Redo it. /think

13. Budget the reasoning

#Objective#
[COMPLEX TASK]

#Constraints#
- Spend your reasoning on [THE ONE HARD PART], not on restating the question.
- Final answer must be at most [N] words regardless of reasoning length.

Long documents

14. Grounded analyst frame

Work only from the document above. Every claim must be traceable to a
verbatim span in it. If the answer is not present, output exactly:
NOT IN SOURCE.

#Objective#
[QUESTION]

#Response#
At most [N] bullets, one sentence each, each ending with a quote of
8-25 words as evidence.

15. Structural map first

Before answering anything, output a structural map of the document above:
every top-level heading in order, each with a one-line description.
Then wait for my question.

16. Multi-document attribution

You have [N] documents above, in this order: [DOC A], [DOC B], [DOC C].

Prefix every claim with the document it came from, as [DOC NAME]: claim.
Never merge facts from two documents into one sentence without naming both.

#Objective#
[QUESTION]

17. Segment boundary instruction

This is segment [K] of [N] from [DOCUMENT NAME].
Do not summarise the whole document. Extract only:
- [FIELD 1]
- [FIELD 2]
Return "none in this segment" for any field that is absent.

Structured output

18. Schema in the system message

Extract information from the user input and output it in this JSON structure:

{
  "[FIELD]": "[TYPE], required, [MEANING]",
  "[FIELD]": "[TYPE], optional, omit entirely if absent"
}

Rules:
1. [EXTRACTION RULE]
2. Omit optional fields entirely rather than emitting null.
Output JSON only.

19. JSON Object mode keyword

Return the result as JSON matching the shape described above.
Output JSON and nothing else. No code fence, no commentary.

20. Few-shot for optional fields

Example 1 (field present):
Q: [INPUT]
A: [JSON WITH FIELD]

Example 2 (field absent):
Q: [INPUT]
A: [JSON WITHOUT FIELD]

Now parse:
Q: [REAL INPUT]

21. Repair pass for malformed JSON

The text below was meant to be JSON matching this schema:
[SCHEMA]

Repair it into valid JSON. Do not change any value. Do not invent fields.
Output JSON only.

===
[MALFORMED OUTPUT]
===

Code

22. Specific code request

Write a [LANGUAGE] function that [BEHAVIOUR].
Input: [SHAPE]. Output: [SHAPE].
Include type hints, handle [FAILURE CASE], and use only [ALLOWED LIBRARIES].

23. Prefix continuation setup

Complete the function below. Do not add anything else, no explanation,
no imports beyond what is shown.

24. Code review frame

#Context#
Reviewing a pull request in a [STACK] service.

#Objective#
Identify security, correctness and performance problems in the diff below.

#Audience#
[JUNIOR / SENIOR] engineers on the team.

#Response#
Numbered findings. For each: the line, why it matters, a suggested fix.
Say "no issues found" rather than inventing one.

25. Repository question with a boundary

Answer only from the files pasted above. If the answer depends on a file
that is not here, name the file you would need and stop.

#Objective#
[QUESTION ABOUT THE CODEBASE]

Vision

26. Field-named extraction

Extract the following from the image: ['[FIELD 1]', '[FIELD 2]',
'[FIELD 3]']. If a field is unreadable, return "unreadable" for it.
Please output in JSON format.

27. Step-by-step visual reasoning

Solve the problem in the image step by step. State each step's result
before the next. Give the final answer on its own line prefixed ANSWER:.

28. Layout to code

Build a single HTML file with inline CSS matching the layout in the image.
Main colour [HEX]. Match spacing and hierarchy, not pixel-exact placement.
Do not invent copy: use lorem ipsum where the image text is illegible.

Tool use and agents

29. Tool description template

name: [verb_noun]
description: Use when the user asks about [SITUATION]. Do not use for
[NEAR-MISS SITUATION]; use [OTHER TOOL] instead.
parameters:
  [PARAM]: [TYPE]. [WHAT GOOD LOOKS LIKE, WITH AN EXAMPLE VALUE]

30. Confirmation gate for writes

You may call read-only tools freely.
Before any tool that writes, sends or deletes, output a one-line plan
prefixed CONFIRM: and stop. Wait for my approval before calling it.
Free Chrome Extension

Stop rewriting prompts. Start shipping.

Works with ChatGPT, Claude, Gemini, Grok, Midjourney, Ideogram, Veo3 & Kling. 5.0★ on the Chrome Web Store.

Create An Account

Does Prompt Architects support Qwen?

Straight answer: not as a named integration. As of 29 August 2026 our /integrations page lists ChatGPT, Gemini, Claude, Grok, Perplexity, Kimi, Merlin, V0.Dev, Bolt, Lovable, Base44 and our MCP server. Qwen is not on it, and the word does not appear on /integrations, /features or /faq.

What that means in practice: the in-page enhance menu that appears on the platforms above does not appear on Qwen's own chat surface. The prompts themselves are portable, and the same page says so, offering "Works with any AI tool" and noting that enhanced prompts "work anywhere — just copy and paste", with Local LLMs listed among the targets. If you self-host Qwen3.8-27B, that is the path.

Our own free plan is 5 prompt enhancements per day, forever, per the FAQ page (checked 29 August 2026). If Qwen is your daily driver and you want the extension to light up inside it, that is a feature request rather than a shipped feature, and we would rather say so than imply coverage we do not have. The same honesty applies to the DeepSeek templates page.

The short version

Qwen prompting is mostly ordinary prompting done carefully, with four vendor-specific levers on top: the thinking switch and its per-model defaults, the sampling sets on the open-weight cards, the JSON mode split, and the translation controls in Qwen-MT. Alibaba publishes all four. What it does not publish is a special syntax, a language count for the general chat models, or hardware requirements for self-hosting. Anyone who gives you those numbers is guessing.

Check the model IDs before you copy anything, including this page. Qwen has shipped four numbered generations since Qwen3, and the community documentation has not kept up.

Frequently asked questions

Free Chrome Extension

Stop rewriting prompts. Start shipping.

Works with ChatGPT, Claude, Gemini, Grok, Midjourney, Ideogram, Veo3 & Kling. 5.0★ on the Chrome Web Store.

Create An Account