🧩

Alibaba Qwen

Qwen is Alibaba Cloud's family of open-weight large language models, spanning sizes from under a billion parameters up to hundreds of billions, plus specialized coding and vision variants. It sits at roughly #13 in real-world usage share (about 5.2%), driven less by a flagship chat app and more by how often developers download and fine-tune its open weights. Qwen is best known for unusually strong bilingual Chinese/English performance and for serving as a popular base model that the open-source community builds custom fine-tunes on top of.

Quick facts
Made by: Alibaba Cloud (Qwen Team)
Access: Open weights (Apache 2.0 / Qwen license, most sizes) on Hugging Face and Ollama, plus a paid hosted API via Alibaba Cloud's DashScope
Context window: Up to ~131,072 tokens on the larger Qwen2.5 models
Strengths: Bilingual Chinese/English fluency, strong coding (Qwen2.5-Coder) and math performance, wide range of sizes for different hardware
Primary use case: Self-hosted or fine-tuned deployments, multilingual apps, and coding assistants
Jump to: ExampleGetting startedBest for

Example

Qwen can be run locally through Ollama in one command, or called through the OpenAI-compatible transformers/DashScope APIs. Here's a local chat completion using the transformers library.

from transformers import AutoModelForCausalLM, AutoTokenizer

model_name = "Qwen/Qwen2.5-7B-Instruct"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name, device_map="auto")

messages = [{"role": "user", "content": "Explain what a REST API is in two sentences."}]
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)

inputs = tokenizer([text], return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=200)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))

Getting started

The fastest path is running a quantized Qwen model locally with Ollama — no API key or account needed.

# 1. install Ollama from ollama.com, then pull and run Qwen2.5
ollama run qwen2.5

# 2. or install transformers to load weights directly from Hugging Face
pip install transformers accelerate

# 3. or use Alibaba Cloud's hosted DashScope API for the largest models
# sign up at dashscope.aliyun.com and get an API key
Best for: Teams that want to self-host or fine-tune an open-weight model rather than depend on a closed API — especially projects needing strong Chinese-language support, a dedicated coding model (Qwen2.5-Coder), or a small model that runs on a single consumer GPU.