🤖 AI/ML

MLOps

Machine Learning Operations

A practice that automates ML models from development to operation. Includes model versioning, deployment, and monitoring.

📖 Detailed Explanation

MLOps (Machine Learning Operations) is a practice methodology that automates and systematizes the development, deployment, and operation of ML models. It applies DevOps principles to machine learning to implement continuous integration, deployment, and monitoring of models.

MLOps emerged around 2015 to resolve collaboration problems between data science teams and engineering teams. Leading ML companies such as Google and Netflix established a systematic methodology based on the lesson that "operating a model is 10 times harder than building it."

The core components of MLOps are version control (code, data, models), CI/CD pipelines (automated training, testing, deployment), monitoring (detection of performance drift and data drift), and a feature store (feature reuse). Maturity is divided into three levels, from Level 0 (manual) to Level 2 (fully automated).

In practice, adopting MLOps shortens model deployment time from weeks to hours and reduces model incident response time by more than 80%. Platforms such as MLflow, Kubeflow, Vertex AI, and SageMaker are used, and as of 2025, demand for MLOps engineers increased by 40% compared to the previous year.

💻 Code Example

import mlflow
import mlflow.sklearn
from sklearn.ensemble import RandomForestClassifier
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score, f1_score
import pandas as pd

# MLflow 실험 설정
mlflow.set_tracking_uri("http://localhost:5000")
mlflow.set_experiment("fraud_detection_v2")

# 데이터 로드 및 분할
data = pd.read_csv("transactions.csv")
X_train, X_test, y_train, y_test = train_test_split(
    data.drop("is_fraud", axis=1), data["is_fraud"],
    test_size=0.2, random_state=42
)

# MLflow Run 시작
with mlflow.start_run(run_name="rf_baseline"):
    # 하이퍼파라미터 로깅
    params = {"n_estimators": 100, "max_depth": 10, "min_samples_split": 5}
    mlflow.log_params(params)

    # 모델 학습
    model = RandomForestClassifier(**params, random_state=42)
    model.fit(X_train, y_train)

    # 예측 및 메트릭 계산
    y_pred = model.predict(X_test)
    metrics = {
        "accuracy": accuracy_score(y_test, y_pred),
        "f1_score": f1_score(y_test, y_pred),
        "precision": precision_score(y_test, y_pred),
        "recall": recall_score(y_test, y_pred)
    }
    mlflow.log_metrics(metrics)

    # 데이터 버전 기록
    mlflow.log_param("data_version", "v2.3.1")
    mlflow.log_param("training_samples", len(X_train))

    # 모델 저장 (아티팩트)
    mlflow.sklearn.log_model(
        model,
        artifact_path="model",
        registered_model_name="fraud_detection_rf"
    )

    # 피처 중요도 시각화 저장
    import matplotlib.pyplot as plt
    fig, ax = plt.subplots()
    ax.barh(X_train.columns, model.feature_importances_)
    plt.tight_layout()
    mlflow.log_figure(fig, "feature_importance.png")

    print(f"Run ID: {mlflow.active_run().info.run_id}")
    print(f"Metrics: {metrics}")

# 모델 레지스트리에서 프로덕션 버전 로드
model_uri = "models:/fraud_detection_rf/Production"
production_model = mlflow.sklearn.load_model(model_uri)

🗣️ Say It Like This in Practice

💬 In a Meeting
"We built an MLOps pipeline, so everything from model retraining to deployment now completes automatically within 2 hours. When data drift is detected, we get a Slack notification, and after the new model's performance is verified with A/B testing, it is rolled out automatically."
💬 In an Interview
"Achieving MLOps Level 2 maturity requires data version control, automated training pipelines, a model registry, and continuous monitoring. At my previous company, I led the transition from Level 1 to Level 2 by combining Kubeflow and MLflow."
💬 In a Technical Discussion
"Adopting a feature store is a game changer for MLOps. It guarantees the same features in training and inference, and by centrally managing feature computation logic, feature reuse across teams rose to 60%. Consider Feast or Tecton."

Take a mock interview on this topic → WIA SOOM AI Interview · Start for free

⚠️ Common Mistakes & Cautions

❌
Version-controlling only the model and ignoring the data

For model reproducibility, code, data, and environment all need version control. If you store only the model without the data, the results cannot be reproduced.

✅
Ensuring full reproducibility

Manage data versions with DVC, models and hyperparameters with MLflow, and the environment with Docker. All experiments should be traceable and reproducible.

🔗 Related Terms

📚 Learn More