Inferensys

Glossary

SavedModel

SavedModel is TensorFlow's universal serialization format for trained models, containing the complete program, weights, and computation graph for deployment.
DevOps engineer deploying LLM to production on laptop, Kubernetes dashboards visible, late night deployment session.
ON-DEVICE MODEL FORMATS

What is SavedModel?

SavedModel is TensorFlow's universal serialization format for storing a complete, portable machine learning model.

A SavedModel is a directory containing a complete TensorFlow program, including trained model weights, a serialized computation graph, and the functions and assets needed for inference or retraining. It is the standard interchange format for TensorFlow ecosystems, serving as the primary input for deployment tools like the TFLite Converter and TensorFlow Serving. Its self-contained nature ensures model portability across different environments and versions.

The format encapsulates one or more MetaGraphs, which are tagged subsets of the model (like serve for inference or train for training). Internally, it uses protocol buffers for graph definition and a variables directory for checkpointed weights. This design enables advanced deployment workflows, such as signature-based serving for different inputs and outputs, and is foundational for model serialization within TensorFlow's toolchain for both cloud and edge deployment.

TENSORFLOW

Key Features of the SavedModel Format

SavedModel is TensorFlow's universal serialization format, encapsulating a complete, portable model with its weights, computational graph, and assets.

01

Complete Model Portability

A SavedModel is a standalone directory containing everything needed for inference or continued training. This includes:

  • The model's architecture (computation graph) defined as a TensorFlow GraphDef.
  • The model's learned weights (variables) in a checkpoint.
  • Assets (e.g., vocabulary files) required for preprocessing.
  • SignatureDefs that define the model's input and output tensor specifications. This self-contained nature allows a model to be moved between training and serving environments, different programming languages (Python, C++, Java), and deployment platforms without the original Python code.
02

Graph and Concrete Functions

SavedModel stores the model's execution logic as a TensorFlow Graph, which is a language-agnostic, optimized dataflow representation. For models built with TensorFlow 2.x APIs, it saves Concrete Functions—tensor-traceable, compiled versions of tf.function-decorated Python code. This enables:

  • Performance: Graph execution is typically faster and more memory-efficient than eager execution.
  • Deployment Flexibility: The graph can be executed by runtimes that don't have a Python interpreter, such as TensorFlow Serving or TensorFlow Lite.
  • Optimization: The graph can be transformed by compilers like TensorRT or XLA for hardware-specific acceleration.
03

SignatureDefs for Standardized APIs

SignatureDefs provide named entry points into the SavedModel's graph, formally defining the model's inference API. Each signature specifies:

  • Inputs: A map from logical input names (e.g., 'image') to TensorInfo protos describing the expected tensor (dtype, shape).
  • Outputs: A map from logical output names (e.g., 'probabilities') to their corresponding tensors.
  • Method Name: Typically tensorflow/serving/predict, tensorflow/serving/classify, etc. This standardization is critical for serving systems like TensorFlow Serving, which uses the serving_default signature to automatically generate a gRPC/REST API, ensuring clients know exactly how to format requests and parse responses.
04

Versioning and Multiple Graphs

A SavedModel directory includes a saved_model.pb (or saved_model.pbtxt) file and subdirectories named with version numbers (e.g., 1/, 2/). This structure supports:

  • Model Versioning: Multiple versions of the same model can coexist in one directory, allowing serving systems to roll out updates or rollbacks seamlessly.
  • Tagging: Each version is associated with tags (e.g., 'serve', 'train') that identify the graph's intended use. The 'serve' tag typically contains a graph optimized for inference, while 'train' may include additional ops like dropout and gradient computation.
  • Flexible Loading: APIs like tf.saved_model.load can load a specific graph version by specifying its tag set.
05

Assets and Initialization via Assets.extra

SavedModel can bundle external files, known as assets, which are copied into the model directory and whose TensorFlow-relative paths are stored in the graph. Common use cases include:

  • Lookup Tables: Vocabulary files for text processing models.
  • Initialization Files: Data needed to initialize resources when the model is loaded. These assets are accessed via the Assets.extra directory or through dedicated asset tensors in the graph. This ensures all model dependencies are colocated, eliminating runtime file path errors and simplifying deployment to containerized or remote serving environments.
