Skip to main content

Overview

A LoRA adapter is a small set of weights applied on top of a loaded base model, changing the model’s behavior without reloading multi-gigabyte weights. The lora namespace has three verbs.

Verbs

apply() looks the adapter up by id, downloads its weights when they are absent, and layers it onto the loaded base model. It throws SDKException when the adapter is unknown, incompatible, or the apply fails. scale is optional. Left null, the adapter’s own recommended scale applies, falling back to 1.0.

Scale

scale controls how strongly the adapter shifts generation. 0.0 loads it inert, 1.0 is full strength, and values above 1.0 amplify.

Removing

Inspecting state

AppliedAdapter carries id and scale.

Registering and discovering adapters

Commons keeps the adapter catalog behind a separate ABI, so registration, discovery, and explicit downloads still come from RunAnywhere.loraCatalog in com.runanywhere.sdk.public.extensions. That accessor is deprecated and kept for one release, but it is the only path to those verbs today.
Field names are snake_case because the entry is a generated proto type: url not downloadUrl, size_bytes not fileSize. loraCatalog also carries allRegistered(), queryCatalog(), download(entry, onProgress), and importAdapter(sourcePath) for a local file. lora.apply() downloads on its own, so an explicit download() is only for showing progress.

ViewModel

Notes

Applying or removing an adapter recreates the inference context, so the KV cache is cleared and conversation history does not carry across a swap. Every lora verb throws SDKException with ERROR_CODE_NOT_INITIALIZED before RunAnywhere.initialize().

LLM generation

Text generation with options

LLM streaming

Streaming text generation

RAG

Retrieval-augmented generation

Best practices

Memory and lifecycle