POST /fine_tuning/jobs

Servers

Request headers

Name Type Required Description
Content-Type String Yes The media type of the request body.

Default value: "application/json"

Request body fields

Name Type Required Description
seed Integer No

The seed controls the reproducibility of the job. Passing in the same seed and job parameters should produce the same results, but may differ in rare cases. If a seed is not specified, one will be generated for you.

method Object No

The method used for fine-tuning.

method.type String No

The type of method. Is either supervised or dpo.

Possible values:

  • "supervised"
  • "dpo"
method.dpo Object No

Configuration for the DPO fine-tuning method.

method.dpo.hyperparameters Object No

The hyperparameters used for the fine-tuning job.

method.dpo.hyperparameters.learning_rate_multiplier No

Scaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.

Default value: "auto"

method.dpo.hyperparameters.n_epochs No

The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.

Default value: "auto"

method.dpo.hyperparameters.beta No

The beta value for the DPO method. A higher beta value will increase the weight of the penalty between the policy and reference model.

Default value: "auto"

method.dpo.hyperparameters.batch_size No

Number of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.

Default value: "auto"

method.supervised Object No

Configuration for the supervised fine-tuning method.

method.supervised.hyperparameters Object No

The hyperparameters used for the fine-tuning job.

method.supervised.hyperparameters.learning_rate_multiplier No

Scaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.

Default value: "auto"

method.supervised.hyperparameters.n_epochs No

The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.

Default value: "auto"

method.supervised.hyperparameters.batch_size No

Number of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.

Default value: "auto"

hyperparameters Object No

The hyperparameters used for the fine-tuning job. This value is now deprecated in favor of method, and should be passed in under the method parameter.

hyperparameters.learning_rate_multiplier No

Scaling factor for the learning rate. A smaller learning rate may be useful to avoid overfitting.

Default value: "auto"

hyperparameters.n_epochs No

The number of epochs to train the model for. An epoch refers to one full cycle through the training dataset.

Default value: "auto"

hyperparameters.batch_size No

Number of examples in each batch. A larger batch size means that model parameters are updated less frequently, but with lower variance.

Default value: "auto"

training_file String Yes

The ID of an uploaded file that contains training data.

See upload file for how to upload a file.

Your dataset must be formatted as a JSONL file. Additionally, you must upload your file with the purpose fine-tune.

The contents of the file should differ depending on if the model uses the chat, completions format, or if the fine-tuning method uses the preference format.

See the fine-tuning guide for more details.

integrations[] Array No

A list of integrations to enable for your fine-tuning job.

integrations[].type Yes

The type of integration to enable. Currently, only "wandb" (Weights and Biases) is supported.

integrations[].wandb Object Yes

The settings for your integration with Weights and Biases. This payload specifies the project that metrics will be sent to. Optionally, you can set an explicit display name for your run, add tags to your run, and set a default entity (team, username, etc) to be associated with your run.

integrations[].wandb.name String No

A display name to set for the run. If not set, we will use the Job ID as the name.

integrations[].wandb.entity String No

The entity to use for the run. This allows you to set the team or username of the WandB user that you would like associated with the run. If not set, the default entity for the registered WandB API key is used.

integrations[].wandb.tags[] Array No

A list of tags to be attached to the newly created run. These tags are passed through directly to WandB. Some default tags are generated by OpenAI: "openai/finetune", "openai/{base-model}", "openai/{ftjob-abcdef}".

integrations[].wandb.project String Yes

The name of the project that the new run will be created under.

metadata Object No

Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard.

Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.

suffix String No

A string of up to 64 characters that will be added to your fine-tuned model name.

For example, a suffix of "custom-model-name" would produce a model name like ft:gpt-4o-mini:openai:custom-model-name:7p4lURel.

model Yes

The name of the model to fine-tune. You can select one of the supported models.

validation_file String No

The ID of an uploaded file that contains validation data.

If you provide this file, the data is used to generate validation metrics periodically during fine-tuning. These metrics can be viewed in the fine-tuning results file. The same data should not be present in both train and validation files.

Your dataset must be formatted as a JSONL file. You must upload your file with the purpose fine-tune.

See the fine-tuning guide for more details.

How to start integrating

  1. Add HTTP Task to your workflow definition.
  2. Search for the API you want to integrate with and click on the name.
    • This loads the API reference documentation and prepares the Http request settings.
  3. Click Test request to test run your request to the API and see the API's response.