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

实验结果:

回答不出来


相关推荐
飞哥数智坊2 小时前
我的“龙虾”罢工了!正好对比下GLM、MiniMax、Kimi 3家谁更香
人工智能
风象南3 小时前
很多人说,AI 让技术平权了,小白也能乱杀老师傅 ?
人工智能·后端
董董灿是个攻城狮4 小时前
大模型连载1:了解 Token
人工智能
RoyLin7 小时前
沉睡三十年的标准:HTTP 402、生成式 UI 与智能体原生软件的时代
人工智能
needn9 小时前
TRAE为什么要发布SOLO版本?
人工智能·ai编程
毅航9 小时前
自然语言处理发展史:从规则、统计到深度学习
人工智能·后端
前端付豪9 小时前
LangChain链 写一篇完美推文?用SequencialChain链接不同的组件
人工智能·python·langchain
ursazoo10 小时前
写了一份 7000字指南,让 AI 帮我消化每天的信息流
人工智能·开源·github
_志哥_13 小时前
Superpowers 技术指南:让 AI 编程助手拥有超能力
人工智能·ai编程·测试
YongGit14 小时前
OpenClaw 本地 AI 助手完全指南:飞书接入 + 远程部署实战
人工智能