Skip to main content
Browse Models

Alibaba Cloud

Qwen 2 7B

Released

2024-06-07

Family

Qwen 2

Type

Foundation Model

Downloads

External Download

You are about to open a link to an external source. Verify the URL before continuing.

Download

Instruct model, 4-bit GGUF (Q4_K_M)

GGUF · Qwen2-7B-Instruct-Q4_K_M.gguf

Instruct model, 5-bit GGUF (Q5_K_M)

GGUF · Qwen2-7B-Instruct-Q5_K_M.gguf

Instruct model, 6-bit GGUF (Q6_K)

GGUF · Qwen2-7B-Instruct-Q6_K.gguf

Instruct model, 8-bit GGUF (Q8_0)

GGUF · Qwen2-7B-Instruct-Q8_0.gguf

Ollama Model (q4_K_M)

Ollama

Model Report

Overview

Qwen2-7B is a 7.6 billion parameter generative language model developed as part of the Qwen2 series by the Qwen team. Positioned as a foundational model rather than a ready-to-deploy chatbot, Qwen2-7B is intended primarily for further post-training, such as supervised fine-tuning (SFT), reinforcement learning from human feedback (RLHF), or continued pretraining. The architecture, multilingual support, and rigorous evaluation position Qwen2-7B as a platform for research and applied natural language processing across diverse domains, as detailed in the Qwen2 blog post and the QwenLM GitHub repository.

Qwen2 banner logo, purple on black background

Figure 1. Header image from the Qwen2 announcement, visually representing the series’ brand and modern aesthetic.

Architecture and Technical Design

Qwen2-7B is implemented as a decoder-only Transformer model, incorporating features to optimize efficiency and linguistic adaptability. The architecture utilizes SwiGLU activations, attention QKV bias, and Group Query Attention (GQA), a technique implemented across the Qwen2 suite to enable faster inference and lower memory usage, as described in the QwenLM documentation. The improved tokenizer is engineered for high adaptability across numerous natural languages and programming codes.

The pretraining context length is 32,000 tokens, allowing the model to process extended inputs in a single sequence. Qwen2-7B exhibits extrapolation up to 128,000 tokens in perplexity-based evaluations. This capability is further extended in the instruction-tuned variant, Qwen2-7B-Instruct, particularly when augmented with mechanisms like YARN for long-context tasks, as evaluated in the Needle in a Haystack Evaluation.

Multilingual Pretraining and Data

A central focus of Qwen2-7B's development was comprehensive multilingual coverage. The model was trained using a balanced and diversified dataset spanning 29 languages. Alongside English and Chinese, training incorporated substantial text in languages such as German, French, Spanish, Russian, Arabic, Japanese, Korean, Vietnamese, and Hindi, among others. This breadth enables enhanced cross-lingual capabilities and improved code-switching performance for both monolingual and mixed-language inputs, as noted in the Qwen2 blog post.

Notably, the pretraining corpus for Qwen2 benefited from improved dataset curation over previous generations. Datasets included both standard natural language corpora and collections of programming code, supporting superior results in coding benchmarks.

Benchmarking and Evaluation

Qwen2-7B was systematically evaluated against other models such as Mistral-7B, Gemma-7B, Llama-3-8B, and its predecessor Qwen1.5-7B. Across diverse benchmarks, Qwen2-7B demonstrates competitive or superior performance, especially in coding, mathematics, and Chinese language tasks.

Instruction-tuned versions, notably Qwen2-7B-Instruct, show the ability to process very long contexts (up to 128,000 tokens) with high factual retrieval accuracy. In the "Needle in a Haystack" task, Qwen2-7B-Instruct maintains robust information extraction capacity across a broad range of context lengths, as shown in the Needle in a Haystack Evaluation.

Qwen2-Instruct models heatmap: Long-context retrieval

Figure 2. Heatmaps visualizing Qwen2-Instruct models’ accuracy in the Needle in a Haystack task. Qwen2-7B-Instruct maintains high accuracy even at context lengths up to 128K tokens.

Evaluation results indicate Qwen2-7B performs strongly relative to peer models in the following domains:

  • General knowledge (MMLU, MMLU-Pro, GPQA)
  • Problem-solving (TheoremQA, BBH)
  • Coding (HumanEval, MBPP, MultiPL-E)
  • Mathematics (GSM8K, MATH)
  • Chinese and other multilingual tasks (C-Eval, CMMLU, Multi-Exam, Multi-Understanding)

For example, Qwen2-7B achieves a score of 51.2 on the HumanEval coding benchmark and 79.9 on GSM8K for grade-school mathematics, outperforming several similarly sized models, as detailed in the Qwen2 blog post. Across most multilingual and Chinese tasks, it typically leads or matches the highest scores among its peer group.

