This page follows
docs/gguf.md
in the ggml repository, read 2026-11-12, version 3 of the format. Numbers are little-endian unless the file was written big-endian (version 3
allows that; nothing in the file says so, and readers assume little-endian).
Header
| Offset | Type | Field |
|---|---|---|
0 | uint32 | magic: the bytes GGUF. |
4 | uint32 | version: 3. |
8 | uint64 | tensor_count. |
16 | uint64 | metadata_kv_count. |
24 | … | The metadata key-value pairs, then the tensor infos, padding, and the tensor data. |
Version 1 used 32-bit counts and string lengths; version 2 changed most of them to 64-bit; version 3 added big-endian files.
Metadata
Each pair is a key (a string), a value type (uint32), and the value. A string is a
uint64 length and UTF-8 bytes, with no NUL. A key is a standard GGUF string with three
caveats: it must be a valid ASCII string; it must be hierarchical, each segment
lower_snake_case and separated by a dot; and it is at most 216−1 =
65,535 bytes long. The specification says that any key that does not follow these rules is invalid.
| Type | Name | Type | Name |
|---|---|---|---|
| 0 | UINT8 | 7 | BOOL (1 byte: 0 is false, 1 is true; any other value is invalid and means either that the model is invalid or that the reader is buggy) |
| 1 | INT8 | 8 | STRING |
| 2 | UINT16 | 9 | ARRAY: element type (uint32), count (uint64), elements |
| 3 | INT16 | 10 | UINT64 |
| 4 | UINT32 | 11 | INT64 |
| 5 | INT32 | 12 | FLOAT64 |
| 6 | FLOAT32 |
Standard keys
| Key | Meaning |
|---|---|
general.architecture | Required: the model family, such as llama; it prefixes the architecture keys. |
general.quantization_version | Required when any tensor is quantised. |
general.alignment | Alignment of tensor data, a multiple of 8; 32 if absent. |
general.name, author, version, organization, basename, finetune, description, quantized_by, size_label | Descriptions. |
general.license, license.name, license.link | Licence. |
general.url, doi, uuid, repo_url | Where the model comes from. |
general.tags, languages, datasets | String arrays. |
general.file_type | The main quantisation of the file. |
general.source.*, general.base_model.count, general.base_model.N.* | The model it was converted or derived from. |
[arch].context_length, embedding_length, block_count, feed_forward_length, attention.head_count, attention.head_count_kv, rope.*… | Architecture hyperparameters, under the architecture’s name. |
tokenizer.ggml.model | llama, replit, gpt2, rwkv… |
tokenizer.ggml.tokens, scores, token_type, merges, added_tokens | The vocabulary. |
tokenizer.ggml.bos_token_id, eos_token_id, unknown_token_id, separator_token_id, padding_token_id | Special tokens. |
tokenizer.huggingface.json, tokenizer.rwkv.world, tokenizer.chat_template | Other tokenizer data; the chat template is Jinja. |
Standard keys in detail
From docs/gguf.md (read 2026-11-13), which says it describes the current
state and does not track key changes.
Community keys. The community may define its own key-value pairs to carry additional
data, but they should be namespaced with the community's name to avoid collisions; the specification's
example is that the rustformers community might use rustformers. as the prefix of
all its keys. A community key that becomes widely used may be promoted to a standardised key.
Integer width. By convention most counts and lengths are uint64 unless
stated otherwise, so that larger models can be supported later. Some models use uint32
for these values, and the specification recommends that readers support both.
Standard value formats. general.license is a string holding an
SPDX license expression
(the specification's example is MIT OR Apache-2.0) and nothing else: no licence text and no
URL (those go in general.license.name, a human-friendly name, and
general.license.link, a URL). general.languages is a string array of the
languages the model can speak, encoded as ISO 639
two-letter codes. general.architecture is all lower-case ASCII, only [a-z0-9]+;
the specification lists llama, mpt, gptneox, gptj,
gpt2, bloom, falcon, mamba and rwkv as
known values. general.quantization_version (uint32) is separate from the tensors'
quantisation scheme (for example scheme Q5_K, quantisation version 4); it must be present if any tensor
is quantised.
general.file_type(uint32, optional; the main type of the tensors, inferable from them): 0ALL_F32, 1MOSTLY_F16, 2MOSTLY_Q4_0, 3MOSTLY_Q4_1, 4MOSTLY_Q4_1_SOME_F16, 5MOSTLY_Q4_2and 6MOSTLY_Q4_3(support removed), 7MOSTLY_Q8_0, 8MOSTLY_Q5_0, 9MOSTLY_Q5_1, 10MOSTLY_Q2_K, 11MOSTLY_Q3_K_S, 12MOSTLY_Q3_K_M, 13MOSTLY_Q3_K_L, 14MOSTLY_Q4_K_S, 15MOSTLY_Q4_K_M, 16MOSTLY_Q5_K_S, 17MOSTLY_Q5_K_M, 18MOSTLY_Q6_K(the document's list ends here).- Source:
general.source.url,doi,uuid,repo_url(strings),general.base_model.count(uint32), and per parent id:general.base_model.{id}.name,author,version,organization,url,doi,uuid,repo_url. - Architecture keys (
[llm]is the architecture name):context_length(uint64, the training context),embedding_length(uint64),block_count(uint64; attention plus feed-forward blocks, not the input or embedding layers),feed_forward_length(uint64),use_parallel_residual(bool),tensor_data_layout(string; absent meansreference, the original order),expert_countandexpert_used_count(uint32, for MoE). - Attention:
attention.head_count(uint64),head_count_kv(uint64; absent or equal to the head count means no grouped-query attention),max_alibi_bias(float32),clamp_kqv(float32; clamp Q, K, V to [−C, C]),layer_norm_epsilon,layer_norm_rms_epsilon(float32),key_lengthandvalue_length(uint32; defaultn_embd / n_head). - RoPE:
rope.dimension_count(uint64),rope.freq_base(float32); scalingrope.scaling.type(none,linearoryarn),factor(float32),original_context_length(uint32),finetuned(bool); older models userope.scale_linear(float32), and both forms must be supported. - SSM:
ssm.conv_kernel,inner_size,state_size,time_step_rank(uint32). - Per-architecture lists (every key listed must be present): llama: context_length, embedding_length, block_count, feed_forward_length, rope.dimension_count, attention.head_count, attention.layer_norm_rms_epsilon; optional rope.scale, attention.head_count_kv, tensor_data_layout (
Meta AI original pth: the Q and K tensors are permuted by reshaping to (n_head, 2, rows/n_head/2, ...) and swapping axes 1 and 2), expert_count, expert_used_count. mpt: context_length, embedding_length, block_count, attention.head_count, attention.alibi_bias_max, attention.clip_kqv, attention.layer_norm_epsilon. gptneox: context_length, embedding_length, block_count, use_parallel_residual, rope.dimension_count, attention.head_count, attention.layer_norm_epsilon; optional rope.scale. gptj: context_length, embedding_length, block_count, rope.dimension_count, attention.head_count, attention.layer_norm_epsilon; optional rope.scale. gpt2: context_length, embedding_length, block_count, attention.head_count, attention.layer_norm_epsilon. bloom: context_length, embedding_length, block_count, feed_forward_length, attention.head_count, attention.layer_norm_epsilon. falcon: context_length, embedding_length, block_count, attention.head_count, attention.head_count_kv, attention.use_norm, attention.layer_norm_epsilon; optional tensor_data_layoutjploski(the fusedquery_key_valuetensor, grouped per kv head, is rearranged to all queries, then all keys, then all values). mamba: context_length, embedding_length, block_count, ssm.conv_kernel, ssm.inner_size, ssm.state_size, ssm.time_step_rank, attention.layer_norm_rms_epsilon. rwkv: architecture_version (uint32; only 4), context_length (uint64), block_count (uint64), embedding_length (uint64), feed_forward_length (uint64). whisper: encoder.context_length, embedding_length, block_count, mels_count (uint64), attention.head_count, and the same four for the decoder. - Tokenizer (
tokenizer.ggml.*):model(llama: SentencePiece with tokens and scores from HFtokenizer.model;replit: fromspiece.model;gpt2: GPT-2 or GPT-NeoX style BPE fromtokenizer.json;rwkv),tokens(array of strings by token ID),scores(float32 array, same length; absent means equal probability),token_type(int32 array, same length: 1 normal, 2 unknown, 3 control, 4 user defined, 5 unused, 6 byte),merges(absent means the tokens are atomic),added_tokens; special tokensbos_token_id,eos_token_id,unknown_token_id,separator_token_id,padding_token_id(uint32).tokenizer.huggingface.jsonholds a whole HFtokenizer.json;tokenizer.rwkv.worldan RWKV World vocabulary text verbatim;tokenizer.chat_templatea Jinja template. The ggml embedded vocabulary may tokenize less accurately than the original. - Standard tensor names for transformers:
token_embd,pos_embd,output_norm,output(each.weightand.bias), andblk.N.BBwith BB one ofattn_norm,attn_norm_2,attn_qkv,attn_q,attn_k,attn_v,attn_output,ffn_norm,ffn_up,ffn_gate,ffn_down,ffn_gate_inp(expert routing),ffn_gate_exp,ffn_down_exp,ffn_up_exp,ssm_in,ssm_conv1d,ssm_x,ssm_a,ssm_d,ssm_dt,ssm_out. - Not yet defined in the document: prompting metadata and LoRA metadata ("TODO"), and the computation graph (a possible future extension needing a new version).
File names: the GGUF naming convention
From the section “GGUF Naming Convention” of docs/gguf.md (read 2026-11-13).
A name has the form
[<Sidecar>]<BaseName><SizeLabel><FineTune><Version><Encoding><Type><Shard>.gguf,
where each component is delimited by a - if present. It is meant to let a person see the
most important details of a model at a glance. The specification says it is not intended to be
perfectly parsable in the field, because existing GGUF file names are so varied.
| Component | Meaning | Derived from |
|---|---|---|
| Sidecar (optional) | A prefix marking the file as an auxiliary module loaded alongside a base model, not a standalone model. It is the very first part of the name, followed by -, lower-case by convention. mmproj: multimodal projector (the vision or audio encoder and projection layer for use with a base LLM). mtp: Multi-Token Prediction heads (a speculative-decoding draft module to be loaded with a base model of matching architecture and version); the MTP weights are often inside the base model, in which case there is no separate mtp- file. | |
| BaseName | A descriptive name for the model base type or architecture. | general.basename, with spaces replaced by dashes |
| SizeLabel | The parameter weight class (useful for leader boards), written <expertCount>x<count><scale-prefix>. A rounded decimal point is allowed in the count together with a single-letter scale prefix. Extra -<attributes><count><scale-prefix> parts can be appended to show other attributes of interest. | general.size_label if available, or calculated if missing |
| FineTune | A descriptive name for the fine-tuning goal (for example Chat or Instruct). | general.finetune, with spaces replaced by dashes |
| Version (optional) | The model version, written v<Major>.<Minor>. If a model has no version number, assume v1.0 (first public release). | general.version |
| Encoding | The weight encoding scheme applied to the model. Content, type mixture and arrangement are decided by user code and can vary with project needs. | |
| Type | The kind of GGUF file and its intended purpose. If missing, the file is by default a typical GGUF tensor model file. LoRA: a LoRA adapter. vocab: a file with only vocabulary data and metadata. | |
| Shard (optional) | Shows that the model is split into several files, written <ShardNum>-of-<ShardTotal>. ShardNum is the position of this file and ShardTotal the total number of shards; each must be five digits padded with zeros. Numbering starts at 00001: the first shard is 00001-of-XXXXX, never 00000-of-XXXXX. |
The scale prefixes for the SizeLabel count are: Q quadrillion, T trillion,
B billion, M million and K thousand parameters.
Validating the convention
At a minimum every model file should have a BaseName, SizeLabel and Version, so that it can be easily validated as following the convention; for example, without a Version it is easy to mistake the Encoding for a FineTune. The specification gives this regular expression, which checks that the minimum BaseName, SizeLabel and Version are present in the right order:
^(?:(?<Sidecar>mmproj|mtp)-)?(?<BaseName>[A-Za-z0-9\s]*(?:(?:-(?:(?:[A-Za-z\s][A-Za-z0-9\s]*)|(?:[0-9\s]*)))*))-(?:(?<SizeLabel>(?:\d+x)?(?:\d+\.)?\d+[A-Za-z](?:-[A-Za-z]+(\d+\.)?\d+[A-Za-z]+)?)(?:-(?<FineTune>[A-Za-z0-9\s-]+))?)?-(?:(?<Version>v\d+(?:\.\d+)*))(?:-(?<Encoding>(?!LoRA|vocab)[\w_]+))?(?:-(?<Type>LoRA|vocab))?(?:-(?<Shard>\d{5}-of-\d{5}))?\.gguf$
The specification's example Node.js function applies it and gives the missing version the default
v1.0; its test cases give these results.
| File name | Sidecar | BaseName | SizeLabel | FineTune | Version | Encoding | Shard |
|---|---|---|---|---|---|---|---|
Mixtral-8x7B-v0.1-KQ2.gguf | Mixtral | 8x7B | v0.1 | KQ2 | |||
Grok-100B-v1.0-Q4_0-00003-of-00009.gguf | Grok | 100B | v1.0 | Q4_0 | 00003-of-00009 | ||
Hermes-2-Pro-Llama-3-8B-v1.0-F16.gguf | Hermes-2-Pro-Llama-3 | 8B | v1.0 | F16 | |||
Phi-3-mini-3.8B-ContextLength4k-instruct-v1.0.gguf | Phi-3-mini | 3.8B-ContextLength4k | instruct | v1.0 | |||
mtp-Qwen3-27B-v1.0-Q4_K_M.gguf | mtp | Qwen3 | 27B | v1.0 | Q4_K_M | ||
mmproj-Qwen2-VL-7B-v1.0-F16.gguf | mmproj | Qwen2-VL | 7B | v1.0 | F16 | ||
not-a-known-arrangement.gguf | no match (the function returns null) | ||||||
The prose examples of the specification read the same way. Mixtral-8x7B-v0.1-KQ2.gguf:
model name Mixtral, expert count 8, parameter count 7B, version v0.1, weight encoding KQ2.
Hermes-2-Pro-Llama-3-8B-F16.gguf (written without a version): model name “Hermes 2 Pro Llama 3”,
expert count 0, parameter count 8B, version v1.0 by the default rule, encoding F16, no shard.
Grok-100B-v1.0-Q4_0-00003-of-00009.gguf: Grok, expert count 0, 100B, v1.0, Q4_0, shard 3 of 9.
mtp-Qwen3-27B-v1.0-Q4_K_M.gguf: sidecar mtp, Qwen3, expert count 0, 27B (of the main model;
sidecar tensors are smaller), v1.0, Q4_K_M. mmproj-Qwen2-VL-7B-v1.0-F16.gguf: sidecar mmproj
(multimodal projector), Qwen2-VL, 7B (of the main model), v1.0, F16.
Before GGUF: GGML, GGMF and GGJT
From the “Historical State of Affairs” section of docs/gguf.md (read 2026-11-13),
which it gives for context only. GGUF is the successor of GGML, GGMF and GGJT.
At the time there were three file formats for LLMs:
- GGML (unversioned): the baseline, with no versioning or alignment.
- GGMF (versioned): the same as GGML but with a version number; only one version exists.
- GGJT: aligns the tensors so that
mmapcan be used. Versions 1, 2 and 3 are identical in layout, but the later versions use a quantisation scheme incompatible with the earlier ones.
GGML was used mainly by the examples in ggml, GGJT by llama.cpp models; other executors might use any
of them, which was not officially supported. All three share one structure: a magic number with an
optional version; model-specific hyperparameters (model metadata such as the number of layers and heads,
and an ftype for the type of most tensors, where in GGML files the quantisation version is the
ftype divided by 1000); an embedded vocabulary, a list of length-prefixed strings (GGMF and GGJT add a float32 score
next to each string); and finally the tensors, each with a length-prefixed name, type and data (aligned in GGJT).
See the GGML page for those layouts.
The specification lists these drawbacks that GGUF answers: the model architecture is not identified, so
programs cannot fail intelligently on a new one; adding or removing a hyperparameter breaks the format,
and a reader cannot detect it without heuristics; each architecture needs its own conversion script; and
backward compatibility needed tricks such as packing the quantisation version into ftype,
which readers and writers need not honour and which differ between the formats. Other formats were
rejected because they need extra dependencies to load or save (hard in C), have limited or no 4-bit
quantisation, carry cultural expectations (a directory or a file), lack embedded vocabularies, or leave
no control over their direction.