pub struct MlaConfig {
pub num_heads: usize,
pub q_lora_rank: usize,
pub kv_lora_rank: usize,
pub qk_nope_head_dim: usize,
pub qk_rope_head_dim: usize,
pub v_head_dim: usize,
pub use_output_gate: bool,
pub rope: Option<MlaRopeConfig>,
}Expand description
Gated MLA (multi-head latent attention) hyperparameters, verified
against Kimi K3’s real config.json text_config block and the
real KimiMLAAttention reference implementation
(modeling_kimi_linear.py).
Fields§
§num_heads: usize§q_lora_rank: usize§kv_lora_rank: usize§qk_nope_head_dim: usize§qk_rope_head_dim: usize§v_head_dim: usize§use_output_gate: boolKimi K3’s addition on top of standard DeepSeek-style MLA:
attn_output *= sigmoid(g_proj(hidden_states)) before o_proj.
rope: Option<MlaRopeConfig>None reproduces Kimi K3’s real, confirmed behavior: no rotary
embedding at all (mla.rs’s module doc comment; the real
KimiMLAAttention.forward asserts use_nope and never calls a
rotary function). Some is for architectures whose decoupled
q_rot/k_rot slices genuinely are position-rotated – e.g.
GLM-5.2, whose real config.json (zai-org/GLM-5.2) sets
rope_interleave: true for its main attention (confirmed
against llama.cpp PR #25407’s LLAMA_ROPE_TYPE_NORM rope call
on q_pe/k_pe in src/models/glm-dsa.cpp).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MlaConfig
impl RefUnwindSafe for MlaConfig
impl Send for MlaConfig
impl Sync for MlaConfig
impl Unpin for MlaConfig
impl UnsafeUnpin for MlaConfig
impl UnwindSafe for MlaConfig
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,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more