Training Methods and Model Development

The Qwen2-7B model leverages carefully curated datasets and a sequence of training methodologies. While the base model is suited for further adaptation, instruction-tuned variants undergo additional alignment using instruction-following datasets and scalable oversight techniques. Human alignment is realized through methods including rejection sampling in mathematics, execution feedback in coding, and back-translation for creative writing tasks.

The training process utilizes a mix of supervised fine-tuning and reinforcement learning, alongside innovations such as the Online Merging Optimizer, which targets minimization of the "alignment tax"—a reduction in model ability due to post-training alignment, as discussed in the Qwen2 blog post.

For scaling to long contexts, approaches such as YARN and Dual Chunk Attention are incorporated, facilitating the model’s robust extrapolation to larger token windows—a trait validated in practical and synthetic long-context tests.

Applications, Limitations, and Licensing

Qwen2-7B is primarily offered for further post-training, serving as a base for research and downstream specialization rather than being a direct text generator. The instruction-tuned variant, Qwen2-7B-Instruct, is designed for scenarios requiring extensive context management, such as document-level understanding and long-sequence information extraction within a 128,000-token window.

While Qwen2-7B generally matches or surpasses its peers, some benchmarks indicate minor performance gaps relative to certain models in specific English tasks or translation challenges. The base model is not recommended for immediate end-user deployment before some form of adaptation or alignment. The model is released under the Apache 2.0 license, supporting open research, development, and commercial use.

Related Models in the Qwen2 Family

Qwen2-7B is part of a broader series, with both base and instruction-tuned variants available across several model sizes—including Qwen2-0.5B, Qwen2-1.5B, Qwen2-57B-A14B (a mixture-of-experts model), and Qwen-2-72B. All models in the Qwen2 series deploy Group Query Attention for memory efficiency and scaling, as noted in the QwenLM GitHub repository. Larger models in the family exhibit even higher performance on demanding benchmarks, as demonstrated in the release documentation and visualized in comparative tables.

Further Reading and Resources

About Qwen 2: Qwen 2 (and 2.5) is a family of advanced AI models developed by Alibaba, designed to excel in various tasks including general language understanding, coding, and mathematics.

More in the Qwen 2 Family

Alibaba Cloud /

Qwen2.5 VL 3B

A 3B-parameter multimodal language model that processes images, videos, and text with capabilities for visual reasoning, document analysis, and computer interface interaction.
Alibaba Cloud /

Qwen2.5 VL 7B

A 7-billion parameter multimodal model capable of processing images, documents, and videos with native dynamic resolution support and structured output capabilities.
Alibaba Cloud /

Qwen2.5 VL 72B

A 72-billion parameter multimodal model that processes images, videos, and text for document analysis, object detection, and visual agent tasks.
Alibaba Cloud /

QwQ 32B Preview

Experimental research model focused on advancing AI reasoning capabilities by thinking through problems step by step, continuously questioning assumptions, and exploring different paths of thought. Impressive benchmark scores in math and coding tasks.
Alibaba Cloud /

QwQ 32B

A 32.5-billion parameter transformer model optimized for mathematical reasoning, coding, and complex problem-solving through reinforcement learning training.
Alibaba Cloud /

Qwen 2.5 Math 1.5B

A 1.5 billion parameter specialized model focused on mathematical reasoning and problem-solving capabilities in English and Chinese.
Deepseek AI /

DeepSeek R1 Distill Qwen 1.5B

A 1.5 billion parameter language model created through distillation techniques, focusing on mathematical reasoning and chain-of-thought problem-solving capabilities.
Agentica /

DeepCoder 1.5B Preview

A 1.5B parameter code generation model fine-tuned with reinforcement learning and iterative context lengthening for long-context reasoning tasks.
Alibaba Cloud /

Qwen 2.5 Math 7B

A 7.62-billion parameter mathematical reasoning model supporting English and Chinese with chain-of-thought and tool-integrated reasoning capabilities.
Alibaba Cloud /

Qwen 2.5 Math PRM 7B

A 7B parameter process reward model that evaluates mathematical reasoning steps individually rather than just final answers, achieving 67.6% accuracy on mathematical benchmarks.
Deepseek AI /

DeepSeek R1 Distill Qwen 7B

A 7.62B parameter distilled language model based on Qwen2.5-Math-7B, trained via knowledge distillation for mathematical and logical reasoning tasks.
Alibaba Cloud /

Qwen 2.5 Math 72B

A 72.7 billion parameter language model specialized for solving mathematical problems in English and Chinese using chain-of-thought and tool-integrated reasoning.
Alibaba Cloud /

Qwen 2.5 Math PRM 72B

A 72.8 billion parameter process reward model that evaluates intermediate mathematical reasoning steps using consensus filtering and achieves 78.3% F1 on ProcessBench.
Alibaba Cloud /

