Back to AI Infrastructure Mind Map
中文·English
🖥️ AI InfrastructureID: model-storage

Model Weight & Checkpoint Storage

模型权重与检查点存储
🎯Core Definition
Model weight and checkpoint storage. Safetensors separates tensor data from layout metadata: a JSON header describes each tensor's name, shape, dtype and byte offset, followed by the raw tensor bytes, enabling mmap zero-copy loading; in contrast, PyTorch's default `torch.save` uses pickle serialization, and unpickling executes arbitrary code carried by `__reduce__`, an RCE risk. Checkpoint layouts: single files are simple but coarse-grained; large models use sharded checkpoints (one shard per rank/layer group plus an index.json) for parallel save/load. A model registry (Hugging Face Hub style) pairs a Model Card (purpose, limitations, data and training info) with immutable versions, rollback and canary support. Size and load-time estimates: FP16 weights cost S=2×NparamsS = 2 \times N_{\text{params}} bytes and load in T=S/BT = S / B (BB = IO bandwidth), e.g. a 70B model S140GBS \approx 140\,\text{GB} takes roughly 12 seconds at 12GB/s PCIe.
💡Use Cases
weights of gigabytes to hundreds of gigabytes need fast, safe loading and distribution; production needs multi-version coexistence, rollback and audit; interviews ask why Safetensors is faster and safer than pickle, how large checkpoints are organized, and how a registry enables versioning.
Key Problems Solved
versus pickle, Safetensors avoids rebuilding an entire object graph (slow), has no code-execution surface (safe), and loads only requested tensors via mmap zero-copy (lazy) — hundreds of GB in seconds, with better cross-version stability. Versus manually copying weight files, an immutable-version registry with atomic switches makes rollback auditable and canary-friendly, preventing unrecoverable overwrite incidents.
🎯5 High-Frequency Exam Points
1
Safetensors vs pickle? Why is unpickling model weights unsafe?
2
Why does Safetensors load faster? The mechanics of mmap zero-copy and lazy loading?
3
Single-file vs sharded checkpoints? How does an index enable parallel load on resume?
4
Core capabilities of a model registry (HF Hub style)? What should a Model Card contain?
5
How to design production model rollback? Immutable versions, atomic publish and canary?
📖 In-depth Guide:📄 mlops-and-testing
Updated 2026-08-12
🎯
Test Your Knowledge: Practice Questions for "Model Weight & Checkpoint Storage"
Single choice pitfall questions with instant feedback and mistake tracking.
🚀 Start Card Practice
Previous CardDataset Management & LineageNext CardData Loading & IO

🔗 More AI Infrastructure Knowledge Cards

Activation Memory EstimationAgent Runtime (cross-module)Autoscaling & CostCheckpointing & Recovery