Skip to content

Add runtime LoRA adapter swapping #2045

Description

@wonsup-shin

Hi,
I've built a working patch for runtime LoRA swapping and want to confirm it's within scope before opening a PR.

What it does: writes W ← W + scale × (B @ A) in-place on an existing StorageView buffer. This allows swapping LoRA adapters at runtime without reloading the model.

Motivation: serving N language-specific adapters on a single base model. Measured on L4 GPU (Whisper-large-v3 float16): cross-adapter swap ~54 ms vs ~1,520 ms for full model reload.

Patch size: 142 lines across 3 files. No existing API changed.

Questions:

Is this within scope for CTranslate2?
Should it be guarded by an experimental build flag?
Where should the Python binding live — currently on WhisperWrapper, but we've verified it works on OmniASR (Encoder/Generator) with the same pattern. Should it be on the base Model instead?
Happy to open a PR if the direction looks good.

Related: #2046

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions