A practical guide to SFT and LoRA with Qwen3-0.6B-Base
The Juejin AI tutorial explains how supervised fine-tuning adapts a base model to follow instructions, covering loss masking, Alpaca and ShareGPT data formats, and approaches such as Self-Instruct and model distillation. It demonstrates LoRA-based fine-tuning of Qwen3-0.6B-Base with TRL and PEFT, including code, configuration choices, and guidance on matching training and inference chat templates. The author reports that a 1,000-sample run on a 16 GB M2 Mac took about 44 minutes and changed the model from repeating questions into answering them completely.
The article provides a concrete, resource-conscious path for practicing instruction tuning and LoRA on a small model, while clearly identifying the code, tools, and author-reported test setup.
在上一篇中,我们把预训练的工程面完整过了一遍:Megatron-LM 和 DeepSpeed 这类框架如何用张量并行、流水线并行把几千亿参数的训练摊到成百上千张卡上,以及 Scaling Law 如何指导我们在算力预算内分配模型大小和数据量。到此为止,预训练这条线就收尾了,它的产出物是一个基座模型(base model)。
基座模型有一个鲜明的特征:它只会续写,不会对话。你问它一个问题,它不一定回答,可能顺着你的问题继续往下编,因为在预训练语料里,一个问题后面跟着的往往还是问题。我们在《大模型推理》系列里用的 Qwen3-0.6B 这种开箱即聊的模型,其实都经过了后训练(Post-Training)的加工。今天我们就来学后训练的第一站:监督微调(Supervised Fine-Tuning,简称 SFT),以及和它形影不离的低秩适配(Low-Rank Adaptation,简称 LoRA)。
从基座模型说起
先用一个具体的例子感受一下基座模型和对话模型的差别。同样输入一句话:
输入:中国的首都是哪里?
基座模型的输出可能是:
中国的首都是哪里?美国的首都是哪里?日本的首都是哪里?
(它把输入当成了某篇文章的片段,继续往下续写)
对话模型的输出:
中国的首都是北京。
#Qwen3-0.6B-Base#Qwen3-0.6B#TRL#PEFT#LLaMA-Factory#Axolotl#Alpaca#ShareGPT#Capybara#LIMA