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

实验结果:

回答不出来


相关推荐
AI_小站4 小时前
6个GitHub爆火的免费大模型教程,助你快速进阶AI编程
人工智能·langchain·github·知识图谱·agent·llama·rag
xindoo4 小时前
GitHub Trending霸榜!深度解析AI Coding辅助神器 Superpowers
人工智能·github
时间之里5 小时前
【深度学习】:RF-DETR与yolo对比
人工智能·深度学习·yolo
北京阿法龙科技有限公司5 小时前
数智化升级:AR 智能眼镜驱动工业运维效能革新
人工智能
风落无尘5 小时前
《智能重生:从垃圾堆到AI工程师》——第二章 概率与生存
大数据·人工智能
j_xxx404_5 小时前
Linux:静态链接与动态链接深度解析
linux·运维·服务器·c++·人工智能
收获不止数据库5 小时前
达梦9发布会归来:AI 时代,我们需要一款什么样的数据库?
数据库·人工智能·ai·语言模型·数据分析
hhb_6185 小时前
AI全栈编程生存指南
人工智能
AI-Frontiers5 小时前
transformer进阶之路:#2 工作原理详解
人工智能·深度学习·transformer
科研前沿5 小时前
2026 数字孪生前沿科技:全景迭代报告 —— 镜像视界生成式孪生(Generative DT)技术白皮书
大数据·人工智能·科技·算法·音视频·空间计算