Interview Prep
Interview questions, roadmaps and practice sets
Tutorials
Free tutorials on 30+ topics
Blog
Career guides, skills and interview tips
Free PDFs
Notes, cheat sheets and question banks
Certificates
Free skill tests and course certificates
Tools & Whiteboard
Free tools you can use right in the browser
Practice Tests
Mock tests, MCQs and quick Q&A
Free LMS
Learn on the Uncodemy LMS
Choose the best training program according to your career.
Improve the performance of your business with our innovative Industrial Training Program.
Read More →
Our instructor-led training classes are designed to make you an expert.
Read More →
Real-life case studies are a great way to demonstrate your practical knowledge.
Read More →
Explore blogs, latest technologies and industry updates with practical examples.
Read More →Browse all available training programs and choose the right one for your career.
Read More →Know more about who we are and what we stand for.
Discover our mission to equip individuals with essential IT skills and industry expertise.
Read More →
Free tutorials, interview questions, tools and calculators to help you learn.
Explore →Learn, practice and plan your career — bilkul free.
Book a free video counselling session and pick the right course for you.
Read More →Qwen2 is a family of open-weight large language models released by Alibaba Cloud's Qwen team in June 2024. It came in five sizes, from a 0.5-billion-parameter model that runs on a laptop to a 72-billion-parameter model meant for servers, and most sizes were published under the permissive Apache 2.0 licence. This page covers what was in the release, how to run it and how it fits next to the later Qwen2.5 and Qwen3 models.
| Model | Type | Context length (instruct model) | Licence | Typical use |
|---|---|---|---|---|
| Qwen2-0.5B | Dense | 32K tokens | Apache 2.0 | On-device experiments, classification, very light chat |
| Qwen2-1.5B | Dense | 32K tokens | Apache 2.0 | Mobile and edge prototypes, simple extraction |
| Qwen2-7B | Dense | Up to 128K tokens | Apache 2.0 | Local assistant, RAG prototypes, fine-tuning on one GPU |
| Qwen2-57B-A14B | Mixture of experts (about 14B parameters active per token) | 64K tokens | Apache 2.0 | Server use where you want large-model quality at lower compute per token |
| Qwen2-72B | Dense | Up to 128K tokens | Qianwen licence (custom) | Highest quality in the family; multi-GPU servers |
Each size was released as a base model (for fine-tuning) and an instruct model (for chat). The Qwen team reported training data covering 27 languages in addition to English and Chinese, and all sizes use grouped-query attention, which reduces memory use during generation. The longest contexts rely on a scaling technique (YaRN) that the model card explains how to enable.
Check the licence before commercial use. Apache 2.0 allows commercial use with attribution; the 72B model's Qianwen licence has its own terms, so read it on the model page.
You can download the trained weights from Hugging Face or ModelScope and run them on your own hardware, fine-tune them, and deploy them without sending data to Alibaba. What is not published is the full training dataset and training code. That is why many people say "open-weight" rather than "open-source" for models like this.
For a company, the benefits are data control, no per-token API bill and the freedom to fine-tune. The costs are hardware, engineering time and keeping the deployment secure and updated.
ollama run qwen2:7b
Ollama downloads a quantised build and opens a chat in the terminal. Smaller tags such as qwen2:1.5b work on ordinary laptops.
Following the model card (requires a recent transformers, 4.37 or later, and a GPU for reasonable speed):
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "Qwen/Qwen2-7B-Instruct"
model = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype="auto", device_map="auto")
tokenizer = AutoTokenizer.from_pretrained(model_name)
messages = [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Explain overfitting to a B.Tech student in two sentences."},
]
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer([text], return_tensors="pt").to(model.device)
output = model.generate(**inputs, max_new_tokens=200)
new_tokens = output[:, inputs.input_ids.shape[1]:] # drop the prompt
print(tokenizer.batch_decode(new_tokens, skip_special_tokens=True)[0])
The answer will vary from run to run. apply_chat_template formats the messages the way the instruct model was trained to expect; skipping it is a common reason for poor answers.
A rough rule: parameters × bytes per parameter. A 7-billion-parameter model in 16-bit precision needs about 7 × 2 = 14 GB just for weights, plus extra for the context. A 4-bit quantised version needs roughly a quarter of that, which is why quantised 7B models run on consumer GPUs and Apple-silicon laptops. The 72B model needs multiple data-centre GPUs in 16-bit, or heavy quantisation.
Treat published leaderboard results as a starting point only. Test any model on your own prompts and data before choosing it.
Related models on the blog: Qwen2.5-VL for images and documents, the reasoning model QwQ-32B, and how the Qwen Chat app compares with ChatGPT. For the bigger picture, see emerging LLMs you should know.
Sources: Qwen team, "Hello Qwen2" release blog (June 2024); Qwen2 model cards on Hugging Face; Ollama model library.