Skip to main content

FinetuningConfig

Below is the class definition for the Finetuning Config. It inherits from the BaseModel defined in Pydantic.

class FinetuningConfig(BaseModel):
base_model: str
adapter: str | None = Field(default=None)
task: str | None = Field(default=None)
epochs: PositiveInt | None = Field(default=None)
learning_rate: PositiveFloat | None = Field(default=None)
rank: PositiveInt | None = Field(default=None)
target_modules: List[str] | None = Field(default=None)
enable_early_stopping: bool = Field(default=True)

By default, Predibase sets the following default values (subject to change):

  • epochs: 3
  • adapter: "lora"
  • task: "instruction_tuning"
  • learning_rate: 0.0002
  • rank: 16
  • target_modules: see below in the "Target Modules" section
  • enable_early_stopping: enable early stopping of training if validation loss plateaus over 10 successive evaluation checkpoints
Note regarding base_model

Use the short names provided in the list of available models.

Task

The task parameter determines what the adapter will be fine-tuned to do. The following tasks are supported:

  • instruction_tuning: Given a prompt input field, the adapter is trained to generate a completion output field.
  • completion (Beta): Given a single text input field, the adapter is trained to do next token prediction on the input.

Adapter

The adapter parameter determines what type of adapter will be fine-tuned. Predibase supports two adapter types:

  • lora: LoRA is an efficient method for training LLMs that introduces a small subset of task-specific model parameters alongside the original model parameters. These weights learn from the task-specific data during fine-tuning, optimizing performance for your dataset.
  • turbo_lora (New): This is a propreitary fine-tuning method that builds on LoRA while also improving inference throughput (measured in token generated per second) by up to 3.5x for single requests and up to 2x for high queries per second batched workloads depending on the type of the downstream task. Training jobs will take longer to train and are priced at 2x the standard fine-tuning pricing.

When should I use Turbo LoRA?

Turbo LoRA is ideal for applications requiring rapid and efficient generation of long output sequences, such as document summarization, machine translation, question answering systems, code generation, creative writing, etc. Turbo LoRA is not useful when fine-tuning for classification tasks because output sequences in classification tasks are typically short (< 10 output tokens).

Turbo LoRA adapters improve inference throughput gains with the volume of fine-tuning data. Typically, a few thousand rows of data is a good starting point to see very noticeable throughput improvements.

Target Modules

The target_modules parameter is a list of strings, where each string is the name of a module in the model that you want to fine-tune. The default value is None, which means that the default modules will be fine-tuned. Per base model, we have the following target modules:

  • codellama-13b-instruct
    • q_proj (default)
    • k_proj
    • v_proj (default)
    • o_proj
    • gate_proj
    • up_proj
    • down_proj
  • codellama-70b-instruct
    • q_proj (default)
    • k_proj
    • v_proj (default)
    • o_proj
    • gate_proj
    • up_proj
    • down_proj
  • gemma-2b
    • q_proj (default)
    • k_proj
    • v_proj (default)
    • o_proj
    • gate_proj
    • up_proj
    • down_proj
  • gemma-2b-instruct
    • q_proj (default)
    • k_proj
    • v_proj (default)
    • o_proj
    • gate_proj
    • up_proj
    • down_proj
  • gemma-7b
    • q_proj (default)
    • k_proj
    • v_proj (default)
    • o_proj
    • gate_proj
    • up_proj
    • down_proj
  • gemma-7b-instruct
    • q_proj (default)
    • k_proj
    • v_proj (default)
    • o_proj
    • gate_proj
    • up_proj
    • down_proj
  • llama-2-13b
    • q_proj (default)
    • k_proj
    • v_proj (default)
    • o_proj
    • gate_proj
    • up_proj
    • down_proj
  • llama-2-13b-chat
    • q_proj (default)
    • k_proj
    • v_proj (default)
    • o_proj
    • gate_proj
    • up_proj
    • down_proj
  • llama-2-70b
    • q_proj (default)
    • k_proj
    • v_proj (default)
    • o_proj
    • gate_proj
    • up_proj
    • down_proj
  • llama-2-70b-chat
    • q_proj (default)
    • k_proj
    • v_proj (default)
    • o_proj
    • gate_proj
    • up_proj
    • down_proj
  • llama-2-7b
    • q_proj (default)
    • k_proj
    • v_proj (default)
    • o_proj
    • gate_proj
    • up_proj
    • down_proj
  • llama-2-7b-chat
    • q_proj (default)
    • k_proj
    • v_proj (default)
    • o_proj
    • gate_proj
    • up_proj
    • down_proj
  • llama-3-8b
    • q_proj (default)
    • k_proj
    • v_proj (default)
    • o_proj
    • gate_proj
    • up_proj
    • down_proj
  • llama-3-8b-instruct
    • q_proj (default)
    • k_proj
    • v_proj (default)
    • o_proj
    • gate_proj
    • up_proj
    • down_proj
  • llama-3-70b
    • q_proj (default)
    • k_proj
    • v_proj (default)
    • o_proj
    • gate_proj
    • up_proj
    • down_proj
  • llama-3-70b-instruct
    • q_proj (default)
    • k_proj
    • v_proj (default)
    • o_proj
    • gate_proj
    • up_proj
    • down_proj
  • mistral-7b
    • q_proj (default)
    • k_proj
    • v_proj (default)
    • o_proj
    • gate_proj
    • up_proj
    • down_proj
  • mistral-7b-instruct
    • q_proj (default)
    • k_proj
    • v_proj (default)
    • o_proj
    • gate_proj
    • up_proj
    • down_proj
  • mistral-7b-instruct-v0-2
    • q_proj (default)
    • k_proj
    • v_proj (default)
    • o_proj
    • gate_proj
    • up_proj
    • down_proj
  • mistral-7b-instruct-v0-3
    • q_proj (default)
    • k_proj
    • v_proj (default)
    • o_proj
    • gate_proj
    • up_proj
    • down_proj
  • mixtral-8x7b-instruct-v0-1
    • q_proj (default)
    • k_proj
    • v_proj (default)
    • o_proj
  • phi-2
    • q_proj (default)
    • k_proj
    • v_proj (default)
    • dense
    • fc1 (default)
    • fc2 (default)
  • zephyr-7b-beta
    • q_proj (default)
    • k_proj
    • v_proj (default)
    • o_proj
    • gate_proj
    • up_proj
    • down_proj
  • phi-3-mini-4k-instruct
    • qkv_proj (default)
    • o_proj (default)
    • gate_up_proj
    • down_proj
  • codellama-7b-instruct
    • q_proj (default)
    • k_proj
    • v_proj (default)
    • o_proj
    • gate_proj
    • up_proj
    • down_proj
  • codellama-7b
    • q_proj (default)
    • k_proj
    • v_proj (default)
    • o_proj
    • gate_proj
    • up_proj
    • down_proj