These formats were never written down as a specification. This page describes them
as the llama.cpp loader read them before it moved to GGUF
(its llama.cpp and llama.h at tag
master-2e6cd4b),
and as the “Historical State of Affairs” in
gguf.md
summarises them, both read 2026-11-12. Numbers are little-endian 32-bit unless noted.
gguf.md says the plain ggml layout was mainly used by the examples in
ggml and ggjt by llama.cpp; all share the same frame with model-specific
hyperparameters.
Magic numbers and versions
| Magic (number) | Bytes in the file | Version | Notes |
|---|---|---|---|
0x67676D6C ggml | 6C 6D 67 67 | None | The first layout; vocabulary without scores. |
0x67676D66 ggmf | 66 6D 67 67 | 1 | Adds a version and token scores. |
0x67676A74 ggjt | 74 6A 67 67 | 1, 2, 3 | Tensor data aligned to 32 bytes for memory mapping. Version 2 changed the quantisation format and version 3 the Q4 and Q8 formats; gguf.md says the three are otherwise identical but incompatible. |
LLaMA hyperparameters
Seven 32-bit integers, in this order:
| Field | Meaning |
|---|---|
n_vocab | Vocabulary size |
n_embd | Embedding width |
n_mult | Used to work out the feed-forward width |
n_head | Attention heads |
n_layer | Layers |
n_rot | Rotary embedding dimensions |
ftype | File type |
Vocabulary and tensors
- Vocabulary:
n_vocabentries, each a 32-bit length, the token’s bytes and (ggmf, ggjt) a 32-bit float score. - Tensors, until the end of the file: number of dimensions, name length, type (all 32-bit), the dimensions (32-bit each; the LLaMA loader accepts only 1 or 2), the name, then in ggjt files padding to a multiple of 32 bytes from the start of the file, then the data. The type uses the ggml type numbers listed on the GGUF types page.
File types
| ftype | Meaning |
|---|---|
| 0 | All F32 |
| 1 | Mostly F16 |
| 2 | Mostly Q4_0 |
| 3 | Mostly Q4_1 |
| 4 | Mostly Q4_1; tok_embeddings.weight and output.weight F16 |
| 5, 6 | Q4_2, Q4_3 (removed) |
| 7 | Mostly Q8_0 |
| 8 | Mostly Q5_0 |
| 9 | Mostly Q5_1 |
| 10 | Mostly Q2_K |
| 11, 12, 13 | Mostly Q3_K_S, Q3_K_M, Q3_K_L |
| 14, 15 | Mostly Q4_K_S, Q4_K_M |
| 16, 17 | Mostly Q5_K_S, Q5_K_M |
| 18 | Mostly Q6_K |
“Mostly” because, as the header comments say, one-dimensional tensors are left
out. Values 0 to 9 are in the old llama.h; 10 to 18 are listed in
gguf.md as GGUF’s general.file_type, which uses the same
numbers. In plain ggml files, gguf.md says the quantisation version
is packed into ftype as a multiple of 1,000.