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:- Upload your LoRA weights as a Weights & Biases artifact.
- Reference the artifact URI as your model name in the API.
- CoreWeave dynamically loads your weights for inference.
Prerequisites
You need the following:- A CoreWeave Forge API key.
- A Weights & Biases project.
- Python 3.8+ with the
openaiandwandbpackages: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 settingwandb.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.
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, 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
loratype artifact in your CoreWeave Forge account. - Stored in the
coreweave-usstorage region for low latency. - Labeled with the model ID of its base model in the
wandb.base_modelmetadata field (for example,meta-llama/Llama-3.1-8B-Instruct). This ensures Serverless Inference loads it with the correct model.
- Saved in PEFT format as a
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:- Upload a LoRA you trained elsewhere
- Train a new LoRA with Serverless RL
- Train a new LoRA with supervised fine-tuning
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.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: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:
Reference a Serverless Training checkpoint
Serverless Training logs each checkpoint of a LoRA as an artifact version. Each version has astepN alias, such as :step25, in addition to its vN version number. Serverless Inference accepts either one:
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.
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: 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.