Profile

Settings

Loading…

← Papers

Help

FAQ

Which features require signing in?

You can read the commentary, paper info, Model Structure and related papers of public papers without signing in. Sign in to manage your account or contact us about your inquiries.

Can I upload a PDF file?

Upload papers with an arXiv or DOI link; the commentary is public to everyone. Papers whose source and terms of use can't be verified, so the commentary can't be made public, can't be uploaded. Uploading PDF files and keeping papers private are for subscribers only, and a paper uploaded as a file is saved as private only. Searching for official info by title runs only when you press the button.

Are the figures and AI commentary accurate?

Figures come only from the original paper, and only those whose terms of use are verified are shown. The commentary is written by AI and may be wrong. Check important claims, numbers and figure context against the evidence in the original paper.

I want to report a copyright issue.

Terms of use and the source of the original paper are on the Paper info tab. If there's a problem, choose "Paper content, figures and copyright" under Contact us and send the paper link, the part in question, and evidence that you hold the rights. Receiving your report doesn't confirm any rights or remove anything right away. You can see the result of the review under My inquiries.

I forgot my password.

If you signed up with email, use Forgot password in the sign-in window to reset it with your verified email. If you signed up with Google, Naver or Kakao, change your password with that service.

What should I include in an inquiry?

Tell us which screen you were on and what you were doing when the problem happened, along with the paper link. Don't include personal information such as passwords, API keys, verification codes or phone numbers. Inquiries and replies are stored in Refivu and you can see them under My inquiries.

How do I delete my account?

In Settings, under My account, press Delete account. Review what will be deleted and complete identity verification to delete your account. For other requests, choose "Account" under Contact us.

Paper commentary

Qwen Technical Report

Qwen releases a family of base and chat language models with specialized variants

  • Problem Developers need capable language models at practical sizes, with aligned chat versions. Earlier open models lagged behind proprietary ones on many tasks.
  • Method Qwen trains Transformer base models on up to 3 trillion tokens. It then aligns chat versions with supervised finetuning and reinforcement learning from human feedback.
  • Results The Qwen-14B model exceeds the previous 13B state-of-the-art models on every listed dataset. Code-Qwen-14B-Chat reaches 66.4 pass@1 on HumanEval.

What the QWEN family contains

QWEN is introduced as a family of language models with several parameter counts rather than as a single network. Each member has a base form, pretrained on broad text and code, and a chat form that is aligned to human preferences with supervised finetuning and reinforcement learning from human feedback. Specialized branches for coding and mathematics are built on the same base models.

The release that the authors make public consists of 14B and 7B base models and their aligned chat counterparts, sized for developers and applications. The chat models are described as capable of tool use and planning, so the report evaluates them as agents as well as on alignment quality.

Pretraining corpus and tokenizer

The pretraining corpus mixes web documents, encyclopedias, books and code, with a large share in English and Chinese. Text from web pages is extracted from HTML and language-identified. Deduplication uses exact matching after normalization and fuzzy matching with MinHash and LSH. Quality filtering combines rule-based methods with model scoring for text quality and for offensive content.

The authors also sample and review texts by hand, and they up-sample selected sources. The corpus totals up to 3 trillion tokens. Instruction samples that share a 13-gram overlap with the evaluation test sets are removed before the benchmark results are reported.

The tokenizer uses byte pair encoding and starts from the cl100k base vocabulary of tiktoken. Chinese characters and words and tokens from other languages are added, and numbers are split into single digits. The final vocabulary is about 152K. Against XLM-R, LLaMA, Baichuan and InternLM tokenizers, QWEN gives higher compression in most languages.

The authors argue that fewer tokens per text lowers serving cost. Preliminary experiments indicated that the larger vocabulary did not reduce downstream performance.

Architecture changes and training recipe

QWEN starts from the LLaMA-style Transformer and changes several components. The input embedding and the output projection are kept as separate matrices rather than tied. The authors made this choice after preliminary experiments, accepting extra memory use for better results. Position information comes from RoPE, with the inverse frequency matrix computed in FP32 instead of BF16 or FP16.

Most layers have no bias terms, but the QKV projections in attention keep them, which the authors link to better extrapolation. Each block uses pre-normalization, and RMSNorm replaces standard layer normalization. The feed-forward block uses SwiGLU, with a narrower width than the usual four times the hidden size.

Table 1 lists three sizes. The 1.8B model has hidden size 2048, 16 heads and 24 layers, the 7B has 4096, 32 and 32, and the 14B has 5120, 40 and 40. All three sizes use a learning rate of 3.0 × 10−4 and a batch size of 4M. Their training budgets are 2.2T, 2.4T and 3.0T tokens for 1.8B, 7B and 14B respectively. Pretraining is next-token prediction on sequences of 2048 tokens.

