Skip to content

Qwen model behaviour

The Qwen family's licences, sizes, sampling parameters and multilingual behaviour, for people running or calling them rather than reading about them.

Qwen is unusual among the large families in that you meet it in three different places, and they do not behave the same. There are the open weights on Hugging Face, which you serve yourself and which obey whatever your serving framework decides about stop tokens and rope scaling. There is Alibaba’s hosted API, which has its own request shape, its own streaming semantics and its own model names. And there is the OpenAI-compatible endpoint in front of that API, which looks like somebody else’s API and quietly differs in the corners. Most of the confusing Qwen behaviour people hit is one of those three answering a question that was asked of another.

These pages therefore name the artefact before they name the number. Each one starts from a documented value in a model card, a config.json, a chat template or Alibaba’s API reference, and then explains what has to be true of your runtime for that value to hold. Where a figure is expected to move — a licence, a hosted model’s cap, a default — it is marked as such rather than asserted.

Qwen2.5's Context Window and the YaRN Extension

The documented context and generation lengths for each Qwen2.5 size, and the config change that is required before the longer number is real.

9 min read

Qwen's ChatML Chat Template

The exact token sequence Qwen's chat template produces, what add_generation_prompt changes, and the four ways hand-built prompts get it wrong.

9 min read

Qwen's Tokenizer Vocabulary Size

Why Qwen reports three different vocabulary numbers, what the padding is for, and how to measure its token count against Llama's on your own text.

8 min read

Function Calling in Qwen: The Hermes-Style Tool Call Convention

The tool-call convention Qwen's chat template implements, shown as the raw prompt the model actually sees and the raw text it emits back.

10 min read

Qwen2.5-Coder's Context Window and Output Cap

The documented context and generation limits for each Qwen2.5-Coder size, and why the output cap binds long before the context does on code tasks.

10 min read

Qwen3's Thinking Mode: The <think> Tag Convention

What a raw Qwen3 completion looks like in thinking mode, how to separate the reasoning block from the answer, and why the block must not go back into history.

10 min read

Qwen's License: Which Sizes Are Apache 2.0

Which Qwen checkpoints ship under Apache 2.0 and which carry a bespoke Alibaba licence instead, and how to verify it for the exact repository you are pulling.

9 min read

Streaming Output in Qwen: DashScope and OpenAI-Compatible Endpoints

The two streaming wire formats Alibaba exposes for the same model, and the incremental-output default that makes one of them repeat itself.

12 min read

Why a Qwen Model Keeps Generating Past Its Stop Token

The model emits <|im_end|> and carries on inventing a user turn: the EOS mismatch between Qwen's base and instruct checkpoints, and where each serving stack loses it.

9 min read

Qwen's Default System Prompt When None Is Provided

The exact string Qwen2.5's chat template inserts when your request has no system message, why Qwen3 stopped inserting it, and what changes when you override it.

9 min read

Qwen2-VL's Image and Video Input: Dynamic Resolution

How naive dynamic resolution turns an image of any size into a variable number of visual tokens, and how min_pixels and max_pixels let you buy quality with context.

10 min read

Qwen3's Mixture-of-Experts Sizes and Active Parameter Counts

Total versus active parameters for the Qwen3 MoE checkpoints, where the active number comes from, and the two costs it does not predict.

8 min read

Qwen's Deprecation Cadence on Alibaba Cloud's Hosted API

The three model-name forms DashScope serves, what each one promises about staying still, and how a Qwen retirement reaches you.

8 min read

Qwen2.5's 1M-Token Context Variant

Which Qwen2.5 checkpoints reach a million tokens, what their config changes, and the serving requirements that come with it.

8 min read

Parallel Tool Calls in Qwen

How Qwen emits several tool calls in one turn, and the two different conventions for matching results back depending on how you serve it.

9 min read

Qwen3's enable_thinking Parameter

What the flag changes in the chat template, how the output shape differs with it on and off, and where to pass it in each inference stack.

9 min read

The repetition_penalty Parameter in Qwen and How It Interacts With Sampling

The documented formula for repetition_penalty, its sign asymmetry, and why it changes which tokens survive top-p rather than only their odds.

9 min read

Qwen's Max Output Tokens: Lower Than Its Context Window

Why every Qwen endpoint publishes a generation ceiling well below its context window, and what the two numbers each constrain.

8 min read

Pinning a Qwen Checkpoint Instead of a Moving Alias

How to pin a Hugging Face revision hash and a DashScope dated snapshot, and which parts of each still move after you have.

9 min read

When Qwen Refuses to Answer

The two entirely different things a Qwen refusal can be, how to tell them apart in code, and why one of them does not exist on open weights.

8 min read

JSON Output Mode in Qwen

The three levels of JSON constraint available to Qwen — prompting, json_object mode and schema-guided decoding — and what each one actually guarantees.

9 min read

Qwen3's Dense and MoE Variants: What the Model Name Tells You

How to read a Qwen3 model name — size, sparsity, variant and quantisation — and what each segment predicts about cost and hardware.

8 min read

Other topics