Файлы ML-модели, упаковка сервиса и безопасный rollout
Вы обучили и провалидировали ML-модель. Какие файлы и метаданные нужно версионировать, как упаковать сервис и как безопасно выкатить новую версию?
Ответить самому
Сначала сформулируйте ответ как на собеседовании, затем откройте разбор и оцените себя.
Короткий ответ
Version model weights, code, config, data/training metadata and evaluation results; package the inference service in a reproducible image or artifact setup; deploy through staging, canary/rolling rollout and monitoring.
Полный разбор
A deployable ML model is more than a file with weights. You usually need the model artifact, preprocessing/postprocessing code, dependency versions, feature schema, config, training data snapshot or lineage, evaluation report and a registry entry tying those pieces together. MLflow or a similar registry can store model versions, metrics and promotion state.
Packaging depends on size and operational needs. For small models, embedding weights into the Docker image can make deployment reproducible and simple. For large models, the image may contain only code and download/load the model artifact from object storage or a model registry, because rebuilding or redeploying a huge image for every code change is wasteful.
Serving often uses a Python API such as FastAPI behind Kubernetes or an internal PaaS. A safe rollout goes through staging, smoke tests, canary or rolling update, monitoring of latency/errors/business metrics, rollback hooks and model-version logging in predictions.
Теория
The core deployment question is artifact/version control plus rollout safety, not just "I saved weights and started an API".
Типичные ошибки
- Version weights but not preprocessing code or config.
- Put huge models into every application image without considering rebuild and startup cost.
- Skip rollback and prediction-time model-version logging.
Как отвечать на собеседовании
- Answer in the order registry -> package -> deploy -> monitor -> rollback.
- Mention when weights inside the image are acceptable and when separate artifacts are better.