The FINETUNE statement lets you retrain a model with additional training data.

Imagine you have a model that was trained with a certain dataset. Now there is more training data available and you wish to retrain this model with a new dataset. The FINETUNE statement lets you partially retrain the model, so it takes less time and resources than the RETRAIN statement. In the machine learning literature, this is also referred to as fine-tuning a model.


Here is the syntax:

FINETUNE [MODEL] project_name.model_name
FROM [integration_name | project_name]
    (SELECT column_name, ... 
     FROM [integration_name. | project_name.]table_name
     [WHERE incremental_column > LAST])
    key = value,


project_nameName of the project where the model resides.
model_nameName of the model to be retrained.
integration_nameName of the integration created using the CREATE DATABASE statement or file upload.
(SELECT column_name, ... FROM table_name)Selecting additional data to be used for retraining.
WHERE incremental_column > LASTSelecting only newly added data to be used to finetune the model. Learn more about the LAST keyword here.
USING key = valueOptional. The USING clause lets you pass multiple parameters to the FINETUNE statement.

Model Versions

Every time the model is finetuned or retrained, its new version is created with an incremented version number. Unless overridden, the most recent version becomes active when training completes.

You can query for all model versions like this:

FROM project_name.models;

For more information on managing model versions, check out our docs here.

While the model is being generated and trained, it is not active. The model becomes active only after it completes generating and training.


Example 1: OpenAI Model Fine-Tuning

Example 2: Llama2 Model Fine-Tuning

Example 3: Regression Model Fine-Tuning

Example 4: Classification Model Fine-Tuning