Working through this module?0 of 19 done
Module 15 · Page 16 of 20 · 10 sections

MLOps and LLMOps

Software engineering practice for ML and LLM systems: lifecycle, how LLMOps differs, CI/CD, monitoring and the usual tools.

15.1

1. Introduction

  • MLOps and LLMOps help in building, deploying and managing machine learning and LLM applications in production.
  • They bring software engineering practices like CI/CD, monitoring, versioning and automation into the ML/AI lifecycle.
  • MLOps focuses on traditional ML models, while LLMOps is specific to Large Language Models and GenAI applications.
15.2

2. MLOps vs LLMOps

AspectMLOpsLLMOps
FocusTraditional ML models (classification, regression)Large language models (LLMs, GenAI)
DataStructured / unstructuredUnstructured text, documents, images, etc.
Model sizeUsually small to mediumVery large (billions of parameters)
Key challengesData drift, model driftPrompt management, context handling, hallucinations
DeploymentREST APIs, batchAPIs, vector DB, RAG pipelines, agents
MonitoringModel performance (metrics)Model + prompt + user feedback + cost
15.3

3. MLOps Architecture

Data CollectionTraining data
Data ProcessingCleaning, feature engineering
Model TrainingTraining, tuning
Model ValidationEvaluation
Model DeploymentREST API, batch
MonitoringMetrics, logs, alerts
RetrainingTrigger on drift
Retrain when drift is detected
15.4

4. Key Components (MLOps)

1
Data Pipeline
Collect, clean and prepare training data.
2
Feature Store
Store and manage features.
3
Model Training
Train and tune the model.
4
Model Registry
Version and store trained models.
5
Model Serving
Deploy the model as an API or batch job.
6
Monitoring
Monitor performance and data drift.
7
Retraining
Automate retraining when needed.
8
CI/CD Pipeline
Automate build, test and deployment.
15.5

5. LLMOps Architecture (Typical RAG-Based)

Data SourcesPDF, DOCX, web, DB, APIs
IngestionChunking, cleaning
Embedding ModelText to vector
Vector DatabasePinecone, Qdrant, etc.
User Query
RetrieverVector search
Prompt ConstructionContext + instructions
LLMGeneration (OpenAI, Llama, etc.)
Response to User
Monitoring, logging, evaluation and feedback loop
15.6

6. Key Components (LLMOps)

1
Data Ingestion
Load and preprocess documents (PDF, Web, etc.).
2
Chunking & Embeddings
Split text and generate vector embeddings.
3
Vector Database
Store and search embeddings (Pinecone, Qdrant).
4
Prompt Management
Manage and version prompts.
5
Model Serving
Integrate with LLM APIs (OpenAI, Llama, etc.).
6
Evaluation
Measure answer quality (relevance, faithfulness, etc.).
7
Monitoring
Track usage, cost, latency and quality.
8
Guardrails
Handle safety, bias and malicious inputs.
15.7

7. CI/CD Pipeline for MLOps / LLMOps

Code CommitGit push
Build & TestUnit, integration
Model Training
EvaluationAuto + human
DeployCloud / Kubernetes
15.8

8. Monitoring and Observability

1
Model Performance
Accuracy, latency, error rate and token usage.
2
Data Drift
Detect changes in input data distribution.
3
Model Drift
Detect degradation in output quality.
4
Prompt Monitoring
Track prompt performance and variations.
5
User Feedback
Collect thumbs up/down and ratings.
6
Cost Monitoring
Track API and infrastructure cost.
7
Logging & Tracing
Use tools like Prometheus, Grafana, ELK and Langfuse.
8
Alerts
Set thresholds and notify on anomalies.
15.9

9. Popular Tools

PurposeTools
Data processingApache Airflow, Prefect, Dagster
Vector databasePinecone, Qdrant, Weaviate, FAISS
Model servingFastAPI, BentoML, TorchServe, vLLM
Experiment trackingMLflow, Weights & Biases
MonitoringPrometheus, Grafana, Langfuse, Arize, TruLens
LLMOps frameworksLangChain, LlamaIndex, RAGAS, DeepEval
CI/CDGitHub Actions, GitLab CI, Jenkins, ArgoCD
DeploymentDocker, Kubernetes, AWS, GCP, Azure
15.10

10. Best Practices

  1. 1Automate the entire pipeline.
  2. 2Use versioning for data, models and prompts.
  3. 3Monitor performance and data drift continuously.
  4. 4Implement guardrails and safety checks.
  5. 5Use human evaluation for LLM outputs.
  6. 6Handle data and model drift.
  7. 7Keep reproducibility and documentation.
  8. 8Optimize for latency, cost and scalability.