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= 3How many adapters are combined for each token.
router_ temperaturefloat= 1.0Softmax temperature of the combination weights; must be positive.
use_ gksbool= FalseSubtract the general-knowledge adapters first (GenKnowSub).
rng_ seedint= NoneSeed of the random start of the power iteration that finds each adapter's prototype;
None draws it from the global generator.Raises
ValueErrortop_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)