Skip to main content

Module tensor_roles

Module tensor_roles 

Source
Expand description

Canonical tensor identities and the preserved FFN precision selection policy.

Structs§

TensorRole
A resolved tensor identity: an engine role + its layer (P64_LAYER_GLOBAL for non-layer tensors).

Functions§

canonical_suffix
Canonical GGUF suffix for a tensor role. Loaders use this to normalize model-family names before the live prefill path resolves LayerTensors.
name_is_ternary_eligible
True iff this tensor name resolves to an FFN projection (so it is ternary-eligible). A name we cannot classify is not ternarised (fail safe to high fidelity).
name_to_role
Map a tensor name (GGUF or HF convention) to its engine role + layer, or None if unrecognised.
ternary_eligible
The §A ternary policy: only the FFN projection weights (gate / up / down) are eligible for BitNet-1.58b ternary packing. Attention projections, norms, and embeddings stay at higher fidelity — ternarising them destroys coherence.