Overview
A LoRA adapter is a small set of weights applied on top of a loaded base model, swapping the model’s behavior without reloading multi-gigabyte weights. Every LoRA call goes through theRunAnywhere.lora namespace, not through top-level extension
functions. There is no loadLoraAdapter(), removeLoraAdapter(), clearLoraAdapters(), or
getLoadedLoraAdapters().
Imports
RunAnywhere.lora is a property returning a stateless LoRA namespace. All of its members are
suspend functions.
Basic usage
apply() returns a LoRAApplyResult with a success flag; check it rather than relying on an
exception.
Applying by path
The catalog-entry form is a convenience. The general form takes the generated request:LoRAAdapterConfig carries adapter_path, scale, adapter_id (links back to a catalog entry so
commons can validate the adapter against the loaded base model), metadata, and target_modules.
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. LoraAdapterCatalogEntry.default_scale carries the
adapter author’s recommendation; fall back to 1f when it is 0.
Stacking
RALoRAApplyRequest.adapters is a list, and replace_existing = false keeps what is already
applied. Both mechanisms stack adapters:
Removing
remove() returns the resulting LoRAState.
Inspecting state
LoRAAdapterInfo carries adapter_id, adapter_path, scale, applied, loaded_at_ms,
error_message, and error_code.
Compatibility
checkCompatibility() returns an incompatible result rather than throwing, including when the
underlying call fails. LoraCompatibilityResult carries is_compatible, error_message,
base_model_required, warnings, and error_code.
Catalog
Registering an adapter records its metadata so it can be discovered per base model.
Note the field names:
url not downloadUrl, compatible_models not compatibleModelIds,
size_bytes not fileSize, default_scale not defaultScale.
Discovery:
LoraAdapterCatalogQuery accepts adapter_id, model_id, downloaded_only, search_query, and
tags. adaptersForModel() and allRegistered() throw SDKException when the underlying catalog
call reports failure; queryCatalog() and listCatalog() return the result with its own success
flag.
Downloading
total_bytes is 0 until the planner has sized the artifact, which is why the fallback on
stage_progress is there.
Importing a local file
local_path; never construct an on-disk path yourself.
Full API
ViewModel
Notes
Everylora member throws SDKException with ERROR_CODE_NOT_INITIALIZED before
RunAnywhere.initialize(), and each one runs the phase-2 service bootstrap on first use.
Applying or removing an adapter recreates the inference context, so the KV cache is cleared and
conversation history does not carry across a swap.
Related
LLM generation
Text generation with options
LLM streaming
Streaming text generation
RAG pipeline
Retrieval-augmented generation
Best practices
Memory and lifecycle