Skip to main content

DeepseekV4CsaWeights

Struct DeepseekV4CsaWeights 

Source
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_tensorscoff = 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: WeightMatrix

qk_head_dim -> 2 * qk_head_dim: the head-role projection in the leading half, the tail-role projection in the trailing half.

§role_gate: WeightMatrix

The 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: WeightMatrix

One 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: WeightMatrix

The 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: usize

How many compressed entries survive selection.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.