This article is a mirror article of machine translation, please click here to jump to the original article.

View: 2273|Reply: 0

[AI] (6) A brief introduction to the large model file format GGUF

[Copy link]
Posted on 2025-2-7 10:51:47 | | | |
Introduction to GGUF large model file format

Frameworks such as PyTorch are usually used for the development of large language models, and their pre-training results are usually saved in the corresponding binary format, such as the pt suffix file is usually the binary pre-training result saved by the PyTorch framework.

However, a very important problem with the storage of large models is that their model files are huge, and the structure, parameters, etc. of the model will also affect the reasoning effect and performance of the model. In order to make large models more efficient in storage and exchange, there are large model files in different formats. Among them, GGUF is a very important large model file format.

GGUF file stands for GPT-Generated Unified Format, which is a large model file format defined and released by Georgi Gerganov. Georgi Gerganov is the founder of the famous open source project llama.cpp.

GGUF is a specification for binary format files, and the original large model pre-training results are converted into GGUF format and can be loaded and used faster and consume lower resources. The reason is that GGUF uses a variety of technologies to preserve the pre-training results of large models, including the use of compact binary encoding formats, optimized data structures, memory mapping, etc.



GGUF, GGML, GGMF, and GGJT differences

GGUF is a binary format designed to load and save models quickly. It is the successor file format to GGML, GGMF, and GGJT, ensuring clarity by including all the information needed to load the model. It is also designed to be scalable so that new information can be added to the model without breaking compatibility.

  • GGML (No Version): Baseline format with no versioning or alignment.
  • GGMF (Versioned): Same as GGML, but with versioning.
  • GGJT: Align tensors to allow use with mmaps that need to be aligned. v1, v2, and v3 are the same, but later versions use different quantization schemes that are not compatible with previous versions.


Why GGUF format large model files perform well

The GGUF file format is able to load models faster due to several key features:

Binary format: GGUF, as a binary format, can be read and parsed faster than text files. Binaries are generally more compact, reducing the I/O operations and processing time required for reading and parsing.

Optimized Data Structures: GGUF may employ specially optimized data structures that support quick access and loading of model data. For example, data may be organized as needed for memory loading to reduce processing on load.

Memory Mapping (mmap) Compatibility: If GGUF supports memory mapping (mmap), this allows data to be mapped directly from disk to memory address space, resulting in faster data loading. This way, the data can be accessed without actually loading the entire file, which is especially effective for large models.

Efficient Serialization and Deserialization: GGUF may use efficient serialization and deserialization methods, which means that model data can be quickly converted into usable formats.

Few dependencies and external references: If the GGUF format is designed to be self-contained, i.e. all the required information is stored in a single file, this will reduce the external file lookup and read operations required when parsing and loading the model.

Data Compression: The GGUF format may employ effective data compression techniques, reducing file sizes and thus speeding up the reading process.

Optimized Indexing and Access Mechanisms: The indexing and access mechanisms for data in files may be optimized to make finding and loading specific data fragments needed more quickly.

In summary, GGUF achieves fast model loading through various optimization methods, which is particularly important for scenarios that require frequent loading of different models.

Common models for deep learning (.pt, . onnx) file format
https://www.itsvse.com/thread-10929-1-1.html

GGUF sample file:The hyperlink login is visible.
llama.cpp Project Address:The hyperlink login is visible.




Previous:[AI] (5) Print out the Ollama request information
Next:The frontend generates a .d.ts file from the .js file
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com