pub struct DeepseekV4CsaWeights {
pub role_proj: WeightMatrix,
pub role_gate: WeightMatrix,
pub indexer_key_proj: WeightMatrix,
pub indexer_q_proj: WeightMatrix,
pub indexer_head_weights: Vec<f32>,
pub indexer_top_k: usize,
}Expand description
A CSA layer’s extras: the doubled role projection and the Lightning
Indexer. Present only on a LayerCompressor::Csa layer, and its
absence there is a configuration error rather than a default.
§The doubled projection, which is the whole point of the split
On a CSA layer each raw token is projected twice: once for its
role as the tail of the block ending at it, and once as the head of
the next, overlapping block – two different learned projections of
the same token, not one reused twice (llama.cpp
load_arch_tensors’ coff = ratio == 4 ? 2 : 1, and
build_overlap_compressed_kv_from_state’s
GGML_ASSERT(kv_state->ne[0] == 2*n_embd_head)). A stack that
applies one uniform ratio gives every CSA layer a single-width
projection, which runs and produces numbers.
Fields§
§role_proj: WeightMatrixqk_head_dim -> 2 * qk_head_dim: the head-role projection in the
leading half, the tail-role projection in the trailing half.
role_gate: WeightMatrixThe same split for attn_comp_wgate’s scores, so every block row
carries the gate belonging to the role it was projected for.
indexer_key_proj: WeightMatrixOne indexer key per compressed entry.
A skeleton simplification, named rather than hidden: upstream
runs a separate compressor (indexer_comp_*) over the raw
indexer projections, where this projects the already-compressed
entry. The indexer keys are compressed representations either
way, which is what the top-k selection needs; the second
compressor’s own pooling is not reproduced here.
indexer_q_proj: WeightMatrixThe query side, qk_head_dim -> n_index_heads * index_head_dim.
indexer_head_weights: Vec<f32>One weight per index head; its length is n_index_heads.
indexer_top_k: usizeHow many compressed entries survive selection.
Auto Trait Implementations§
impl Freeze for DeepseekV4CsaWeights
impl RefUnwindSafe for DeepseekV4CsaWeights
impl Send for DeepseekV4CsaWeights
impl Sync for DeepseekV4CsaWeights
impl Unpin for DeepseekV4CsaWeights
impl UnsafeUnpin for DeepseekV4CsaWeights
impl UnwindSafe for DeepseekV4CsaWeights
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> 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