AI Hints
Home›Fine-Tuning LLMs Tutorial›Your First LoRA Fine-Tune
Fine-Tuning LLMs · Lesson 50 of 120

SFTConfig

The training settings.

⏱ 2 min read▶ Video at 1:19:28🎓 Free
Watch this lesson in the Fine-Tuning LLMs courseWatch on YouTube ↗Full Fine-Tuning LLMs course

SFT config has dozens of settings. But you only need a handful to start. Let's go through the ones in our file, and why we picked each value.

  • Dozens of settings
  • A handful matter
  • Why each value

Our settings

Num train epochs is one. Our task is simple, and one pass is enough. Learning rate is two times ten to the minus four, a common value for LoRA. The batch size is eight examples. Logging steps says how often to record the loss. And eval steps says how often to test on the test set.

SettingValueWhy
num_train_epochs1simple task
learning_rate2e-4common for LoRA
per_device_train_batch_size8fits in memory
logging_steps11record the loss
eval_steps22check the test set

Settings you get for free

SFT config also has useful defaults. It uses b float sixteen on GPUs that support it. It masks the prompt, for prompt and completion data. It sets a maximum length of one thousand and twenty four tokens. And it uses a learning rate that starts high, and falls to zero by the end, which helps training settle.

keyvalue
bf16on supported GPUs
completion_only_losson for prompt + completion
max_length1024 tokens
Learning ratefalls to zero by the end

Summary

Let's recap. Epochs, learning rate, and batch size are the main settings. Logging and eval steps let us watch training. And SFT config gives us sensible defaults. Next, the moment we've been waiting for. Our first LoRA training run.

Key takeaways
  • epochs, lr, batch size
  • logging + eval steps
  • Good defaults
Next up: First LoRA Run — train it for real