Expand description
Task #12 / STELLAR §A — tensor-name → engine GEMM-role mapping + the ternary policy.
The transcoder (p64_weight) needs to know what each tensor is to (a) populate the P64
manifest with real engine roles (so a container boots without a GGUF re-parse) and (b) apply the
§A compression policy: ternary the FFN projections, keep attention + norms + embeddings at
higher fidelity (ternary norms/attention would wreck coherence).
Two naming conventions are recognised:
- GGUF / llama.cpp —
blk.{L}.attn_q.weight,blk.{L}.ffn_gate.weight,token_embd.weight, … - Hugging Face safetensor —
model.layers.{L}.self_attn.q_proj.weight,model.layers.{L}.mlp.gate_proj.weight,model.embed_tokens.weight,lm_head.weight, …
Structs§
- Tensor
Role - A resolved tensor identity: an engine role + its layer (
P64_LAYER_GLOBALfor non-layer tensors).
Functions§
- 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
Noneif 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.