Skip to content
data

ArrowConfig

ArrowConfig(top_k: int = 3, router_temperature: float = 1.0, use_gks: bool = False, rng_seed: int | None = None)

Options of Arrow, which routes each token to the best few of several LoRA adapters.

Arrow (Ostapenko et al., 2024, arXiv:2405.11157) builds a library of task-specific LoRA adapters and, at every layer, scores them against the token by the principal direction of each one's update, combining the top_k best with softmax weights. With use_gks general-knowledge adapters are subtracted first (GenKnowSub). task_adapter_names and gks_adapter_names are filled in by the function that assembles the library (lucid.peft.create_arrow_model), never passed. LoraConfig(arrow_config=...) makes its adapter the router.

Parameters

top_kint= 3
How many adapters are combined for each token.
router_temperaturefloat= 1.0
Softmax temperature of the combination weights; must be positive.
use_gksbool= False
Subtract the general-knowledge adapters first (GenKnowSub).
rng_seedint= None
Seed of the random start of the power iteration that finds each adapter's prototype; None draws it from the global generator.

Raises

ValueError
top_k or router_temperature is not positive.

Examples

>>> from lucid.peft import ArrowConfig
>>> config = ArrowConfig(top_k=2, router_temperature=0.5)
>>> config.top_k, config.use_gks, config.task_adapter_names
(2, False, None)

Used by 8