| 123456789101112131415161718192021222324252627282930313233343536373839404142 |
- package model
- // Standard tensor names for various architectures
- // These constants helps in normalizing and identifying tensor roles across different models (Llama, Qwen, etc.)
- const (
- // Embeddings & Head
- TensorTokenEmbeddings = "embed_tokens"
- TensorOutputHead = "lm_head"
- TensorNorm = "norm"
-
- // Attention
- TensorAttnQ = "self_attn.q_proj"
- TensorAttnK = "self_attn.k_proj"
- TensorAttnV = "self_attn.v_proj"
- TensorAttnO = "self_attn.o_proj"
- TensorAttnNorm = "input_layernorm" // pre-attention norm
-
- // MLP / FFN
- TensorMlpGate = "mlp.gate_proj"
- TensorMlpUp = "mlp.up_proj"
- TensorMlpDown = "mlp.down_proj"
- TensorMlpNorm = "post_attention_layernorm" // pre-mlp norm
-
- // Biases (Common suffixes)
- SuffixWeight = ".weight"
- SuffixBias = ".bias"
- )
- // ImportantPattern defines a mapping between a conceptual role and a regex pattern
- type ImportantPattern struct {
- Role string
- Pattern string
- }
- // DefaultCriticalPatterns returns a list of patterns typically considered critical (sensitive)
- func DefaultCriticalPatterns() []string {
- return []string{
- "embed_tokens",
- "lm_head",
- }
- }
|