IFineTuning<T, TInput, TOutput>

Interfaces · AiDotNet.Interfaces

Defines the contract for fine-tuning methods that adapt pre-trained models to specific tasks or preferences.

Implements: IModelSerializer

Known implementations: FineTuningBase<T, TInput, TOutput>

For Beginners

Fine-tuning is like specialized training for an AI that already knows the basics. Just like a doctor goes through general education before specializing, AI models first learn general knowledge (pre-training) and then learn specific skills or behaviors (fine-tuning).

How It Works

Fine-tuning encompasses a wide range of techniques for adapting models, from supervised fine-tuning (SFT) to advanced preference optimization methods like DPO, RLHF, and their variants.

Categories of Fine-Tuning Methods:

Properties

Property Summary
FineTuningCategory Category { get; } Gets the category of this fine-tuning method.
bool RequiresReferenceModel { get; } Gets whether this method requires a reference model.
bool RequiresRewardModel { get; } Gets whether this method requires a reward model.
bool SupportsPEFT { get; } Gets whether this method supports parameter-efficient fine-tuning (PEFT).
string MethodName { get; } Gets the name of this fine-tuning method.

Methods

Method Summary
FineTuningOptions<T> GetOptions() Gets the configuration options for this fine-tuning method.
Task<FineTuningMetrics<T>> EvaluateAsync(IFullModel<T, TInput, TOutput> model, FineTuningData<T, TInput, TOutput> evaluationData, CancellationToken cancellationToken) Evaluates the fine-tuning quality of a model.
Task<IFullModel<T, TInput, TOutput>> FineTuneAsync(IFullModel<T, TInput, TOutput> baseModel, FineTuningData<T, TInput, TOutput> trainingData, CancellationToken cancellationToken) Fine-tunes a model using the configured method and provided training data.
void Reset() Resets the fine-tuning method state.