06

Foundation for Downstream Toolchains

The SavedModel format is the primary entry point for TensorFlow's deployment and optimization toolchains. It serves as the standard source format for:

  • TensorFlow Lite Converter: Converts SavedModels to the .tflite format for mobile/embedded deployment.
  • TensorFlow.js Converter: Converts models for execution in web browsers or Node.js.
  • TensorFlow Serving: The high-performance serving system for production environments.
  • Compilation Targets: Frameworks like TensorRT and OpenVINO often consume SavedModels (or ONNX conversions thereof) for further hardware-specific graph optimizations, fusion, and quantization.
ON-DEVICE MODEL FORMATS

How SavedModel Works

SavedModel is TensorFlow's universal serialization format for a complete machine learning model, serving as the primary artifact for deployment across diverse environments.

A SavedModel is a directory containing a complete, serialized TensorFlow program, including its trained model weights, a computation graph describing the model's architecture, and essential metadata like signatures that define input/output tensors. This self-contained format is the standard output of tf.saved_model.save() and serves as the primary interchange format for TensorFlow Serving, TensorFlow Lite, and TensorFlow.js, enabling consistent deployment from cloud to edge. Its structure ensures all necessary components for inference or further training are preserved in a language-agnostic way.

The format's core is the saved_model.pb (or saved_model.pbtxt) file, a GraphDef protocol buffer storing the model's MetaGraph. This includes the graph structure, collections, and SavedModel signatures which define concrete functions for serving. Accompanying assets (e.g., vocabulary files) and a variables directory holding checkpointed weights complete the package. This design allows downstream tools, like the TFLite Converter, to parse, optimize, and transform the model for specific runtimes, making SavedModel the foundational source format for on-device deployment pipelines.

ON-DEVICE DEPLOYMENT COMPARISON

SavedModel vs. Other Model Formats

A technical comparison of TensorFlow's universal serialization format against other common formats used for deploying compressed models to edge and mobile devices.

Feature / MetricTensorFlow SavedModelTensorFlow Lite (TFLite)ONNXPyTorch TorchScript

Primary Framework

TensorFlow

TensorFlow

Framework-Agnostic

PyTorch

Serialization Format

Protocol Buffers

FlatBuffers

Protocol Buffers

TorchScript IR

Portability

High (within TF ecosystem)

Very High (cross-platform)

Very High (cross-framework)

High (within PyTorch/C++ runtime)

Hardware Delegate Support

Built-in Quantization Support

Graph Optimization Passes

AOT Compilation Support

Model Size (Typical)

Largest

< 50% of SavedModel

~60% of SavedModel

~70% of SavedModel

Memory Footprint at Runtime

Highest

Lowest

Low

Medium

Inference Latency (Relative)

Baseline

< 1.5x Baseline

~1.3x Baseline

~1.2x Baseline

Primary Deployment Target

Servers / Cloud

Mobile & Embedded

Cross-Platform Servers & Edge

Servers & Mobile (via PyTorch Mobile)

Human-Readable Metadata

SignatureDef Support (for multiple inference functions)

Versioning & Asset Management

DEPLOYMENT PIPELINE

Where is SavedModel Used?

SavedModel serves as the central, versioned artifact in the TensorFlow ecosystem, bridging model development with diverse production deployment targets.

SAVEDMODEL

Frequently Asked Questions

SavedModel is TensorFlow's universal serialization format for complete machine learning models. This FAQ addresses its core purpose, structure, and role in the on-device deployment pipeline.

A SavedModel is TensorFlow's universal, language-neutral serialization format that encapsulates a complete, portable TensorFlow program, including its trained parameters (weights), the computation graph defining its architecture, and the assets needed for inference or training resumption. It works by serializing the model's variables, graph definition, and signatures (defined input/output functions) into a directory containing a protocol buffer (saved_model.pb) file for the graph and a variables subdirectory for the weights. This self-contained format allows the model to be loaded and executed independently of the original Python code that created it, enabling deployment across diverse environments from cloud servers to mobile devices via conversion tools like the TFLite Converter.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.