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

# LoRA Adapters

> Layer an adapter onto the loaded base model

A LoRA adapter specialises a base model without swapping it out. The base model stays loaded
throughout, so switching behaviour costs far less than switching models.

```ts theme={null}
await RunAnywhere.lora.apply('legal-summarizer', 0.8)

const result = await RunAnywhere.llm.generate('Summarize this clause: …')

await RunAnywhere.lora.remove('legal-summarizer')
```

## The short form

```ts theme={null}
lora.apply(adapterId: string, scale?: number): Promise<void>
lora.remove(adapterId?: string): Promise<void>
lora.removeAll(): Promise<void>
lora.list(): Promise<LoraState>
lora.state(): Promise<ProtoLoraState>
```

## Scale

`scale` controls how strongly the adapter pulls the base model. Leave it unset for the
adapter's own default.

Lower values blend the adapter with base behaviour; higher values commit to it. If output
degrades after applying an adapter, scale is the first thing to turn down.

## Catalog management

Electron carries the full surface, matching Swift rather than the short form the other
TypeScript SDKs have.

```ts theme={null}
await RunAnywhere.lora.register(entry);
await RunAnywhere.lora.registerArtifact(/* … */);
await RunAnywhere.lora.download(/* … */);
await RunAnywhere.lora.importAdapter(sourcePath);
await RunAnywhere.lora.listCatalog(query?);
await RunAnywhere.lora.queryCatalog(query);
await RunAnywhere.lora.checkCompatibility(config);
```

`importAdapter(sourcePath)` takes a file from disk. On a desktop that is how most people will
bring their own adapter, and it is worth wiring to a file picker.

## Check compatibility first

```ts theme={null}
const verdict = await RunAnywhere.lora.checkCompatibility(config)
```

An adapter is trained against a specific base model. Applying one to a different base either
fails or produces nonsense, so check rather than discovering it in the output.

## Switching adapters

Adapters stack. Remove before applying another, or two of them fight and the output is worse
than either alone.

```ts theme={null}
async function useAdapter(id: string): Promise<void> {
  await RunAnywhere.lora.removeAll()
  await RunAnywhere.lora.apply(id)
}
```
