AI file formats

Formats for trained AI models and the files that travel with them. Model weights are large arrays of numbers called tensors; some formats hold only those, others also describe the network so another program can run it. Training saves checkpoints, which can carry the optimiser state as well. Adapters such as LoRA hold a small set of extra weights that change a base model without replacing it. Beside the weights sit small text files: the tokenizer, which turns text into the numbers a language model reads, and the config, which gives the model’s architecture and sizes.

Formats

.BIN

GGML model file

The model format of ggml and whisper.cpp from before GGUF.

.CKPT

Model checkpoint

A training snapshot: weights, optimiser state and step counts.

.ENGINE

TensorRT engine

A model compiled by TensorRT for one NVIDIA GPU and TensorRT version.

.FST

OpenFst transducer

OpenFst’s binary finite-state transducer: a header and symbol tables, then the states.

.GGUF

GGUF model file

A language model for llama.cpp: metadata and quantised weights.

.JSON

Hugging Face model config

config.json: a model’s architecture and sizes, read before the weights.

.JSON

Hugging Face tokenizer

tokenizer.json: a language model’s vocabulary and tokenising rules.

.KERAS

Keras model

A whole Keras model: JSON config and HDF5 weights in a ZIP archive.

.MLMODEL

Core ML model

A model for apps on Apple devices, as a Protocol Buffers message.

.ONNX

ONNX model (ModelProto)

A neural network’s graph and weights in one Protocol Buffers message.

.PB

TensorFlow GraphDef (frozen graph)

A TensorFlow graph of operations; frozen graphs hold the weights as constants.

.PB

ONNX sequence or optional value (SequenceProto, OptionalProto)

An ONNX sequence or optional value: tensors in a list, as used by ONNX’s test data.

.PB

ONNX tensor (TensorProto)

One ONNX tensor: shape, data type and values, as used by ONNX’s test data.

.PB

TensorFlow SavedModel (saved_model.pb)

A TensorFlow model folder: saved_model.pb graph, variables and assets.

.PT

PyTorch model

Tensors saved by torch.save: a pickle and raw data in a ZIP archive.

.SAFETENSORS

LoRA adapter

Small low-rank A and B matrices that adjust a base model’s layers.

.SAFETENSORS

Safetensors

Model weights after a JSON header, safe to load with no code.

.TFLITE

TensorFlow Lite model

A model for phones and small devices, as one FlatBuffers file.