Documents are shuffled, merged and cut to that length, and Flash Attention is used in the attention modules. AdamW uses β1 = 0.9, β2 = 0.95 and ϵ = 10−8. A cosine schedule decays the learning rate to a floor of 10% of the peak, and training runs in BFloat16 mixed precision.

Extending context at inference

Attention cost grows quadratically with context length, so the authors add training-free changes that run only at inference. The main technique is NTK-aware interpolation. It changes the base of RoPE instead of scaling every dimension equally, which keeps high-frequency information. Dynamic NTK-aware interpolation changes the scale chunk by chunk, which avoids severe degradation at long lengths.

Window attention limits each token to a bounded window. The window size is set per layer, with shorter windows in lower layers, which the authors find more sensitive to context extension, and longer windows in higher layers.

Perplexity at long sequence lengths

Table 3 reports perplexity on arXiv papers for QWEN-7B and QWEN-14B at sequence lengths from 1024 to 16384. Without the extension, QWEN-7B goes from 3.78 at 2048 to 39.35 at 4096 and reaches 2645.09 at 16384. With dynamic NTK, LogN-Scaling and window attention together, QWEN-7B has 3.49 at 8192 and 4.32 at 16384.

In the QWEN-7B rows, the 16384 value falls from 5.71 with dynamic NTK alone to 4.62 when LogN-Scaling is added, and to 4.32 with window attention added. For QWEN-14B, the same combination gives 3.46 at 2048, 3.29 at 4096, 3.18 at 8192 and 3.42 at 16384, while the version without the techniques reaches 22.79 at 4096 and 3168.35 at 16384. The table covers perplexity only, so it does not show downstream task accuracy at these lengths.

Base model benchmark comparison

The base models are evaluated without alignment on MMLU and C-Eval at 5-shot, GSM8K at 8-shot, MATH at 4-shot, HumanEval and MBPP at 0-shot, and BBH at 3-shot. Baseline scores come from official results and from OpenCompass.

The authors state that the 14B model exceeds the previous 13B state-of-the-art models on every listed dataset.

The authors count three tasks where QWEN-14B is higher than LLaMA2-70B, but the passage does not name those three tasks. In the same table, LLAMA 2 70B scores 69.8 on MMLU, above QWEN-14B's 66.3, so the 70B comparison holds only on the tasks the authors name. QWEN-7B is said to surpass LLaMA2-13B and to be comparable with Baichuan2-13B, and QWEN-1.8B is described as competitive on some tasks.

Supervised finetuning of chat models

SFT trains the pretrained model on chat-style conversations with the same next-token objective used in pretraining, and the loss masks out system and user turns. Annotators write conversations in several styles to make the model more helpful, and safety-related cases such as violence, bias and pornography are included. Prompt-template data is excluded so that the model does not depend on fixed templates.

Conversations are serialized in a ChatML-style format, which marks roles and turn contents so that system setup, user input and assistant output can be told apart.

The SFT run has 4000 steps and batch size 128 at sequence length 2048, with AdamW using β1 = 0.9, β2 = 0.95 and ϵ = 10−8. The learning rate warms up over the first 1430 steps to a peak of 2 × 10−6, with weight decay 0.1, dropout 0.1 and gradient clipping at 1.0. The passage gives a single setting for this stage.

Building the reward model

The reward model goes through two stages, a preference model pretraining stage on large comparison data and a finetuning stage on comparison data of higher quality. Prompts are chosen by a balanced sampling algorithm that accounts for diversity and complexity across around 6600 detailed tags. Responses come from QWEN models of several sizes and sampling strategies, and annotators score them to form comparison pairs.

The reward model starts from a QWEN model of the same size, with a pooling layer added. It takes the reward for a sentence from a specific end token. Training uses a constant learning rate of 3 × 10−6, batch size 64, sequence length 2048 and a single epoch.

Reward model accuracy

Test pairwise accuracy is reported for the preference model pretraining model (PMP) and the reward model (RM) on seven preference datasets. On QWEN Helpful-base, PMP scores 62.68 and RM scores 74.78. On QWEN Helpful-online the pair is 61.62 and 69.71. The two QWEN sets are the authors' own datasets. Their Helpful-base responses come from a model without RLHF, while Helpful-online responses include a model with RLHF.

The gain is not uniform. On Anthropic Helpful-base, RM scores 73.98 against 76.52 for PMP, and on Anthropic Helpful-online it scores 64.57 against 65.43. On OpenAI PRM800K, PMP scores 70.59 and RM scores 70.52. The authors read the PMP results as generalization to out-of-distribution data and the RM gains as a fit to their own QWEN reward datasets.

