modelscope / ms-swift

Use PEFT or Full-parameter to finetune 350+ LLMs or 100+ MLLMs. (LLM: Qwen2.5, Llama3.2, GLM4, Internlm2.5, Yi1.5, Mistral, Baichuan2, DeepSeek, Gemma2, ...; MLLM: Qwen2-VL, Qwen2-Audio, Llama3.2-Vision, Llava, InternVL2, MiniCPM-V-2.6, GLM4v, Xcomposer2.5, Yi-VL, DeepSeek-VL, Phi3.5-Vision, ...)
https://swift.readthedocs.io/zh-cn/latest/Instruction/index.html
Apache License 2.0
4.01k stars 355 forks source link

SFT的template问题 #2328

Closed xiaosongyuan closed 3 days ago

xiaosongyuan commented 4 days ago

以Qwen2.5-Math为例(对DeepSeek-Math-7B同样适用),在SFT过程中使用的template对应的system prompt为: system = 'You are Qwen, created by Alibaba Cloud. You are a helpful assistant.', 但Qwen2.5-Math官方repo推荐的inference时system prompt为: {"role": "system", "content": "Please reason step by step, and put your final answer within \\boxed{}."}, 在SFT阶段和Inference阶段使用不同的system prompt是否会对结果造成较大影响?因为Inference阶段使用不同的模板对Qwen2.5-Math-7B的性能指标影响巨大。

Jintao-Huang commented 4 days ago

参考的这里:https://modelscope.cn/models/Qwen/Qwen2.5-Math-7B-Instruct

Jintao-Huang commented 4 days ago

如果要手动指定system, 可以--system xxx 进行设置

xiaosongyuan commented 4 days ago

谢谢回复!指定--system的格式是str吗?比如在swift sft时传入 --system "Please reason step by step, and put your final answer within \\boxed{}."

Jintao-Huang commented 4 days ago

是的

xiaosongyuan commented 4 days ago

好的,谢谢!