SupervisedFineTuning<T, TInput, TOutput>
Models & Types ยท AiDotNet.FineTuning
Implements Supervised Fine-Tuning (SFT) - the foundational fine-tuning method.
Inheritance: FineTuningBase<T, TInput, TOutput> โ SupervisedFineTuning<T, TInput, TOutput>
For Beginners
SFT is like teaching by example. You show the model many examples of correct input-output pairs, and it learns to produce similar outputs. For instance, you might train a model on high-quality question-answer pairs to make it better at answering questions.
How It Works
SFT trains a model on labeled input-output pairs using standard supervised learning. This is the most straightforward fine-tuning approach and serves as the foundation for more advanced methods like RLHF or DPO.
Use Cases:
Constructors
| Constructor | Summary |
|---|---|
SupervisedFineTuning(FineTuningOptions<T> options) |
Initializes a new instance of SFT with default loss function. |
SupervisedFineTuning(FineTuningOptions<T> options, ILossFunction<T> lossFunction) |
Initializes a new instance of SFT with a custom loss function. |
Properties
| Property | Summary |
|---|---|
FineTuningCategory Category { get; } |
|
bool RequiresReferenceModel { get; } |
|
bool RequiresRewardModel { get; } |
|
string MethodName { get; } |
Methods
| Method | Summary |
|---|---|
Task<FineTuningMetrics<T>> EvaluateAsync(IFullModel<T, TInput, TOutput> model, FineTuningData<T, TInput, TOutput> evaluationData, CancellationToken cancellationToken) |
|
Task<IFullModel<T, TInput, TOutput>> FineTuneAsync(IFullModel<T, TInput, TOutput> baseModel, FineTuningData<T, TInput, TOutput> trainingData, CancellationToken cancellationToken) |