Implementing MLOps in the Enterprise

Book description

With demand for scaling, real-time access, and other capabilities, businesses need to consider building operational machine learning pipelines. This practical guide helps your company bring data science to life for different real-world MLOps scenarios. Senior data scientists, MLOps engineers, and machine learning engineers will learn how to tackle challenges that prevent many businesses from moving ML models to production.

Authors Yaron Haviv and Noah Gift take a production-first approach. Rather than beginning with the ML model, you'll learn how to design a continuous operational pipeline, while making sure that various components and practices can map into it. By automating as many components as possible, and making the process fast and repeatable, your pipeline can scale to match your organization's needs.

You'll learn how to provide rapid business value while answering dynamic MLOps requirements. This book will help you:

  • Learn the MLOps process, including its technological and business value
  • Build and structure effective MLOps pipelines
  • Efficiently scale MLOps across your organization
  • Explore common MLOps use cases
  • Build MLOps pipelines for hybrid deployments, real-time predictions, and composite AI
  • Learn how to prepare for and adapt to the future of MLOps
  • Effectively use pre-trained models like HuggingFace and OpenAI to complement your MLOps strategy

Publisher resources

View/Submit Errata

Table of contents

  1. Preface
    1. Who This Book Is For
    2. Navigating This Book
    3. Conventions Used in This Book
    4. Using Code Examples
    5. O’Reilly Online Learning
    6. How to Contact Us
    7. Acknowledgments
      1. Yaron
      2. Noah
  2. 1. MLOps: What Is It and Why Do We Need It?
    1. What Is MLOps?
      1. MLOps in the Enterprise
      2. Understanding ROI in Enterprise Solutions
      3. Understanding Risk and Uncertainty in the Enterprise
      4. MLOps Versus DevOps
      5. What Isn’t MLOps?
    2. Mainstream Definitions of MLOps
      1. What Is ML Engineering?
      2. MLOps and Business Incentives
    3. MLOps in the Cloud
      1. Key Cloud Development Environments
      2. The Key Players in Cloud Computing
    4. MLOps On-Premises
    5. MLOps in Hybrid Environments
    6. Enterprise MLOps Strategy
    7. Conclusion
    8. Critical Thinking Discussion Questions
    9. Exercises
  3. 2. The Stages of MLOps
    1. Getting Started
      1. Choose Your Algorithm
      2. Design Your Pipelines
    2. Data Collection and Preparation
      1. Data Storage and Ingestion
      2. Data Exploration and Preparation
      3. Data Labeling
      4. Feature Stores
    3. Model Development and Training
      1. Writing and Maintaining Production ML Code
      2. Tracking and Comparing Experiment Results
      3. Distributed Training and Hyperparameter Optimization
      4. Building and Testing Models for Production
    4. Deployment (and Online ML Services)
      1. From Model Endpoints to Application Pipelines
      2. Online Data Preparation
    5. Continuous Model and Data Monitoring
      1. Monitoring Data and Concept Drift
      2. Monitoring Model Performance and Accuracy
    6. The Strategy of Pretrained Models
    7. Building an End-to-End Hugging Face Application
    8. Flow Automation (CI/CD for ML)
    9. Conclusion
    10. Critical Thinking Discussion Questions
    11. Exercises
  4. 3. Getting Started with Your First MLOps Project
    1. Identifying the Business Use Case and Goals
      1. Finding the AI Use Case
      2. Defining Goals and Evaluating the ROI
    2. How to Build a Successful ML Project
      1. Approving and Prototyping the Project
      2. Scaling and Productizing Projects
      3. Project Structure and Lifecycle
    3. ML Project Example from A to Z
      1. Exploratory Data Analysis
      2. Data and Model Pipeline Development
      3. Application Pipeline Development
      4. Scaling and Productizing the Project
      5. CI/CD and Continuous Operations
    4. Conclusion
    5. Critical Thinking Discussion Questions
    6. Exercises
  5. 4. Working with Data and Feature Stores
    1. Data Versioning and Lineage
      1. How It Works
      2. Common ML Data Versioning Tools
    2. Data Preparation and Analysis at Scale
      1. Structured and Unstructured Data Transformations
      2. Distributed Data Processing Architectures
      3. Interactive Data Processing
      4. Batch Data Processing
      5. Stream Processing
      6. Stream Processing Frameworks
    3. Feature Stores
      1. Feature Store Architecture and Usage
      2. Ingestion and Transformation Service
      3. Feature Storage
      4. Feature Retrieval (for Training and Serving)
    4. Feature Stores Solutions and Usage Example
      1. Using Feast Feature Store
      2. Using MLRun Feature Store
    5. Conclusion
    6. Critical Thinking Discussion Questions
    7. Exercises
  6. 5. Developing Models for Production
    1. AutoML
    2. Running, Tracking, and Comparing ML Jobs
      1. Experiment Tracking
      2. Saving Essential Metadata with the Model Artifacts
      3. Comparing ML Jobs: An Example with MLflow
      4. Hyperparameter Tuning
      5. Auto-Logging
    3. MLOps Automation: AutoMLOps
      1. Example: Running and Tracking ML Jobs Using Azure Databricks
      2. Handling Training at Scale
      3. Building and Running Multi-Stage Workflows
      4. Managing Computation Resources Efficiently
    4. Conclusion
    5. Critical Thinking Discussion Questions
    6. Exercises
  7. 6. Deployment of Models and AI Applications
    1. Model Registry and Management
    2. Solution Examples
      1. SageMaker Example
      2. MLflow Example
      3. MLRun Example
    3. Model Serving
      1. Amazon SageMaker
      2. Seldon Core
      3. MLRun Serving
    4. Advanced Serving and Application Pipelines
      1. Implementing Scalable Application Pipelines
      2. Model Routing and Ensembles
      3. Model Optimization and ONNX
    5. Data and Model Monitoring
      1. Integrated Model Monitoring Solutions
      2. Standalone Model Monitoring Solutions
    6. Model Retraining
      1. When to Retrain Your Models
      2. Strategies for Data Retraining
      3. Model Retraining in the MLOps Pipeline
    7. Deployment Strategies
    8. Measuring the Business Impact
    9. Conclusion
    10. Critical Thinking Discussion Questions
    11. Exercises
  8. 7. Building a Production Grade MLOps Project from A to Z
    1. Exploratory Data Analysis
    2. Interactive Data Preparation
      1. Preparing the Credit Transaction Dataset
      2. Preparing the User Events (Activities) Dataset
      3. Extracting Labels and Training a Model
    3. Data Ingestion and Preparation Using a Feature Store
      1. Building the Credit Transactions Data Pipeline (Feature Set)
      2. Building the User Events Data Pipeline (FeatureSet)
      3. Building the Target Labels Data Pipeline (FeatureSet)
      4. Ingesting Data into the Feature Store
    4. Model Training and Validation Pipeline
      1. Creating and Evaluating a Feature Vector
      2. Building and Running an Automated Training and Validation Pipeline
    5. Real-Time Application Pipeline
      1. Defining a Custom Model Serving Class
      2. Building an Application Pipeline with Enrichment and Ensemble
      3. Testing the Application Pipeline Locally
      4. Deploying and Testing the Real-Time Application Pipeline
    6. Model Monitoring
    7. CI/CD and Continuous Operations
    8. Conclusion
    9. Critical Thinking Discussion Questions
    10. Exercises
  9. 8. Building Scalable Deep Learning and Large Language Model Projects
    1. Distributed Deep Learning
      1. Horovod
      2. Ray
    2. Data Gathering, Labeling, and Monitoring in DL
      1. Data Labeling Pitfalls to Avoid
      2. Data Labeling Best Practices
      3. Data Labeling Solutions
      4. Using Foundation Models as Labelers
      5. Monitoring DL Models with Unstructured Data
    3. Build Versus Buy Deep Learning Models
    4. Foundation Models, Generative AI, LLMs
      1. Risks and Challenges with Generative AI
      2. MLOps Pipelines for Efficiently Using and Customizing LLMs
      3. Application Example: Fine-Tuning an LLM Model
    5. Conclusion
    6. Critical Thinking Discussion Questions
    7. Exercises
  10. 9. Solutions for Advanced Data Types
    1. ML Problem Framing with Time Series
      1. Navigating Time Series Analysis with AWS
      2. Diving into Time Series with DeepAR+
      3. Time Series with the GCP BigQuery and SQL
    2. Build Versus Buy for MLOps NLP Problems
    3. Build Versus Buy: The Hugging Face Approach
    4. Exploring Natural Language Processing with AWS
    5. Exploring NLP with OpenAI
    6. Video Analysis, Image Classification, and Generative AI
    7. Image Classification Techniques with CreateML
    8. Composite AI
      1. Getting Started with Serverless for Composite AI
      2. Use Cases of Composite AI with Serverless
    9. Conclusion
    10. Critical Thinking Discussion Questions
    11. Exercises
  11. 10. Implementing MLOps Using Rust
    1. The Case for Rust for MLOps
      1. Leveling Up with Rust, GitHub Copilot, and Codespaces
      2. In the Beginning Was the Command Line
    2. Getting Started with Rust for MLOps
    3. Using PyTorch and Hugging Face with Rust
    4. Using Rust to Build Tools for MLOps
      1. Building Containerized Rust Command-Line Tools
      2. GPU PyTorch Workflows
      3. Using TensorFlow Rust
      4. Doing k-means Clustering with Rust
    5. Final Notes on Rust
      1. Ruff Linter
      2. rust-new-project-template
    6. Conclusion
    7. Critical Thinking Discussion Questions
    8. Exercises
  12. A. Job Interview Questions
  13. B. Enterprise MLOps Interviews
  14. Index
  15. About the Authors

Product information

  • Title: Implementing MLOps in the Enterprise
  • Author(s): Yaron Haviv, Noah Gift
  • Release date: December 2023
  • Publisher(s): O'Reilly Media, Inc.
  • ISBN: 9781098136581