Skip to main content
LoRA (Low-Rank Adaptation of LLMs) is a popular and lightweight training technique that significantly reduces the number of trainable parameters. It works by inserting a smaller number of new weights into the model and only these are trained. During inference these updated weights are added to the frozen original model weights. This makes training with LoRA much faster, memory-efficient, and produces smaller model weights (a few hundred MBs), which are easier to store and share.

Running LoRA Inference on Together

The Together API now supports LoRA inference on select base models, allowing you to either:
  1. Do LoRA fine-tuning on the many available models through Together AI, then run inference right away
  2. Bring Your Own Adapters: If you have custom LoRA adapters, that you’ve trained or obtained from HuggingFace, you can upload them and run inference
You can follow the instructions provided in the Fine-Tuning Overview to get started with LoRA Fine-tuning. Otherwise, follow the instructions below. Adapters trained previous to 12/17 will not be available for LoRA serverless at the moment. We will be migrating your previous adapters to work with LoRA Serverless. A workaround is to download the adapter and re-upload it using Option 2 below.

Supported Base Models

Currently, LoRA inference is supported for adapters based on the following base models in Together API. Whether using pre-fine-tuned models or bringing your own adapters, these are the only compatible models:

Option 1: Fine-tune your LoRA model and run inference on it on Together

The Together API supports both LoRA and full fine-tuning. For serverless LoRA inference, follow these steps: Step 1: Fine-Tune with LoRA on Together API: To start a Fine-tuning job with LoRA, follow the detailed instructions in the Fine-Tuning Overview, or follow the below snippets as a quick start:
If you plan to use a validation set, make sure to set the --validation-file and --n-evals (the number of evaluations over the entire job) parameters. --n-evals needs to be set as a number above 0 in order for your validation set to be used. Step 2: Run LoRA Inference: Once you submit the fine-tuning job you should be able to see the model name in the response:
You can also see the status of the job and get the model name if you navigate to your fine-tuned model in the ‘Model’ or ‘Jobs’ tab in the Together dashboard. You’ll see a model string – use it through the Together API.
Expected Response:
Your first couple queries may have slow TTFT (up to 10 seconds) but subsequent queries should be fast!

Option 2: Upload a Custom Adapter & run inference on it on Together

The Together API also allows you to upload your own private LoRA adapter files for inference. To upload a custom adapter:

Step 1: Prepare Adapter File:

Ensure your adapter file is compatible with the above supported base models. If you are getting the adapter from HuggingFace you can find information about the base model there as well. You need to make sure that the adapter you are trying to upload has an adapter_config.json and adapter_model.safetensors files.

Step 2: Upload Adapter Using Together API:

Source 1: Source the adapter from an AWS s3 bucket:
Source 2: Source the adapter from HuggingFace: Make sure that the adapter contains adapter_config.json and adapter_model.safetensors files in Files and versions tab on HuggingFace.
For both Option 1 and 2 the output contains the “job_id” and “model_name”. The model name must be unique, if you attempt to upload a model name that previously was uploaded you will receive a “Model name already exists” error.
You can poll our API using the “job_id” until the adapter has finished uploading.
The output contains a “status” field. When the “status” is “Complete”, your adapter is ready!

Step 3: Run LoRA Inference:

Take the model_name string you get from the adapter upload output below, then use it through the Together API.
Make Together API call to the model:
Expected Response:

LoRA Adapter Limits

You are limited to the following number of LoRA adapters hosted based on build tier: