Why the old formats still exist
Keras predates Keras 3 by nearly a decade, and the ecosystem is full of models saved in the formats of that era. Rather than orphan them, Keras 3 keeps the loaders alive for backwards compatibility — you can still load_model an .h5 file from a 2018 project. What changed is the recommendation: these formats are for reading the past, not writing the future.
| Format | Extension | Notes |
|---|---|---|
| .keras | .keras | Recommended. Cross-backend, architecture + weights + optimizer |
| HDF5 | .h5 | Legacy. Weights only or full model. Still widely used |
| SavedModel | directory | TF-specific. Good for TF Serving |
The cost of each legacy format
The two legacy formats each carry a tax. HDF5 (.h5) can't reliably round-trip subclassed models or custom objects — it was built for the symbolic-graph world and struggles with arbitrary Python. SavedModel is a TensorFlow-specific directory, so it ties you to one backend and breaks the cross-backend portability the rest of this track depends on. Both predate the backend-agnostic weight storage that makes .keras portable, which is exactly why new work should target .keras and treat the legacy formats as a one-way door you walk out of.