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
- LLM fundamentals & architecture
- Tokens, tokenization & context windows
- Prompt engineering
- Reasoning models & test-time compute
- Multimodal AI: vision, audio, video
- RAG & retrieval
- Embeddings & vector search
- AI agents & tool use
- Structured output & function calling
- Fine-tuning & post-training
- Local inference errors, string by string
- Running local models day to day
- Testing code that calls an LLM
- Snapshot and property testing for model output
- Regression suites for prompts
- Eval gates in CI
- Flaky tests against a model
- Determinism and the cost of testing
- Contract and streaming tests
- Testing tool calls and retrieval
- Inference, serving & latency
- Rolling out a prompt change
- Testing AI systems in practice
- Forecasting a time series
- Machine learning on tabular data
- Geospatial data and models
- Understanding audio that is not speech
- Understanding video
- Core computer vision tasks
- Machine learning on graphs
- Point clouds and 3D
- Evaluation, benchmarks & LLM-as-judge
- Sensor and IoT data
- Logs and event streams
- Models over biological sequences
- Machine learning on molecules
- Embedding and searching code
- Extracting invoices and purchase orders
- Receipts, statements and tax forms
- Insurance policies and contracts
- Deeds, court filings and patents
- Extracting from medical records
- Observability & LLMOps
- CVs, certificates and identity documents
- Shipping, customs and technical documents
- Meetings, email, chat and filled-in forms
- Building an extraction pipeline
- Business, property and inspection documents
- Contract clauses and insurance claims
- Regulated and compliance documents
- Consumer, travel and closing documents
- Mapping one chat API onto another
- SDK and framework migrations
- Hallucination & failure modes
- Re-embedding and model deprecation
- Cutting over between providers
- Parity gaps, shims and legacy endpoints
- Moving between model versions
- Migrating vector stores and caches
- Mapping capabilities and parameters
- Migrating pipelines and agents
- Contracts, runbooks and rollback
- Auditing a codebase before a cutover
- Compliance and fine-tune migration
- LLM cost engineering
- Routing, cost tracking and multi-tenancy
- What a migration does to your prompts
- AI security & prompt injection
- Privacy, compliance & data residency
- AI governance, policy & society
- Building reliable AI applications
- AI hardware, GPUs & compute
- Open-weight models & local inference
- AI for developers & coding agents
- AI in industry: vertical playbooks
- AGI, superintelligence, alignment & the long future
- Machine learning foundations
- NLP fundamentals & classical tasks
- Data engineering for AI
- Synthetic data & dataset curation
- AI product design & UX
- Search, ranking & recommendation
- Enterprise adoption & change management
- AI careers, skills & teams
- Reading AI research
- AI in science & discovery
- Robotics & embodied AI
- AI economics, markets & business models
- AI myths, hype & media literacy
- Context engineering
- Shipping AI features: patterns & anti-patterns
- Build it: end-to-end AI tutorials
- Python for AI: hands-on recipes
- TypeScript, React and the web
- Frameworks and SDKs
- Errors and troubleshooting
- AI facts, numbers and statistics
- The history of AI
- The maths behind AI
- Architectures beyond the transformer
- Reinforcement learning
- Diffusion and generative media
- Speech, audio and voice engineering
- Benchmarks, one at a time
- AI search visibility
- Infrastructure and operations
- Databases and storage for AI
- Knowledge graphs and structured knowledge
- Classical ML in production
- Regulation, jurisdiction by jurisdiction
- Prompt recipes and pattern library
- AI for people who do not write code
- Writing, media and creative work
- Edge and on-device AI
- Interpretability and model internals
- Field notes
- OpenAI model behaviour
- Claude model behaviour
- Gemini model behaviour
- Llama model behaviour
- Mistral model behaviour
- DeepSeek model behaviour
- Cohere model behaviour
- Grok model behaviour
- Small model behaviour
- Hybrid model architectures
- Token cost by language and script
- Transliteration, romanization and script handling
- Locale-correct output
- Multilingual generation quality
- Multilingual pipelines
- The EU AI Act, article by article
- AI under the GDPR and EU data law
- US AI regulation, state and sector
- International AI governance and standards
- AI litigation and enforcement
- Running AI workloads on AWS
- Running AI workloads on Google Cloud
- Running AI workloads on Azure
- AI at the edge: Workers, Vercel and Netlify
- Serving models on Kubernetes
- Operating AI infrastructure
- Quantization formats and what they cost
- llama.cpp, flag by flag
- Ollama and the desktop local-model runtimes
- Local models on Apple Silicon
- Hardware for local inference
- Running speech and embedding models locally
- Model files, adapters and conversion
- VRAM arithmetic for local models