Views
No views yet
| Parameter | Value |
|---|---|
| direction_index | 15.17 |
| attn.o_proj.max_weight | 1.47 |
| attn.o_proj.max_weight_position | 25.63 |
| attn.o_proj.min_weight | 1.07 |
| attn.o_proj.min_weight_distance | 18.22 |
| mlp.down_proj.max_weight | 1.17 |
| mlp.down_proj.max_weight_position | 27.14 |
| mlp.down_proj.min_weight | 1.07 |
| mlp.down_proj.min_weight_distance | 19.55 |
| Metric | This model | Original model (Qwen/Qwen3-VL-4B-Instruct) |
|---|---|---|
| KL divergence | 0.27 | 0 (by definition) |
| Refusals | 8/100 | 92/100 |



pip install git+https://github.com/huggingface/transformers
# pip install transformers==4.57.0 # currently, V4.57.0 is not releasedtransformers:1from transformers import Qwen3VLForConditionalGeneration, AutoProcessor
2
3# default: Load the model on the available device(s)
4model = Qwen3VLForConditionalGeneration.from_pretrained(
5 "Qwen/Qwen3-VL-4B-Instruct", dtype="auto", device_map="auto"
6)
7
8# We recommend enabling flash_attention_2 for better acceleration and memory saving, especially in multi-image and video scenarios.
9# model = Qwen3VLForConditionalGeneration.from_pretrained(
10# "Qwen/Qwen3-VL-4B-Instruct",
11# dtype=torch.bfloat16,
12# attn_implementation="flash_attention_2",
13# device_map="auto",
14# )
15
16processor = AutoProcessor.from_pretrained("Qwen/Qwen3-VL-4B-Instruct")
17
18messages = [
19 {
20 "role": "user",
21 "content": [
22 {
23 "type": "image",
24 "image": "https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-VL/assets/demo.jpeg",
25 },
26 {"type": "text", "text": "Describe this image."},
27 ],
28 }
29]
30
31# Preparation for inference
32inputs = processor.apply_chat_template(
33 messages,
34 tokenize=True,
35 add_generation_prompt=True,
36 return_dict=True,
37 return_tensors="pt"
38)
39inputs = inputs.to(model.device)
40
41# Inference: Generation of the output
42generated_ids = model.generate(**inputs, max_new_tokens=128)
43generated_ids_trimmed = [
44 out_ids[len(in_ids) :] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
45]
46output_text = processor.batch_decode(
47 generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False
48)
49print(output_text)1export greedy='false'
2export top_p=0.8
3export top_k=20
4export temperature=0.7
5export repetition_penalty=1.0
6export presence_penalty=1.5
7export out_seq_length=163841export greedy='false'
2export top_p=1.0
3export top_k=40
4export repetition_penalty=1.0
5export presence_penalty=2.0
6export temperature=1.0
7export out_seq_length=32768@misc{qwen3technicalreport,
title={Qwen3 Technical Report},
author={Qwen Team},
year={2025},
eprint={2505.09388},
archivePrefix={arXiv},
primaryClass={cs.CL},
url={https://arxiv.org/abs/2505.09388},
}
@article{Qwen2.5-VL,
title={Qwen2.5-VL Technical Report},
author={Bai, Shuai and Chen, Keqin and Liu, Xuejing and Wang, Jialin and Ge, Wenbin and Song, Sibo and Dang, Kai and Wang, Peng and Wang, Shijie and Tang, Jun and Zhong, Humen and Zhu, Yuanzhi and Yang, Mingkun and Li, Zhaohai and Wan, Jianqiang and Wang, Pengfei and Ding, Wei and Fu, Zheren and Xu, Yiheng and Ye, Jiabo and Zhang, Xi and Xie, Tianbao and Cheng, Zesen and Zhang, Hang and Yang, Zhibo and Xu, Haiyang and Lin, Junyang},
journal={arXiv preprint arXiv:2502.13923},
year={2025}
}
@article{Qwen2VL,
title={Qwen2-VL: Enhancing Vision-Language Model's Perception of the World at Any Resolution},
author={Wang, Peng and Bai, Shuai and Tan, Sinan and Wang, Shijie and Fan, Zhihao and Bai, Jinze and Chen, Keqin and Liu, Xuejing and Wang, Jialin and Ge, Wenbin and Fan, Yang and Dang, Kai and Du, Mengfei and Ren, Xuancheng and Men, Rui and Liu, Dayiheng and Zhou, Chang and Zhou, Jingren and Lin, Junyang},
journal={arXiv preprint arXiv:2409.12191},
year={2024}
}
@article{Qwen-VL,
title={Qwen-VL: A Versatile Vision-Language Model for Understanding, Localization, Text Reading, and Beyond},
author={Bai, Jinze and Bai, Shuai and Yang, Shusheng and Wang, Shijie and Tan, Sinan and Wang, Peng and Lin, Junyang and Zhou, Chang and Zhou, Jingren},
journal={arXiv preprint arXiv:2308.12966},
year={2023}
}