Introduction
GGML files are the model files of the ggml
tensor library from before GGUF. They were used by llama.cpp and other ggml programs in
2023, usually with the extension .bin, and are still the model format of
whisper.cpp, whose speech
recognition models have names such as ggml-base.en.bin.
The format had no general way to add information: each program wrote a fixed list of settings for its own model type, so new model types and new quantisation methods kept breaking old files. llama.cpp replaced it with GGUF in August 2023 and no longer reads it.
Structure
Numbers are little-endian. The file starts with a 32-bit magic number, written as a number, so the bytes appear reversed:
ggml(byteslmgg): the original, unversioned layoutggmf(bytesfmgg): followed by a version numberggjt(bytestjgg): followed by a version number, with tensor data aligned to 32 bytes so it can be mapped into memory
0Magic and, in ggmf and ggjt files, a version4 or 8 bytes…Hyperparameters a fixed list of 32-bit numbers for the model type, such as vocabulary size, layers and headsvaries…Vocabulary each token as a length and its bytes, with a score in later versionsvaries…Tensors each with dimension count, name length, type, dimensions, name and datathe rest
Because the hyperparameters have no names, a reader must know in advance which model type wrote the file.
Also used for
Links
Software
- whisper.cpp (Windows, macOS, Linux)
Developers
- ggml, the C tensor library, whose examples read and write these files