[!TIP] This model is reproducible!
See the README in the
reproducedirectory for more information.
| Parameter | Value |
|---|---|
| start_layer_index | 8 |
| end_layer_index | 60 |
| preserve_good_behavior_weight | 0.8200 |
| steer_bad_behavior_weight | 0.0015 |
| overcorrect_relative_weight | 0.7196 |
| neighbor_count | 11 |
| Metric | This model | Original model (Qwen/Qwen2.5-32B-Instruct) |
|---|---|---|
| Refusals | 10/100 | 98/100 |
| KL divergence | 0.0620 | 0 (by definition) |
Qwen2.5 is the latest series of Qwen large language models. For Qwen2.5, we release a number of base language models and instruction-tuned language models ranging from 0.5 to 72 billion parameters. Qwen2.5 brings the following improvements upon Qwen2:
This repo contains the instruction-tuned 32B Qwen2.5 model, which has the following features:
For more details, please refer to our blog, GitHub, and Documentation.
The code of Qwen2.5 has been in the latest Hugging face transformers and we advise you to use the latest version of transformers.
With transformers<4.37.0, you will encounter the following error:
KeyError: 'qwen2'
Here provides a code snippet with apply_chat_template to show you how to load the tokenizer and model and how to generate contents.
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "Qwen/Qwen2.5-32B-Instruct"
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype="auto",
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained(model_name)
prompt = "Give me a short introduction to large language model."
messages = [
{"role": "system", "content": "You are Qwen, created by Alibaba Cloud. You are a helpful assistant."},
{"role": "user", "content": prompt}
]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
generated_ids = model.generate(
**model_inputs,
max_new_tokens=512
)
generated_ids = [
output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
]
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
The current config.json is set for context length up to 32,768 tokens.
To handle extensive inputs exceeding 32,768 tokens, we utilize YaRN, a technique for enhancing model length extrapolation, ensuring optimal performance on lengthy texts.
For supported frameworks, you could add the following to config.json to enable YaRN:
{
...,
"rope_scaling": {
"factor": 4.0,
"original_max_position_embeddings": 32768,
"type": "yarn"
}
}
For deployment, we recommend using vLLM.
Please refer to our Documentation for usage if you are not familar with vLLM.
Presently, vLLM only supports static YARN, which means the scaling factor remains constant regardless of input length, potentially impacting performance on shorter texts.
We advise adding the rope_scaling configuration only when processing long contexts is required.
Detailed evaluation results are reported in this 📑 blog.
For requirements on GPU memory and the respective throughput, see results here.
If you find our work helpful, feel free to give us a cite.
@misc{qwen2.5,
title = {Qwen2.5: A Party of Foundation Models},
url = {https://qwenlm.github.io/blog/qwen2.5/},
author = {Qwen Team},
month = {September},
year = {2024}
}
@article{qwen2,
title={Qwen2 Technical Report},
author={An Yang and Baosong Yang and Binyuan Hui and Bo Zheng and Bowen Yu and Chang Zhou and Chengpeng Li and Chengyuan Li and Dayiheng Liu and Fei Huang and Guanting Dong and Haoran Wei and Huan Lin and Jialong Tang and Jialin Wang and Jian Yang and Jianhong Tu and Jianwei Zhang and Jianxin Ma and Jin Xu and Jingren Zhou and Jinze Bai and Jinzheng He and Junyang Lin and Kai Dang and Keming Lu and Keqin Chen and Kexin Yang and Mei Li and Mingfeng Xue and Na Ni and Pei Zhang and Peng Wang and Ru Peng and Rui Men and Ruize Gao and Runji Lin and Shijie Wang and Shuai Bai and Sinan Tan and Tianhang Zhu and Tianhao Li and Tianyu Liu and Wenbin Ge and Xiaodong Deng and Xiaohuan Zhou and Xingzhang Ren and Xinyu Zhang and Xipin Wei and Xuancheng Ren and Yang Fan and Yang Yao and Yichang Zhang and Yu Wan and Yunfei Chu and Yuqiong Liu and Zeyu Cui and Zhenru Zhang and Zhihao Fan},
journal={arXiv preprint arXiv:2407.10671},
year={2024}
}
This model is a derivative of an Apache-2.0 base model and is released under the Apache-2.0 licence of its base model. In addition, it carries the use-based restrictions of the OpenRAIL++ Licence v1.0 (LICENSE_OpenRAIL++.md in this repository). Where the two conflict, the base licence prevails. This model's refusal behaviour has been reduced for research on abliteration. It must not be deployed for, or used to generate content for, any of the prohibited uses listed in the OpenRAIL++ licence.
This model is one of the models evaluated in Is Abliteration Getting Harder? Evidence from Five Open-Weight Release Pairs (R. J. Young, 2026; arXiv link to be added). Numbers are from that study's held-out evaluation; see the paper for methods and caveats.
| Release pair | Qwen (older release) |
| Method | ARA (Arbitrary-Rank Ablation) in Heretic 2.0, optimisation seed 1, 100 TPE trials |
| Selected trial | #42: fewest dev keyword refusals at first-token KL ≤ 0.1 → 10/100 dev refusals, KL 0.062 |
| Dev re-score of this export | 16/100 refusals, KL 0.098 |
| Held-out refusal (WildGuard, 972 harmful prompts) | 6.1% [4.7, 7.8] vs original 76.8% (-70.8 pp) |
| Capability change vs original (mean of MMLU-Pro, GSM8K, IFEval, HumanEval, MBPP) | -0.83 pp |
| Teacher-forced divergence (350 benign prompts) | 0.0773 nats/token |
Caveats: one optimisation run per model; refusal labels come from automatic judges (no human audit); residual refusal measures willingness to answer under greedy decoding, not the harmfulness of answers.
model-00002-of-00014.safetensors 5.0 GBmodel-00001-of-00014.safetensors 4.9 GBmodel-00004-of-00014.safetensors 4.9 GBmodel-00005-of-00014.safetensors 4.9 GBmodel-00006-of-00014.safetensors 4.9 GBmodel-00007-of-00014.safetensors 4.9 GBmodel-00008-of-00014.safetensors 4.9 GBmodel-00009-of-00014.safetensors 4.9 GBmodel-00010-of-00014.safetensors 4.9 GBmodel-00011-of-00014.safetensors 4.9 GBmodel-00012-of-00014.safetensors 4.9 GBmodel-00013-of-00014.safetensors 4.9 GBmodel-00003-of-00014.safetensors 4.9 GBmodel-00014-of-00014.safetensors 2.0 GB有文件?提交种子。
提交种子Qwen/Qwen2.5-32B-Instruct