PPO policy optimization

Proximal Policy Optimization involves four models: the policy, the value model, a reference model and the reward model. Before the policy is updated, the value model is updated alone for 50 steps so that it adapts to the reward model. Each query gets two sampled responses, the KL divergence coefficient is 0.04, and rewards are normalized by the running mean.

The policy learning rate is 1 × 10−6 and the value model learning rate is 5 × 10−6. Value loss is clipped at 0.15, and inference uses a policy top-p of 0.9. With top-p 0.9 the entropy is slightly lower than with top-p 1.0, but reward rises faster, which the authors report leads to higher evaluation rewards. A pretrained gradient is added to limit the alignment tax.

The authors argue that with this reward model the KL penalty is strong enough on benchmarks outside code and math, such as common sense and reading comprehension.

Human evaluation against GPT-3.5

The evaluation uses 300 Chinese instructions covering knowledge, language understanding, creative writing, coding and mathematics. Three annotators rank the responses for each instruction by overall score, which combines helpfulness, informativeness, validity and other factors. The compared systems are Qwen-7B SFT, Qwen-14B SFT, Qwen-14B RLHF and GPT-4, each shown as wins, ties and losses against GPT-3.5.

The GPT-3.5 and GPT-4 responses come from the OpenAI APIs for GPT-3.5-turbo-0613 and GPT-4-0613.

The RLHF model is ahead of both SFT models by a clear margin, and it falls behind GPT-4. The text gives no exact win or tie percentages for these bars, so the margins are not stated as numbers here.

The authors argue that traditional benchmarks cannot measure aligned chat models well, so they built this human evaluation and see a more extensive and rigorous assessment as necessary.

Tool use, code interpreter and agent tasks

Three evaluations probe agent behaviour: ReAct prompting with unseen tools, a Python code interpreter, and the Hugging Face Agent benchmark. The tool-use benchmark is the authors' own Chinese benchmark, and the code interpreter benchmark is also the authors' in-house set.

On the tool-use benchmark, QWEN-CHAT-14B scores 98 on tool selection accuracy and 93 on Rouge-L for tool input, with a false positive error of 2.4. GPT-4 is listed at 95, 90 and 15.0 on the same measures, and GPT-3.5 at 85, 88 and 75.0.

On the code interpreter benchmark, QWEN-CHAT-14B reaches 81.7 on the All measure, against 86.8 for GPT-4 and 72.9 for GPT-3.5. On Visualization-All, the 14B model reaches 56.4 against 63.8 for GPT-4. The authors attribute the weaker Code Llama visualization results to the model inventing column names from CSV file names.

On the Hugging Face Agent benchmark in run mode, QWEN-CHAT-14B scores 93.5 on tool selection, 94.4 on tool used and 87.0 on code correctness. GPT-4 is listed at 100, 100 and 97.4 on the same measures in run mode.

Continued pretraining for code

Rather than training code models from scratch, the authors start from base QWEN models trained on text and code and continue pretraining on code data for around 90 billion tokens. The context length is raised to 8192 because coding applications often involve long contexts such as tool use and code interpretation.

Code SFT starts from the Code-Qwen base model. The learning rate is 2.0 × 10−6 for the 14B model and 1.0 × 10−5 for the 7B model, with a cosine schedule that has 3% warm-up steps and then stays constant. The authors report that a multi-stage SFT strategy gave the best results among the options they tried.

Code benchmark results

Results are pass@1 on HumanEval and MBPP, and on HumanEvalPack, which is zero-shot across six programming languages.

On HumanEvalPack, Code-Qwen-14B-Chat averages 51.9, against 78.3 for GPT-4 and 40.5 for WizardCoder 15B. The authors say the Code-Qwen models rival StarCoder and clearly exceed similar-size baselines, while they still fall behind GPT-4 in general. The authors expect the gap to GPT-4 to narrow with more model and data scale, which is a expectation and not a measured result.

Math SFT

MATH-QWEN-CHAT is obtained by applying SFT directly to the QWEN base models on an augmented math instruction dataset. The sequence length is 1024, because the math SFT data are shorter on average. Most inputs are examination questions, and the system and user inputs are masked from the loss, since predicting the question format and random numbers adds nothing and the authors found masking sped convergence.

Optimization uses AdamW with the same hyperparameters as SFT, except for a peak learning rate of 2 × 10−5 and a training step count of 50 000.

Math benchmark results

