Documentation

Hesper.GGUF.Types

GGUF Format Type Definitions #

GGUF (Generic Graph Universal Format) is a binary format for storing large language models. This module defines the core data structures for the GGUF v3 format.

Format Structure #

[Header]        - Magic number, version, counts
[Metadata]      - Key-value pairs (architecture, hyperparameters)
[Tensor Info]   - Tensor descriptors (name, shape, type, offset)
[Alignment]     - Padding to align tensor data
[Tensor Data]   - Raw binary blobs

Reference #

GGUF file magic number: 0x46554747 ("GGUF" in ASCII)

Equations
Instances For

    Supported GGUF version

    Equations
    Instances For

      Default alignment for tensor data (32 bytes)

      Equations
      Instances For

        GGML tensor types (quantization formats)

        Instances For
          Equations
          Instances For

            Convert GGMLType to its numeric ID used in GGUF files

            Equations
            Instances For

              Parse GGMLType from numeric ID

              Equations
              Instances For

                Check if type is a ternary (BitNet) quantization format

                Equations
                Instances For
                  Equations
                  • One or more equations did not get rendered due to their size.

                  Metadata value types in GGUF

                  Instances For
                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For
                      Equations
                      • One or more equations did not get rendered due to their size.

                      Metadata value (simplified - stores raw bytes for now)

                      Instances For
                        Equations
                        • One or more equations did not get rendered due to their size.

                        GGUF file header

                        Instances For
                          Equations
                          • One or more equations did not get rendered due to their size.
                          Instances For
                            Equations
                            Instances For

                              Tensor information (metadata about a single tensor)

                              Instances For
                                Equations
                                • One or more equations did not get rendered due to their size.
                                Instances For

                                  Calculate total number of elements in tensor

                                  Equations
                                  Instances For

                                    Calculate size in bytes (for quantized types, this is approximate)

                                    Equations
                                    • One or more equations did not get rendered due to their size.
                                    Instances For

                                      Complete GGUF file structure

                                      Instances For
                                        Equations
                                        • One or more equations did not get rendered due to their size.
                                        Instances For
                                          Equations
                                          • One or more equations did not get rendered due to their size.

                                          Find tensor by name

                                          Equations
                                          Instances For

                                            Get tensor names

                                            Equations
                                            Instances For

                                              Find metadata value by key

                                              Equations
                                              Instances For

                                                Extract tensor data as ByteArray

                                                Equations
                                                Instances For