Qwen 2.5 Coder 7B

A 7.61 billion parameter transformer model designed for code generation and reasoning across 92 programming languages with a 128,000-token context window.
Alibaba Cloud /

Qwen 2.5 Coder 32B

Qwen2.5-Coder builds on Qwen2.5 by training on 5.5 trillion additional tokens of code data including source code, text-code grounding data, and synthetic data. This leads to significant improvements in code-related tasks.
Alibaba Cloud /

Qwen 2.5 7B

A 7.61-billion parameter transformer-based language model with 128K token context length, trained on 18 trillion tokens supporting 29+ languages.
Alibaba Cloud /

Qwen2.5 7B 1M

A 7-billion parameter transformer model with 1-million token context capacity utilizing Dual Chunk Attention for long-range text processing.
Alibaba Cloud /

Qwen 2.5 14B

A 14.7 billion parameter transformer model supporting 29 languages with 128K context window, designed as foundation for fine-tuning applications.
Alibaba Cloud /

Qwen2.5 14B 1M

A 14.7B parameter transformer model with 1-million token context capacity, utilizing dual chunk attention and progressive training for extended sequence processing.
Deepseek AI /

DeepSeek R1 Distill Qwen 14B

A 14B dense language model distilled from a mixture-of-experts architecture, optimized for mathematical reasoning and code generation tasks.
Agentica /

DeepCoder 14B Preview

A 14-billion parameter code reasoning model fine-tuned using distributed reinforcement learning with long-context capabilities up to 64,000 tokens.
Deep Cogito /

Cogito V1 Preview 14B

A 14.8 billion parameter instruction-tuned language model trained using Iterated Distillation and Amplification with hybrid reasoning capabilities across 30+ languages.
Alibaba Cloud /

Qwen 2.5 32B

A 32.5 billion parameter multilingual transformer model trained on 18 trillion tokens with 128K context length supporting text generation, coding, and mathematical reasoning.
Deepseek AI /

DeepSeek R1 Distill Qwen 32B

A 32B parameter language model created through knowledge distillation, optimized for mathematical reasoning, code generation, and complex problem-solving tasks.
Deep Cogito /

Cogito V1 Preview 32B

A 32-billion parameter instruction-tuned model based on Qwen2.5 architecture featuring dual operational modes and iterated distillation alignment methodology.
Alibaba Cloud /

Qwen 2.5 72B

This update to Qwen 2, pretrained on 18 trillion tokens, shows impressive performance in benchmarks (MMLU 85+, HumanEval 85+, MATH 80+), outperforming models of similar size. Qwen 2.5 has multilingual support for over 29 languages and can understand and generate structured data.
Alibaba Cloud /

Qwen 2 72B

A 72-billion parameter transformer model supporting extended context lengths up to 128K tokens and demonstrating strong multilingual capabilities across diverse benchmarks.

More from Alibaba Cloud

Alibaba Cloud /

Qwen3 0.6B

A 0.6B parameter language model featuring dual thinking modes, multilingual capabilities, and 32K context length through strong-to-weak distillation training.
Alibaba Cloud /

Qwen3 1.7B

A 1.7 billion parameter multilingual transformer supporting dual-mode reasoning with step-by-step "thinking" and rapid "non-thinking" response capabilities.
Alibaba Cloud /

Qwen3 4B

A 4-billion parameter transformer model featuring dual reasoning modes, extensive multilingual training, and competitive performance across mathematical, coding, and logical reasoning benchmarks.
Alibaba Cloud /

Qwen3 8B

Dense 8.2 billion parameter transformer model featuring hybrid thinking capabilities with 32K token context and multilingual support across 119 languages.
Alibaba Cloud /

Qwen3 14B

A 14.8 billion parameter transformer model featuring hybrid thinking/non-thinking reasoning modes, 32K context length, and multilingual capabilities across 119 languages.
Alibaba Cloud /

Qwen3 32B

A 32.8 billion parameter language model featuring hybrid thinking modes for both rapid responses and step-by-step reasoning across multilingual tasks.
Alibaba Cloud /

Qwen3 30B A3B

Mixture-of-experts model with 30.5B total parameters, 3.3B activated per token, featuring hybrid reasoning modes and multilingual support across 119 languages.
Alibaba Cloud /

Qwen3 235B A22B

Large language model with Mixture-of-Experts architecture featuring dual operational modes for both rapid inference and complex reasoning tasks.
Alibaba Cloud /

Qwen 1.5 32B

Foundation 32B Qwen 1.5 model from Alibaba Cloud.
Alibaba Cloud /

Qwen 1.5 72B

Foundation 72B Qwen 1.5 model from Alibaba Cloud.