SavedModel Format for TensorFlow
What You'll Learn
You'll understand how TensorFlow's SavedModel format structures and persists models, including its directory layout and metadata files.
The Core Idea
SavedModel is TensorFlow's native serialization format — think of it as a complete "snapshot" of your trained model bundled with everything needed to recreate it. Unlike Python's pickle or joblib (which serialize Python objects), SavedModel is language-agnostic and production-ready, storing the computation graph, weights, and serving signatures in a structured directory.
Directory Structure
When you save a TensorFlow model using tf.saved_model.save(), it creates a directory containing:
saved_model.pb: The core protocol buffer file containing the computation graph (model architecture) and metadatavariables/: A subdirectory storing all model weights and trainable parametersvariables.data-*: Actual weight tensorsvariables.index: Index mapping variable names to their data
assets/: Optional directory for external files (vocabularies, configuration files)
The Metadata
The saved_model.pb file stores:
- SignatureDefs: Named functions defining model inputs/outputs (e.g., "serving_default" for inference)
- MetaGraphs: Complete graph definitions including operations and collections
- Version information: TensorFlow version compatibility data
This structure enables framework-agnostic serving — you can load the model in TensorFlow Serving, convert it to TensorFlow Lite, or even read it from other languages without Python dependencies.
Analogy
Think of SavedModel as a self-contained software package: the .pb file is the executable with instructions, variables/ is the database of learned parameters, and assets/ contains configuration files — everything needed to run independently.
Key Takeaway: SavedModel is TensorFlow's production-grade serialization format, storing models as structured directories with graph definitions, weights, and metadata for language-agnostic deployment.