Model reference · open weights

Qwen-1

LLMs Qwen Text gen 1 build Licence not stated 1k dl/mo

Qwen-1 is an open-weight language model from Qwen. Qwen-1_8B (BF16) weighs 3.7 GB; the smallest configuration that runs it is RTX 3060 12 GB.

For self-hosting, compare this build's requirements below with the GPU you plan to rent.

  • Qwen-1 is a 1.8B parameter Transformer-based large language model developed by Qwen for text generation.
  • It supports a context length of 8192 tokens and is trained on over 2.2 trillion tokens of data, with primary support for Chinese and English.
  • The model uses a vocabulary of 151,851 tokens and is released under a research license that permits academic use but requires contact for commercial applications.

Summary of the Qwen/Qwen-1_8B model card, 2026-10-01

What it is

Released byQwen
Released2023-11-30
Parameters1.8B
VRAM3.7 GB for the weights

What it runs on

Memory and cards for Qwen-1_8B (BF16)

3.7 GBweights, file size
197 MBcache per 1K tokens
709 MBruntime overhead, at least
8,192 tokenscontext max
CardRequests at onceContext maxMemory
8K each
RTX 3060 12 GB4all 8K11.6 GB
RTX 4060 Ti 16 GB6all 8K15.4 GB
RTX 3090 24 GB11all 8K23.4 GB
RTX 4090 24 GB11all 8K23.4 GB
RTX 5090 32 GB16all 8K31.0 GB
L40S 48 GB24all 8K44.0 GB
A100 80 GB45all 8K78.2 GB
H100 80 GB43all 8K78.1 GB
RTX PRO 6000 Blackwell 96 GB52all 8K93.8 GB
DGX Spark (GB10) 128 GB unified61all 8K107 GB
H200 141 GB80all 8K138 GB
B200 180 GB103all 8K176 GB
2× RTX 3060 12 GB
tensor parallel
11all 8K11.6 GB a card
2× RTX 4060 Ti 16 GB
tensor parallel
15all 8K15.4 GB a card
Memory needed at each load
Requests at once8K tokens each
16.0 GB
512.4 GB
817.3 GB
1630.2 GB
3255.9 GB
64107 GB

One card, with vLLM's small-card settings.

From the model card

What Qwen says about Qwen-1

Read the model card

🤗 Hugging Face&nbsp&nbsp | &nbsp&nbsp🤖 ModelScope&nbsp&nbsp | &nbsp&nbsp 📑 Paper &nbsp&nbsp | &nbsp&nbsp🖥️ Demo

介绍 (Introduction)

**通义千问-1.8B(Qwen-1.8B)**是阿里云研发的通义千问大模型系列的18亿参数规模的模型。Qwen-1.8B是基于Transformer的大语言模型, 在超大规模的预训练数据上进行训练得到。预训练数据类型多样,覆盖广泛,包括大量网络文本、专业书籍、代码等。同时,在Qwen-1.8B的基础上,我们使用对齐机制打造了基于大语言模型的AI助手Qwen-1.8B-Chat。本仓库为Qwen-1.8B的仓库。

通义千问-1.8B(Qwen-1.8B)主要有以下特点:

  1. 低成本部署:提供int8和int4量化版本,推理最低仅需不到2GB显存,生成2048 tokens仅需3GB显存占用。微调最低仅需6GB。
  2. 大规模高质量训练语料:使用超过2.2万亿tokens的数据进行预训练,包含高质量中、英、多语言、代码、数学等数据,涵盖通用及专业领域的训练语料。通过大量对比实验对预训练语料分布进行了优化。
  3. 优秀的性能:Qwen-1.8B支持8192上下文长度,在多个中英文下游评测任务上(涵盖常识推理、代码、数学、翻译等),效果显著超越现有的相近规模开源模型,具体评测结果请详见下文。
  4. 覆盖更全面的词表:相比目前以中英词表为主的开源模型,Qwen-1.8B使用了约15万大小的词表。该词表对多语言更加友好,方便用户在不扩展词表的情况下对部分语种进行能力增强和扩展。

如果您想了解更多关于通义千问1.8B开源模型的细节,我们建议您参阅GitHub代码库。

Qwen-1.8B is the 1.8B-parameter version of the large language model series, Qwen (abbr. Tongyi Qianwen), proposed by Aibaba Cloud. Qwen-1.8B is a Transformer-based large language model, which is pretrained on a large volume of data, including web texts, books, codes, etc. Additionally, based on the pretrained Qwen-1.8B, we release Qwen-1.8B-Chat, a large-model-based AI assistant, which is trained with alignment techniques. This repository is the one for Qwen-1.8B.

