pub enum QkNormStyle {
WholeVector,
PerHead,
PerHeadScalar,
PerHeadDistinct,
}Expand description
How attn_q_norm / attn_k_norm weights are applied (when present).
Variants§
WholeVector
OLMoE: one RMSNorm over the full Q/K projection width.
PerHead
Qwen3 / Gemma3: RMSNorm per head with weight length head_dim.
PerHeadScalar
Talkie (talkie.cpp:26,82-91): RMSNorm per head, then ONE
learned scalar per head for Q (attn_q_norm is {1, n_head}),
and the same per-head RMSNorm with NO weight for K (:90,
build_norm(Kcur, nullptr, ...)); there is no attn_k_norm
tensor. Decided by architecture (PER_HEAD_SCALAR_QK_GAIN), not
by the weight’s length: a file whose n_head == head_dim would
make the length ambiguous. Applied after RoPE, as the graph does.
PerHeadDistinct
PLaMo-2 (plamo2.cpp:92-93,163,166): RMSNorm per head with a
DISTINCT weight per head – attn_q_norm is {head_dim, n_head}
and attn_k_norm {head_dim, n_head_kv}, and build_norm over
the 3-d {head_dim, n_head, n_tokens} view norms each head and
multiplies by that head’s row. The weight is n_heads * head_dim
long, the same length as QkNormStyle::WholeVector’s, which is
why it is decided by architecture (PER_HEAD_DISTINCT_QK_NORM)
and not by the length rule.
Trait Implementations§
Source§impl Clone for QkNormStyle
impl Clone for QkNormStyle
impl Copy for QkNormStyle
Source§impl Debug for QkNormStyle
impl Debug for QkNormStyle
Source§impl Default for QkNormStyle
impl Default for QkNormStyle
impl Eq for QkNormStyle
Source§impl PartialEq for QkNormStyle
impl PartialEq for QkNormStyle
impl StructuralPartialEq for QkNormStyle
Auto Trait Implementations§
impl Freeze for QkNormStyle
impl RefUnwindSafe for QkNormStyle
impl Send for QkNormStyle
impl Sync for QkNormStyle
impl Unpin for QkNormStyle
impl UnsafeUnpin for QkNormStyle
impl UnwindSafe for QkNormStyle
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