pub struct DecodeDims {
pub n_layers: usize,
pub n_kv_heads: usize,
pub head_dim: usize,
pub hidden: usize,
pub vocab: usize,
pub rope_width: usize,
pub embed_scale: Option<f64>,
}Expand description
The model-scalar geometry the shared build path needs.
Deliberately not a description of the KV state — that is
fuel_inference::decode_state_spec’s job (moved there in the fuel-core
dissolution; not an intra-doc link, since fuel-core cannot depend on
fuel-inference to resolve one), and conflating the two is the GAP-166
mistake. These are the dimensions of the graph this path builds.
Fields§
§n_layers: usize§n_kv_heads: usize§head_dim: usizeModel width (dim / hidden_size).
vocab: usize§rope_width: usizeWidth of the RoPE cos/sin tables. Equal to head_dim for a full-rotary
family (Llama, Qwen2); a partial-rotary family (Glm4) passes its
rotary_dim. Carried as a value rather than assumed, because that one
usize is the whole of Glm4’s divergence from this path.
embed_scale: Option<f64>Multiplier applied to the token embeddings before the layer loop.
None = no scaling, and None emits no graph node at all — a
Some(1.0) would still cost a mul_scalar, which is why this is an
Option rather than a plain f64 defaulting to 1.
Gemma-family models pass Some(sqrt(hidden_size)); everyone else None.
⚠️ It is the SEAM that applies this, deliberately, and the ordering is the reason. The scale must land BEFORE the activation dtype cast: prefill scales in f32, so scaling after a cast would round in bf16 on a bf16 cache and diverge — invisible on an f32 gate. A hook would let each family put it wherever, making that hazard per-family and silent; a value applied at one fixed point makes the ordering unforgettable.
It is a scalar rather than a dimension, which the struct’s name does not quite cover — stated here rather than left to overreach quietly.
Trait Implementations§
Source§impl Clone for DecodeDims
impl Clone for DecodeDims
impl Copy for DecodeDims
Source§impl Debug for DecodeDims
impl Debug for DecodeDims
Source§impl PartialEq for DecodeDims
impl PartialEq for DecodeDims
impl StructuralPartialEq for DecodeDims
Auto Trait Implementations§
impl Freeze for DecodeDims
impl RefUnwindSafe for DecodeDims
impl Send for DecodeDims
impl Sync for DecodeDims
impl Unpin for DecodeDims
impl UnsafeUnpin for DecodeDims
impl UnwindSafe for DecodeDims
Blanket Implementations§
impl<T> Boilerplate for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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