Expand description
Explicit architecture capability registry for the generic GGUF path.
Mirrors the pinned llama.cpp llm_arch / LLM_ARCH_NAMES inventory
(.scratch/llama.cpp/src/llama-arch.{h,cpp}) with Frink-side
classification into decoder families, memory kinds, and scope.
Unknown strings and detected-but-unimplemented features fail closed
(LoadError) instead of silently defaulting into fluent-but-wrong
logits.
Architecture names are registry keys only. Hot-path kernels never
branch on them; load-time resolution produces an ArchProfile
whose fields the decoder reads as plain data.
Structs§
- Arch
Profile - Load-time resolved profile for one GGUF
general.architecturestring. - SwaPattern
- llama.cpp’s hardcoded alternating sliding-window layout for one architecture: the period, and which end of each period is the full-attention layer.
- Unaudited
Triage - One architecture’s triage verdict, carried on its own catalog row.
Enums§
- Arch
Path - How the generic
Decoder/ModelConfig::from_ggufpath treats a GGUF architecture string. - Arch
Scope - How far this architecture is in Frink’s delivery scope (plan: text-generation parity; encoder/multimodal/diffusion/audio deferred).
- Decoder
Family - Shared execution family (maps many GGUF strings onto one engine path).
- Memory
Kind - Memory / KV backend selected once at load (llama.cpp
create_memory). - QkNorm
Style - How
attn_q_norm/attn_k_normweights are applied (when present). - SwaWindow
Override - What llama.cpp does with a nonzero
attention.sliding_windowthe file declares, for the architectures whoseload_arch_hparamsdoes not simply honour it. - Triage
Class - How much work admitting one UNAUDITED architecture to the generic path would actually be.
Constants§
- AUDITED_
GENERIC_ GQA - Architectures on the shared generic-GQA path that somebody has actually PROVEN, and the evidence for each.
- BIASED_
LAYER_ NORM - Architectures that normalise with a LayerNorm with a learned
weight AND bias –
build_norm(x, w, b, LLM_NORM, il)– at every norm site, the weights and the biases all REQUIRED. - BIASED_
RMS_ NORM - Architectures that normalise with an RMSNorm with a learned weight
AND bias –
build_norm(x, w, b, LLM_NORM_RMS, il)– at every norm site, all REQUIRED:phimoe(Phi-3.5-MoE), whose tensors arephimoe.cpp:20-21,28-29,35-36and whose graph isphi3’s (phi3.cpp:99-102,137-139,174-177pass the bias;phi3never creates one). Measured:grep -B3 LLM_NORM_RMS src/models/*.cpp | grep norm_bisphi3(this row’s graph),chameleon(passes NULL), anddeepseek32/glm-dsa/rwkv6qwen2/arwkv7on other engines.crate::norm::NormOp::RmsBias;tests/phimoe_graphs.rs. - LOGIT_
SOFTCAP_ ARCHITECTURES - Architectures outside the Gemma family whose graph applies the two
logit softcaps frink implements –
attn_logit_softcappingon the attention scores andfinal_logit_softcappingafter the lm_head. - NON_
PARAMETRIC_ LAYER_ NORM - Architectures that normalise with a non-parametric LayerNorm – subtract the mean, divide by the standard deviation, no learned weight and no bias – at every norm site.
- NON_
PARAMETRIC_ RMS_ NORM - Architectures that normalise with a non-parametric RMSNorm –
build_norm(x, nullptr, nullptr, LLM_NORM_RMS, il)– at every norm site: noattn_norm,ffn_normoroutput_normtensor in the file. - PER_
HEAD_ DISTINCT_ QK_ NORM - Architectures whose Q/K norm is the per-head RMSNorm with one weight
row per head (
QkNormStyle::PerHeadDistinct). Measured over the 155 graphs:attn_q_normcreated{n_embd_head_k, n_head}in five (chameleon,command-r,stablelm, which norm with LLM_NORM and arecrate::qk_layer_norm’s;talkie, whose weight is{1, n_head}; andplamo2, the one RMS row). - PER_
HEAD_ SCALAR_ QK_ GAIN - Architectures whose Q norm weight is one scalar per head and whose K
norm has no weight (
QkNormStyle::PerHeadScalar). Measured:attn_q_normcreated{1, n_head}in one of 155 graphs,talkie.cpp:26. - POST_
NORM_ ONLY_ ARCHITECTURES - Architectures whose layers have no pre-attention norm and no pre-FFN norm at all: the post-norm-only residual topology.
- SMALLTHINKER_
PINNED_ WINDOW - The third case’s one row:
src/models/smallthinker.cpp:4-8readsattention.sliding_windowinton_swa, tests it for> 0, and on that branch assignshparams.n_swa = 4096– the value it just read is used as a flag and then overwritten. So a SmallThinker file declaring 3 slides at 4096, and libllama’s logits for a fixture declaring 3 and the same fixture declaring 4096 are BYTE-IDENTICAL (measured,tests/router_input_graphs.rs). A file declaring 0 or nothing takes the other branch (:16-18): no window, every layer rotated. - TRIAGE_
PENDING - Unaudited generic-path architectures nobody has read against llama.cpp’s graph yet.
- WEIGHTED_
LAYER_ NORM - Architectures that normalise with a LayerNorm with a learned
weight and no bias –
build_norm(x, w, NULL, LLM_NORM, il)– at every norm site.
Functions§
- architecture_
catalog - Full inventory keyed by GGUF
general.architecturestring. Kept in sync with.scratch/llama.cpp/src/llama-arch.cppLLM_ARCH_NAMES. - attention_
scale_ override - llama.cpp’s
hparams.f_attention_scale, but only when it DIFFERS from the1/sqrt(head_dim)every frink attention kernel already applies.Nonemeans “the kernels’ own scale is already right”, so a caller stores it straight intoModelConfig::attention_scale. - canonical_
architecture - Resolve a GGUF
general.architecturevalue.Nonemeans the string is not in the registry – callers must fail closed rather than guess. The architecture whose TABLES an alias should be read from. - coverage_
report_ markdown - Markdown coverage table for docs / CI drift checks.
- default_
swa_ layout - embeddings_
scaled_ by_ sqrt_ n_ embd - True when this architecture’s graph multiplies every token
embedding by
sqrt(n_embd)as ARITHMETIC, reading no key for it. - is_
audited_ generic - Is this architecture’s use of the shared generic path backed by evidence?
- is_
post_ norm_ only - Does this architecture read the raw residual at both sublayers?
See
POST_NORM_ONLY_ARCHITECTURES. - resolve_
architecture - resolve_
profile - Resolve a GGUF
general.architecturevalue to its profile. - swa_
disabled_ by_ arch - Every architecture for which llama.cpp seeds a sliding-window period
before letting
{arch}.attention.sliding_window_patternoverride it, transcribed fromsrc/models/*.cpp. - swa_
rope_ base_ follows_ model - True when this architecture’s SWA layers use the model’s own RoPE
base rather than llama.cpp’s
rope_freq_base_train_swadefault of10000. - swa_
rope_ scale_ follows_ model - True when this architecture’s SWA layers inherit the model’s TRAINED
RoPE position scale rather than llama.cpp’s
rope_freq_scale_train_swadefault of1.0. - swa_
window_ override - See
SwaWindowOverride. - unaudited_
refusal_ detail - The triage half of the
UnauditedArchitecturerefusal, rendered for the user. - unaudited_
triage - This architecture’s triage verdict, or
Nonewhen it has not been triaged (seeTRIAGE_PENDING) or does not need one. - unsupported_
feature_ keys - Metadata keys that, when present with a nonzero value, require math
frink’s generic decoder does not implement unless the architecture
profile opts into those features (Gemma family), or the architecture
is named in
LOGIT_SOFTCAP_ARCHITECTURESfor the softcaps. - unsupported_
scaling_ keys - Scalar multipliers a checkpoint can declare in metadata that the generic decoder does not apply, with the value that means “no-op”.
- uses_
biased_ layer_ norm - See
BIASED_LAYER_NORM. - uses_
biased_ rms_ norm - See
BIASED_RMS_NORM. - uses_
geglu - Architectures whose FFN gate uses GELU rather than SiLU, i.e. GeGLU rather than SwiGLU.
- uses_
gelu_ ungated - Architectures whose FFN is the UNGATED GELU MLP:
build_ffn(up, up_b, NULL gate, down, down_b, LLM_FFN_GELU, LLM_FFN_SEQ), i.e.down(gelu(up(x) + up_b)) + down_b(starcoder2.cpp:125-131,codeshell.cpp:120-126). - uses_
non_ parametric_ layer_ norm - Does this architecture normalise without any learned parameters?
See
NON_PARAMETRIC_LAYER_NORM. - uses_
non_ parametric_ rms_ norm - See
NON_PARAMETRIC_RMS_NORM. - uses_
per_ head_ distinct_ qk_ norm - See
PER_HEAD_DISTINCT_QK_NORM. - uses_
per_ head_ scalar_ qk_ gain - See
PER_HEAD_SCALAR_QK_GAIN. - uses_
reglu - Architectures whose experts are the GATED ReLU MLP:
build_moe_ffn(..., LLM_FFN_RELU, ...)withgate_expspresent, whichllama-graph.cpp:2195-2197runs asggml_reglu_split(gate, up), i.e.down(relu(gate(x)) * up(x))(smallthinker.cpp:62,158). - uses_
relu_ sqr - Architectures whose FFN is the UNGATED ReLU-squared MLP:
build_ffn(up, NULL gate, down, LLM_FFN_RELU_SQR, LLM_FFN_SEQ), i.e.down(relu(up(x))^2)(arcee.cpp:123-128). - uses_
weighted_ layer_ norm - Does this architecture normalise with a weighted LayerNorm?
See
WEIGHTED_LAYER_NORM.