The features of Qwen-1.8B include:

  1. Low-cost deployment: We provide int4 and int8 quantized versions, the minimum memory requirment for inference is less than 2GB, generating 2048 tokens only 3GB of memory usage. The minimum memory requirment of finetuning is only 6GB.
  2. Large-scale high-quality training corpora: It is pretrained on over 2.2 trillion tokens, including Chinese, English, multilingual texts, code, and mathematics, covering general and professional fields. The distribution of the pre-training corpus has been optimized through a large number of ablation experiments.
  3. Good performance: It supports 8192 context length and significantly surpasses existing open-source models of similar scale on multiple Chinese and English downstream evaluation tasks (including commonsense, reasoning, code, mathematics, etc.), and even surpasses some larger-scale models in several benchmarks. See below for specific evaluation results.
  4. More comprehensive vocabulary coverage: Compared with other open-source models based on Chinese and English vocabularies, Qwen-1.8B uses a vocabulary of over 150K tokens. This vocabulary is more friendly to multiple languages, enabling users to directly further enhance the capability for certain languages without expanding the vocabulary.

For more details about the open-source model of Qwen-1.8B, please refer to the GitHub code repository.

要求(Requirements)

  • python 3.8及以上版本
  • pytorch 1.12及以上版本,推荐2.0及以上版本
  • 建议使用CUDA 11.4及以上(GPU用户、flash-attention用户等需考虑此选项)
  • python 3.8 and above
  • pytorch 1.12 and above, 2.0 and above are recommended
  • CUDA 11.4 and above are recommended (this is for GPU users, flash-attention users, etc.)

依赖项 (Dependency)

运行Qwen-1.8B,请确保满足上述要求,再执行以下pip命令安装依赖库

To run Qwen-1.8B, please make sure you meet the above requirements, and then execute the following pip commands to install the dependent libraries.

pip install transformers==4.32.0 accelerate tiktoken einops

另外,推荐安装flash-attention库(当前已支持flash attention 2),以实现更高的效率和更低的显存占用。

In addition, it is recommended to install the flash-attention library (we support flash attention 2 now.) for higher efficiency and lower memory usage.

git clone https://github.com/Dao-AILab/flash-attention
cd flash-attention && pip install .
# 下方安装可选,安装可能比较缓慢。
# pip install csrc/layer_norm
# pip install csrc/rotary

快速使用(Quickstart)

您可以通过以下代码轻松调用:

You can easily call the model with the following code:

from transformers import AutoModelForCausalLM, AutoTokenizer
from transformers.generation import GenerationConfig

# Note: The default behavior now has injection attack prevention off.
tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen-1_8B", trust_remote_code=True)

# use bf16
# model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen-1_8B", device_map="auto", trust_remote_code=True, bf16=True).eval()
# use fp16
# model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen-1_8B", device_map="auto", trust_remote_code=True, fp16=True).eval()
# use cpu only
# model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen-1_8B", device_map="cpu", trust_remote_code=True).eval()
# use auto mode, automatically select precision based on the device.
model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen-1_8B", device_map="auto", trust_remote_code=True).eval()

# Specify hyperparameters for generation. But if you use transformers>=4.32.0, there is no need to do this.
# model.generation_config = GenerationConfig.from_pretrained("Qwen/Qwen-1_8B", trust_remote_code=True)

inputs = tokenizer('蒙古国的首都是乌兰巴托(Ulaanbaatar)\n冰岛的首都是雷克雅未克(Reykjavik)\n埃塞俄比亚的首都是', return_tensors='pt')
inputs = inputs.to(model.device)
pred = model.generate(**inputs)
print(tokenizer.decode(pred.cpu()[0], skip_special_tokens=True))
# 蒙古国的首都是乌兰巴托(Ulaanbaatar)\n冰岛的首都是雷克雅未克(Reykjavik)\n埃塞俄比亚的首都是亚的斯亚贝巴(Addis Ababa)...

关于更多的使用说明,请参考我们的GitHub repo获取更多信息。

For more information, please refer to our GitHub repo for more information.

Tokenizer

注:作为术语的“tokenization”在中文中尚无共识的概念对应,本文档采用英文表达以利说明。

基于tiktoken的分词器有别于其他分词器,比如sentencepiece分词器。尤其在微调阶段,需要特别注意特殊token的使用。关于tokenizer的更多信息,以及微调时涉及的相关使用,请参阅文档。

Our tokenizer based on tiktoken is different from other tokenizers, e.g., sentencepiece tokenizer. You need to pay attention to special tokens, especially in finetuning. For more detailed information on the tokenizer and related use in fine-tuning, please refer to the documentation.

模型细

Quoted from the model card on Hugging Face. The full card is behind the Hugging Face link above.

© 2026 AxForge · EU-hosted AI infrastructure Pricing Docs Trust Privacy Terms