pub struct LoraPair {
pub a: DenseWeight,
pub b: DenseWeight,
pub rank: u32,
pub k_in: u32,
pub n_out: u32,
pub scale: f32,
pub max_rank: u32,
}Expand description
2026-09-25: One adapted module, with the PEFT tensors in their own layouts, which are the
[N, K] weight layout the dense kernels expect:
a: [max_rank, k_in] row-major BF16 (PEFT lora_A [r, in_features] in the first rank
rows, zero rows after);
b: [n_out, max_rank] row-major BF16 (PEFT lora_B [out_features, r] in the first
rank columns of each row, zero columns after).
scale is lora_alpha / r, or lora_alpha / sqrt(r) with use_rslora, from the adapter’s
config, where use_rslora is required (config/src/parsers/lora.rs). It is applied in the fold,
not folded into B.
Fields§
§a: DenseWeight§b: DenseWeight§rank: u32§k_in: u32§n_out: u32§scale: f32§max_rank: u322026-09-25: The pool’s padded rank: the row stride of b and the row count of a. The
shrink produces max_rank columns and the expand contracts over max_rank, because B rows
are max_rank elements apart: an expand at k = rank would misread every row after the
first when rank < max_rank. The pad entries are zero.