LlamaFactory微调Qwen3-0.6B大模型踩坑实验整理

目标:

确保Qwen3-0.6B模型在特定人物和自我认知上不犯事实性错误,调一个xx领域专属的人物专家模型

实验一:先试试看什么情况

GRADIO_SERVER_PORT=8103 CUDA_VISIBLE_DEVICES=1,2,5,7 llamafactory-cli train

--stage sft

--do_train

--model_name_or_path /workspace/codes/deepseek/Qwen3-0.6B
--dataset alpaca_zh_demo,identity,train

--dataset_dir ./data

--template qwen

--finetuning_type lora

--output_dir ./saves/Qwen3-0.6B/lora/sft_xinda

--overwrite_cache

--overwrite_output_dir

--cutoff_len 1024

--preprocessing_num_workers 16

--per_device_train_batch_size 1

--per_device_eval_batch_size 1

--gradient_accumulation_steps 16

--lr_scheduler_type cosine

--logging_steps 50

--warmup_steps 20

--save_steps 100

--eval_steps 100

--save_strategy steps

--eval_strategy steps

--load_best_model_at_end
--learning_rate 5e-5
--num_train_epochs 5

--lora_rank 64

--lora_alpha 128

--max_samples 1000

--val_size 0.1

--plot_loss

--fp16

实验结果:

完全无法回答自我认知问题,training_loss=1.97

training_loss图都无法画出


可能的原因:epoch少了,数据量不够,检查max_samples的含义

实验二:增大epoch为20,移除参数-max_samples 1000

GRADIO_SERVER_PORT=8103 CUDA_VISIBLE_DEVICES=1,2,5,7 llamafactory-cli train

--stage sft

--do_train

--model_name_or_path /workspace/codes/deepseek/Qwen3-0.6B

--dataset alpaca_zh_demo,identity,train

--dataset_dir ./data

--template qwen

--finetuning_type lora

--output_dir ./saves/Qwen3-0.6B/lora/sft_xinda_2

--overwrite_cache

--overwrite_output_dir

--cutoff_len 1024

--preprocessing_num_workers 16

--per_device_train_batch_size 1

--per_device_eval_batch_size 1

--gradient_accumulation_steps 16

--lr_scheduler_type cosine

--logging_steps 50

--warmup_steps 20

--save_steps 100

--eval_steps 100

--save_strategy steps

--eval_strategy steps

--load_best_model_at_end

--learning_rate 5e-5

--num_train_epochs 20

--lora_rank 64

--lora_alpha 128

--val_size 0.1

--plot_loss

--fp16

实验结果:

20个epoch,step

具备自我认知能力,但是领域问题出现了事实错误。


可能的原因:alpaca_zh_demo通用指令微调数据,稀释了垂类的数据

实验四:

优化方案:

GRADIO_SERVER_PORT=8103 CUDA_VISIBLE_DEVICES=1,2,5,7 llamafactory-cli train

--stage sft

--do_train

--model_name_or_path /workspace/codes/deepseek/Qwen3-0.6B

--dataset identity,train

--dataset_dir ./data

--template qwen

--finetuning_type lora

--output_dir ./saves/Qwen3-0.6B/lora/sft_xinda

--overwrite_cache

--overwrite_output_dir

--cutoff_len 1024

--preprocessing_num_workers 16

--per_device_train_batch_size 1

--per_device_eval_batch_size 1

--gradient_accumulation_steps 16

--lr_scheduler_type cosine

--logging_steps 50

--warmup_steps 150

--save_steps 100

--eval_steps 100

--save_strategy steps

--eval_strategy steps

--load_best_model_at_end

--learning_rate 1e-5

--num_train_epochs 50

--lora_rank 64

--lora_alpha 128

--max_samples 1000

--val_size 0.1

--plot_loss

--fp16

实验结果

有自我认知




#1

GRADIO_SERVER_PORT=8103 CUDA_VISIBLE_DEVICES=1,2,5,7 llamafactory-cli train

--stage sft

--do_train

--model_name_or_path /workspace/codes/deepseek/Qwen3-0.6B

--dataset identity,train

--dataset_dir ./data

--template qwen

--finetuning_type lora

--output_dir ./saves/Qwen3-0.6B/lora/sft_xinda_1

--overwrite_cache

--overwrite_output_dir

--cutoff_len 1024

--preprocessing_num_workers 16

--per_device_train_batch_size 1

--per_device_eval_batch_size 1

--gradient_accumulation_steps 16

--lr_scheduler_type cosine

--logging_steps 50

--warmup_steps 150

--save_steps 100

--eval_steps 100

--save_strategy steps

--eval_strategy steps

--load_best_model_at_end

--learning_rate 2e-6

--num_train_epochs 50

--lora_rank 8

--lora_alpha 16

--val_size 0.1

--plot_loss

--fp16

实验结果:

回答不出来


相关推荐
zhaoshuzhaoshu8 分钟前
人工智能(AI)发展史:详细里程碑
人工智能·职场和发展
Luke~9 分钟前
阿里云计算巢已上架!3分钟部署 Loki AI 事故分析引擎,SRE 复盘时间直接砍掉 80%
人工智能·阿里云·云计算·loki·devops·aiops·sre
weixin_156241575769 分钟前
基于YOLOv8深度学习花卉识别系统摄像头实时图片文件夹多图片等另有其他的识别系统可二开
大数据·人工智能·python·深度学习·yolo
QQ6765800815 分钟前
AI赋能轨道交通智能巡检 轨道交通故障检测 轨道缺陷断裂检测 轨道裂纹识别 鱼尾板故障识别 轨道巡检缺陷数据集深度学习yolo第10303期
人工智能·深度学习·yolo·智能巡检·轨道交通故障检测·鱼尾板故障识别·轨道缺陷断裂检测
小陈工17 分钟前
2026年4月7日技术资讯洞察:下一代数据库融合、AI基础设施竞赛与异步编程实战
开发语言·前端·数据库·人工智能·python
tq108617 分钟前
组织的本质:从科层制到伴星系统的决断理论
人工智能
科技与数码21 分钟前
互联网保险迎来新篇章,元保方锐分享行业发展前沿洞察
大数据·人工智能
汽车仪器仪表相关领域32 分钟前
NHFID-1000型非甲烷总烃分析仪:技术破局,重构固定污染源监测新体验
java·大数据·网络·人工智能·单元测试·可用性测试·安全性测试
weixin_1562415757643 分钟前
基于YOLO深度学习的动物检测与识别系统
人工智能·深度学习·yolo