> ## Documentation Index
> Fetch the complete documentation index at: https://docs.coreweave.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Bring your own LoRA adapter

> Bring your own custom LoRA for serving fine-tuned models on Serverless Inference.


This page explains how to serve your own custom LoRA adapters on Serverless Inference. It's for developers and ML practitioners who want to deploy fine-tuned variants of supported base models without managing infrastructure.

LoRA (Low-Rank Adaptation) lets you customize large language models by training and storing only a lightweight add-on instead of a full new model. This reduces the size and cost of customization.

You can train or upload a LoRA to give a base model new capabilities, such as specializing it for customer support, creative writing, or a particular technical field. This lets you adapt the model's behavior without retraining or redeploying the entire model.

## Why use Serverless Inference for LoRAs

Serverless Inference for LoRAs offers the following benefits:

* Upload once, deploy without managing servers.
* Track which version is live with artifact versioning.
* Update models by swapping small LoRA files instead of full model weights.

## Workflow

At a high level, serving a custom LoRA involves three steps:

1. Upload your LoRA weights as a Weights & Biases artifact.
2. Reference the artifact URI as your model name in the API.
3. CoreWeave dynamically loads your weights for inference.

See this [getting started notebook](https://wandb.me/lora_nb) for an interactive demonstration of how to create a LoRA and upload it to Weights & Biases as an artifact.

## Prerequisites

You need the following:

* A [CoreWeave Forge API key](https://docs.coreweave.com/products/wandb/integrations/add-wandb-to-any-library.md#create-an-api-key).
* A [Weights & Biases project](https://docs.coreweave.com/products/wandb/track/project-page.md).
* Python 3.8+ with the `openai` and `wandb` packages: `pip install wandb openai`.

## Supported base models

Your LoRA must be trained against one of the following base models. Use the exact model ID string when setting `wandb.base_model` so Serverless Inference can pair your adapter with the correct base model at inference time.

The **Maximum LoRA Rank** column is the largest adapter that Serverless Inference can load for each base model. It's a limit for adapters you train elsewhere and upload, not a training setting. Adapters from Serverless SFT and Serverless RL use a fixed rank that's always within this limit. See [LoRA rank and alpha](https://docs.coreweave.com/products/post-training/serverless-training/available-models.md#lora-rank-and-alpha).

| Model ID (for API usage) | Maximum LoRA Rank |
| - | - |
| `google/gemma-4-26B-A4B-it` | 16 |
| `meta-llama/Llama-3.1-8B-Instruct` | 16 |
| `nvidia/NVIDIA-Nemotron-3.5-Lightning-30B-A3B` | 16 |
| `Qwen/Qwen3.8-27B` | 16 |
| `Qwen/Qwen3.6-35B-A3B` | 16 |

## LoRA requirements

Serverless Inference can serve a LoRA that meets the following requirements, whichever method you use to add it:

* The LoRA must be trained on one of the models listed in [Supported base models](#supported-base-models), and its rank must not exceed the **Maximum LoRA Rank** for its base model.
* The LoRA artifact must meet the following conditions:
  * Saved in PEFT format as a `lora` type artifact in your CoreWeave Forge account.
  * Stored in the `coreweave-us` storage region for low latency.
  * Labeled with the model ID of its base model in the `wandb.base_model` metadata field (for example, `meta-llama/Llama-3.1-8B-Instruct`). This ensures Serverless Inference loads it with the correct model.

A LoRA that you train with Serverless RL is ready to use with Serverless Inference without an upload artifact step, so you only need to choose a supported base model. If you upload a LoRA or train one yourself, you set the artifact type, storage region, and metadata when you upload it.

## Add a LoRA

When your LoRA meets the requirements above, add it to your CoreWeave Forge account with one of the following methods to serve it on Serverless Inference. Choose the tab that matches where your LoRA was trained:

> [tab] Upload a LoRA you trained elsewhere
>
> Upload your own custom LoRA directory as a Weights & Biases artifact. Use this method if you trained your LoRA elsewhere (local environment, cloud provider, or partner service).
>
> This Python code uploads your locally stored LoRA weights to Weights & Biases as a versioned artifact. It creates a `lora` type artifact with the required metadata (base model and storage region), adds your LoRA files from a local directory, and logs it to your Weights & Biases project for use with inference.
>
> ```python theme={"system"}
> import wandb
>
> run = wandb.init(entity="[YOUR-TEAM]", project="[YOUR-PROJECT]")
>
> artifact = wandb.Artifact(
>     "qwen_lora",
>     type="lora",
>     metadata={"wandb.base_model": "Qwen/Qwen3.8-27B"},
>     storage_region="coreweave-us",
> )
>
> artifact.add_dir("[PATH-TO-LORA-WEIGHTS]")
> run.log_artifact(artifact)
> ```

> [tab] Train a new LoRA with Serverless RL
>
> Train a new LoRA with [Serverless RL](https://docs.coreweave.com/products/post-training/serverless-training.md) on one of the [supported base models](#supported-base-models). Your LoRA automatically becomes a Weights & Biases artifact that you can use directly.
>
> For detailed information on how to train your own LoRA, see [OpenPipe's ART quickstart](https://art.openpipe.ai/getting-started/quick-start).
>
> After training completes, your LoRA is automatically available as an artifact.

> [tab] Train a new LoRA with supervised fine-tuning
>
> Follow the [Creating a fine-tuned LoRA](https://docs.coreweave.com/products/inference/serverless/tutorials/creating-lora.md) tutorial to fine-tune a base model with supervised fine-tuning (SFT) using the TRL library, then upload the result to Weights & Biases as an artifact.
>
> The tutorial's script sets the artifact type, storage region, and base model metadata for you. Make sure that the base model and LoRA rank in the script meet the [LoRA requirements](#lora-requirements).

## Reference the LoRA

After you add your LoRA to your project as an artifact, regardless of which method you used, reference it from any inference call by passing its URI as the model name:

```python theme={"system"}
# Pin an explicit artifact version, such as v0 or v1
model_name = "wandb-artifact:///[YOUR-TEAM]/[YOUR-PROJECT]/your_trained_lora:v1"
```

### Pin an artifact version

Reference a version number (`:v0`, `:v1`, and so on). Don't use `:latest`, and don't omit the version.

Avoid aliases that you move between versions, such as `:prod`. Serverless Inference loads the version that an alias points to the first time you use it, and then keeps serving that version. If you later move the alias to a newer version, requests that use the alias still get the older version. To serve a new version, reference it by its version number.

To find the version that `:latest` currently resolves to, look it up with the Weights & Biases API and use the returned version in your model name:

```python theme={"system"}
import wandb

api = wandb.Api()
artifact = api.artifact("[YOUR-TEAM]/[YOUR-PROJECT]/your_trained_lora:latest")
print(artifact.version)  # For example, v1
```

You can also find the version on the artifact's page in the Forge UI.

### Reference a Serverless Training checkpoint

[Serverless Training](https://docs.coreweave.com/products/post-training/serverless-training.md) logs each checkpoint of a LoRA as an artifact version. Each version has a `stepN` alias, such as `:step25`, in addition to its `vN` version number. Serverless Inference accepts either one:

```python theme={"system"}
model_name = "wandb-artifact:///[YOUR-TEAM]/[YOUR-PROJECT]/your_trained_lora:step25"
```

## Use the LoRA

With your LoRA available as an artifact and its URI set as the model name, the following example shows how to call your custom LoRA through Serverless Inference.

Replace the following placeholders:

* `[YOUR-API-KEY]`: Your CoreWeave Forge API key.
* `[FULL-NAME-OF-ARTIFACT]`: The LoRA artifact's full name, `[ENTITY]/[PROJECT]/[ARTIFACT-NAME]:[VERSION]`, including an explicit version such as `:v0`. Copy it from the artifact's page in the Forge UI.

```python theme={"system"}
from openai import OpenAI

model_name = "wandb-artifact:///[FULL-NAME-OF-ARTIFACT]"

client = OpenAI(
    base_url="https://api.inference.wandb.ai/v1",
    api_key="[YOUR-API-KEY]",
)

resp = client.chat.completions.create(
    model=model_name,
    messages=[{"role": "user", "content": "Say 'Hello World!'"}],
)
print(resp.choices[0].message.content)
```

A successful call returns a chat completion that uses your LoRA with its paired base model.

## Pricing

You pay only for storage and the inference you run, rather than for always-on servers or dedicated GPU instances. Pricing has two components:

* [**Storage**](https://coreweave.com/forge-pricing): You're billed for the storage that holds your LoRA weights.
* **Serverless Inference usage**: Calls that use LoRA artifacts are billed at the same rates as [standard model inference](https://docs.coreweave.com/products/inference/serverless/usage-limits.md#pricing).
