pub struct Mla {
pub heads: usize,
pub q_lora_rank: Option<usize>,
pub kv_lora_rank: usize,
pub qk_nope: usize,
pub qk_rope: usize,
pub v_dim: usize,
pub rope: Rope,
pub scale: f64,
pub kv_b_split: bool,
}Expand description
Multi-head latent attention (DeepSeek V2/V3): the keys and values of every head are expanded from one shared
low-rank latent per position (kv_lora_rank wide, RMS-normed), and each head’s query and key carry a further
qk_rope dimensions that rotate — the key’s shared by every head. The query is a full projection, or itself
low-rank (q_lora_rank, normed between its two halves).
Fields§
§heads: usize§q_lora_rank: Option<usize>§kv_lora_rank: usize§qk_nope: usizePer-head query/key dimensions that do not rotate.
qk_rope: usizePer-head query/key dimensions that rotate (the trailing ones).
v_dim: usize§rope: Rope§scale: f64The score scale: 1/√(qk_nope + qk_rope), times YaRN’s magnitude squared.
kv_b_split: boolThe checkpoint stores the latent’s expansion split into its key half (attn_k_b, each head’s kv_lora_rank
rows of qk_nope) and its value half (attn_v_b, each head’s v_dim rows of kv_lora_rank), rather than as
one attn_kv_b of qk_nope + v_dim rows a head.
Trait Implementations§
impl StructuralPartialEq for Mla
Auto Trait Implementations§
impl Freeze for Mla
impl RefUnwindSafe for Mla
impl Send for Mla
impl Sync for Mla
impl Unpin for Mla
impl UnsafeUnpin for Mla
impl UnwindSafe for Mla
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.