Accuracy is reported with greedy decoding on the GSM8K, MATH, Math401 and Math23K test sets. For MATH, the test set comes from Lightman et al. (2023). MATH-QWEN-CHAT-14B reaches 69.8 on GSM8K and 24.2 on MATH, and its 7B sibling reaches 62.5 and 17.2. The 14B model scores 85.0 on Math401 and 78.4 on Math23K.

Compared with the general QWEN-CHAT-14B, the math-specialized 14B model rises from 60.1 to 69.8 on GSM8K and from 18.4 to 24.2 on MATH. GPT-3.5 is listed at 80.8 on GSM8K and 34.1 on MATH, so the 14B model stays below it on GSM8K. The 7B model's MATH score of 17.2 is above the 14.1 listed for Minerva 8B.

Limits of the evidence

The human evaluation uses one set of 300 Chinese instructions, three annotators per instruction and GPT-3.5 as the reference point. The authors say a more extensive and rigorous assessment is still needed for chat models.

The code results use pass@1 on HumanEval, MBPP and HumanEvalPack, and the Code-Qwen models still fall behind GPT-4 in the reported tables. On GSM8K the 14B math model reaches 69.8 against 80.8 for GPT-3.5 in the reported table.

The long-context evidence is perplexity on arXiv text at lengths up to 16384, so no downstream long-context accuracy is reported. On Anthropic Helpful-base the reward model scores below PMP, and the two QWEN preference sets are the authors' own data. The authors leave alternatives to pre-normalization for later versions, so their training stability remains an open item in this report.

Paper info

Authors
Jinze Bai, Shuai Bai, Yunfei Chu, Zeyu Cui, Kai Dang, Xiaodong Deng, Yang Fan, Wenbin Ge, Yu Han, Fei Huang, Binyuan Hui, Luo Ji, Mei Li, Junyang Lin, Runji Lin, Dayiheng Liu, Gao Liu, Chengqiang Lu, Keming Lu, Jianxin Ma, Rui Men, Xingzhang Ren, Xuancheng Ren, Chuanqi Tan, Sinan Tan, Jianhong Tu, Peng Wang, Shijie Wang, Wei Wang, Shengguang Wu, Benfeng Xu, Jin Xu, An Yang, Hao Yang, Jian Yang, Shusheng Yang, Yang Yao, Bowen Yu, Hongyi Yuan, Zheng Yuan, Jianwei Zhang, Xingxuan Zhang, Yichang Zhang, Zhenru Zhang, Chang Zhou, Jingren Zhou, Xiaohuan Zhou, Tianhang Zhu
Venue
arXiv · Preprint
First published
2023-9-28
Added
2026-11-11
Updated
2023-9-28
Version
v1
arXiv
2309.16609
Category
cs.CL
Original paper terms
CC BY 4.0
What we show
Paper info and commentary

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

Quote from the paper

Jinze Bai, Shuai Bai, Yunfei Chu, Zeyu Cui, Kai Dang, Xiaodong Deng, Yang Fan, Wenbin Ge, Yu Han, Fei Huang, Binyuan Hui, Luo Ji, Mei Li, Junyang Lin, Runji Lin, Dayiheng Liu, Gao Liu, Chengqiang Lu, Keming Lu, Jianxin Ma et al. (2023). Qwen Technical Report. arXiv:2309.16609v1. https://arxiv.org/abs/2309.16609v1

BibTeX
@misc{bai2023qwen,
  title = {{Qwen Technical Report}},
  author = {Jinze Bai and Shuai Bai and Yunfei Chu and Zeyu Cui and Kai Dang and Xiaodong Deng and Yang Fan and Wenbin Ge and Yu Han and Fei Huang and Binyuan Hui and Luo Ji and Mei Li and Junyang Lin and Runji Lin and Dayiheng Liu and Gao Liu and Chengqiang Lu and Keming Lu and Jianxin Ma and Rui Men and Xingzhang Ren and Xuancheng Ren and Chuanqi Tan and Sinan Tan and Jianhong Tu and Peng Wang and Shijie Wang and Wei Wang and Shengguang Wu and Benfeng Xu and Jin Xu and An Yang and Hao Yang and Jian Yang and Shusheng Yang and Yang Yao and Bowen Yu and Hongyi Yuan and Zheng Yuan and Jianwei Zhang and Xingxuan Zhang and Yichang Zhang and Zhenru Zhang and Chang Zhou and Jingren Zhou and Xiaohuan Zhou and Tianhang Zhu},
  year = {2023},
  eprint = {2309.16609},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2309.16609v1}
}

See related papersBrowse other papers

Paper preview
Account security

Connect Google account

If you connect a Google account, you can sign in with it too.

Refivu

Delete account

Refivu
Refivu

Sign up