Last updated: 2026-06-12
Model Format & Loading
Config
Platform-independent model types shared by Vulkan and Metal backends.
The actual extraction logic lives in loader.zig (Vulkan) and loader_metal.zig (Metal). Both share this config type for GGUF parsing, but keep separate loaders because loader.zig has Vulkan imports at the top level.
3 exports shown
enum
Architecture
pub const Architecture = enum Supported model families inferred from GGUF architecture metadata.
Multiple GGUF architecture strings may collapse to a single variant — for example `"llama"` maps to `.mistral` and `"qwen3"` maps to `.qwen2` because their forward-pass implementations are identical. `.unknown` is returned for any unrecognised string.
struct
ModelConfig
pub const ModelConfig = struct Normalized model dimensions and routing metadata extracted from GGUF fields.
SSM-specific fields (`ssm_d_*`, `ssm_n_group`, `full_attn_interval`) default to zero and are only meaningful for Mamba/Jamba/Qwen3.5 hybrid architectures. RoPE section fields (`rope_sections`, `rope_attn_factor`, `rope_scaling_factor`, `rope_original_context`) are used only by the `qwen35` IMRoPE scheme.
function
parseArchitecture
pub fn parseArchitecture(arch_str: []const u8) Architecture Map a GGUF `general.architecture` string to an `Architecture` variant.
The mapping is many-to-one: architecturally equivalent families share a variant (e.g. `"llama"` → `.mistral`, `"qwen3"` → `.qwen2`), so callers must not assume the variant name matches the original GGUF string.