Skip to main content

Overview & Models

Learn how to fine-tune a model for your application.

Overview

Fine-tuning a large language model (LLM) refers to the process of further training a pre-trained model on a specific task or domain. This allows the fine-tuned model to use its broad pre-training foundation and specialize to the task at hand.

The fine-tuning process typically results in a few benefits:

  • Increased accuracy over off-the-shelf, pretrained models on the given task
  • Reduction in costs by shortening the prompts required
  • Ability to fine-tune much smaller models with comparable performance to larger models

When to fine-tune

Here are some common use-cases for fine-tuning:

  • Tailoring the style or tone of a model to a particular use-case
  • Improving consistency for a desired output structure (e.g. JSON)
  • Handling multiple edge cases in a streamlined way

Models

Well-supported LLMs

Fine-tuning is currently available for the following models:

info

When referring a Huggingface model to fine-tune, use the hf://... path, versus when referring to an existing Predibase deployment, use the pb://deployments/... path.

llm = pc.LLM("hf://mistralai/Mistral-7B-v0.1")
Model NameURI for Fine-tuningParametersArchitectureLicense
Mistral-7Bhf://mistralai/Mistral-7B-v0.17 billionMistralApache 2.0
Mistral-7B-Instruct-v0.1hf://mistralai/Mistral-7B-Instruct-v0.17 billionMistralApache 2.0
Mistral-7B-Instruct-v0.2hf://mistralai/Mistral-7B-Instruct-v0.27 billionMistralApache 2.0
Mixtral-8x7B-Instruct-v0.1hf://mistralai/Mixtral-8x7B-Instruct-v0.146.7 billionMixtralApache 2.0
zephyr-7b-betahf://HuggingFaceH4/zephyr-7b-beta7 billionMistralMIT
llama-2-7bhf://meta-llama/Llama-2-7b-hf7 billionLlama-2Meta (request for commercial use)
llama-2-7b-chathf://meta-llama/Llama-2-7b-chat-hf7 billionLlama-2Meta (request for commercial use)
llama-2-13bhf://meta-llama/Llama-2-13b-hf13 billionLlama-2Meta (request for commercial use)
llama-2-13b-chathf://meta-llama/Llama-2-13b-chat-hf13 billionLlama-2Meta (request for commercial use)
llama-2-70bhf://meta-llama/Llama-2-70b-hf70 billionLlama-2Meta (request for commercial use)
llama-2-70b-chathf://meta-llama/Llama-2-70b-chat-hf70 billionLlama-2Meta (request for commercial use)
codellama-13b-instructhf://codellama/CodeLlama-13b-hf13 billionLlama-2Meta (request for commercial use)
codellama-70b-instructhf://codellama/CodeLlama-70b-Instruct-hf70 billionLlama-2Meta (request for commercial use)
gemma-2bhf://google/gemma-2b2 billionGemmaGoogle
gemma-2b-instructhf://google/gemma-2b-it2 billionGemmaGoogle
gemma-7bhf://google/gemma-7b7 billionGemmaGoogle
gemma-7b-instructhf://google/gemma-7b-it7 billionGemmaGoogle

Many of the latest OSS models are released in two variants:

  • Base model (llama-2-7b, etc): These are models that are primarily trained on the objective of text completion.
  • Instruction-Tuned (llama-2-7b-chat, mistral-7b-instruct, etc): These are models that have been further trained on (instruction, output) pairs in order to better respond to human instruction-styled inputs. The instructions effectively constrains the model’s output to align with the response characteristics or domain knowledge.

Best-Effort LLMs (via HuggingFace)

Fine-tuning is also supported for any Huggingface LLM meeting the following criteria:

  • Has the "Text Generation" and "Transformer" tags
  • Does not have a "custom_code" tag
  • Are not post-quantized (ex. model containing a quantization method such as "AWQ" in the name)
  • Has text inputs and outputs

Note: Best-effort indicates we will try to support these models but it is not guaranteed.

Huggingface URI for fine-tuning

Specify the llm to fine-tune using a Huggingface URI which includes the organization and model name

llm = pc.LLM("hf://meta-llama/Llama-2-7b-hf")
llm = pc.LLM("hf://mistralai/Mistral-7B-Instruct-v0.1")

Note: You cannot directly fine-tune a deployed LLM (serverless or dedicated deployment). Instead, you'll need to provide the Huggingface URI for fine-tuning.