TL;DR

Nhiều team đang lấy playbook DevOps áp thẳng vào app LLM và lúng túng. Sai ngay từ điểm xuất phát: DevOps, MLOps, LLMOps giải 3 bài toán hoàn toàn khác nhau.

  • DevOps xoay quanh code — deterministic, feedback loop đơn giản: chạy hay không chạy.
  • MLOps xoay quanh model — probabilistic, canh data drift + model decay, retrain định kỳ.
  • LLMOps xoay quanh foundation model — non-deterministic, không train từ đầu mà tối ưu qua 3 đường: prompt engineering, RAG, fine-tuning.

Điểm tách biệt LLMOps rõ nhất không phải ở kiến trúc mà ở monitoring: không còn là accuracy/drift, mà là hallucination, bias, toxicity, token cost, human feedback. Và evaluation loop feedback ngược cả 3 đường tối ưu cùng lúc — không phải linear pipeline nữa.

DevOps — software-centric

Code → test → deploy. Feedback loop là binary: "Does the code work?" Output deterministic — cùng input, cùng output. Bug là bug, fix là fix.

Artifact chính: code và infrastructure. Rủi ro lớn nhất: deployment failure. Cost tương đối dễ dự báo.

MLOps — model-centric

Đây là nơi nhiều dev lần đầu gặp khái niệm model decay: code không đổi, nhưng model chạy sản xuất kém dần vì thế giới ngoài kia thay đổi (user behavior, thị trường, distribution của input). Đó là data drift.

Pipeline MLOps classic: thu data → train → evaluate → deploy → monitor → retrain. Artifact: datasets, features, model binaries. Monitoring: accuracy, precision, recall, F1, RMSE, data drift, latency — toàn metric định lượng vs holdout set.

Dùng MLOps khi: recommendation engine (Spotify, Netflix), fraud detection, churn prediction, sales forecast — học pattern từ structured data để ra 1 prediction cụ thể. Cost chủ yếu ở training (GPU-hours). Inference rẻ.

LLMOps — foundation-model-centric

Khác biệt lớn: bạn không train từ đầu. Bạn chọn 1 foundation model (GPT, Claude, Llama, Gemini...) rồi tối ưu qua 3 đường:

1. Prompt Engineering

Viết và version prompt như version code. Zero-shot hoặc few-shot với 1-vài ví dụ hand-picked. Là đường nhanh nhất để điều khiển tone, format, behavior. Nhưng cũng brittle — model update 1 phát là prompt có thể vỡ.

2. Context / RAG Setup

Retrieve data từ vector DB / knowledge base tại runtime, inject vào context window. Không cần retrain khi data thay đổi. Dùng khi cần: factual grounding, proprietary data, giảm hallucination. Theo nghiên cứu RAGOps (arXiv 2506.03401), 60% enterprise LLM compound systems đã tích hợp RAG dưới dạng nào đó.

3. Fine-Tuning

Train tiếp foundation model trên domain data của bạn (LoRA, QLoRA, PEFT). Dùng khi: cần embed deep domain knowledge, brand voice, regulatory alignment. Thường là last resort — chỉ đụng khi prompt + RAG không đủ, vì cost và complexity cao.

Nguyên tắc vàng: fine-tuning cho style/tone/reasoning, RAG cho real-time facts. Chúng bổ trợ chứ không thay nhau.

Monitoring khác biệt hoàn toàn

Đây chính là điểm nhiều team bỏ sót khi chuyển từ MLOps sang LLMOps.

DimensionMLOpsLLMOps
Metric chínhAccuracy, precision, recall, F1, RMSEHallucination rate, toxicity, relevance, faithfulness
Drift quan tâmData drift, model decayPrompt drift, behavior drift, model-vendor update
TestingHoldout set, benchmark cố địnhGolden prompts (15-20), human judge, LLM-as-judge
Cost line itemTraining (GPU-hours)Inference (token per query)
Security riskData leakage qua input/outputPrompt injection, jailbreak, harmful content
Feedback loopTrigger retrain khi driftFeedback đồng thời vào prompt / RAG / fine-tune

Lý do đơn giản: bạn không thể chỉ check output đúng hay sai. Output phải an toàn, grounded, cost-effective. Một đoạn văn "đúng fact" vẫn có thể toxic, vẫn có thể leak PII, vẫn có thể đốt 10× token bình thường.

Evaluation loop không còn là linear pipeline

Trong MLOps, fail eval → retrain. Đường thẳng.

Trong LLMOps, fail eval có thể nghĩa là:

  • Prompt chưa đủ rõ → sửa prompt
  • Context thiếu/sai → cải RAG (cải chunking, embedding model, reranker)
  • Model không đủ năng lực domain → fine-tune
  • Hoặc cả 3 cùng lúc

Đây là lý do các platform LLMOps hiện đại (W&B Weave, LangSmith, Arize Phoenix, TruLens) đều track trace — chuỗi inference từ retrieval → prompt → generation → guardrail — chứ không chỉ track 1 metric đầu ra.

Cost dimension bị đánh giá thấp nhất

Chawla cảnh báo rất đúng: "Trong DevOps compute cost dự báo được. Trong LLMOps, 1 prompt sai có thể 10× token spend qua 1 đêm." Teams đã đốt cả budget tháng trong vài ngày chỉ vì không track token per query.

LLMOps phải có:

  • Token counter ở từng call (input + output)
  • Cost budget alert ở level tenant / feature / endpoint
  • Prompt cache để giảm redundant token
  • Model routing (dùng model nhỏ cho task đơn giản, model lớn cho task phức)

Prompt versioning & RAG pipeline là first-class citizens

Giống như data versioning đã trở thành bắt buộc trong MLOps, giờ prompt versioningRAG pipeline là first-class trong LLMOps. Mỗi prompt change = deployable artifact, có CI, có rollback, có golden test.

Guardrails cũng đã thành standard — theo framework RAGOps, có 4 stage:

  • Input rails — sanitize/reject user prompt độc hại
  • Dialog rails — điều phối dòng hội thoại
  • Retrieval rails — lọc/mask data retrieve về (đặc biệt PII)
  • Output rails — chặn/chỉnh response trước khi trả user

Chọn ops layer khớp với system bạn đang build

Đây là take-away thực dụng nhất:

  • Build SaaS bình thường → DevOps đủ.
  • Build fraud detection / recommendation / forecasting trên structured data → MLOps.
  • Build chatbot / copilot / RAG search / agent workflow trên LLM → LLMOps.
  • Build hệ thống agent autonomy cao → AgentOps (tầng trên LLMOps).

Chúng stack, không thay nhau. DevOps vẫn cấp CI/CD + infra cho tất cả. MLOps extend DevOps cho probabilistic model. LLMOps extend MLOps cho foundation model. AgentOps extend LLMOps cho autonomous agents. Mỗi tầng thêm 1 failure mode mới: deployment bug → model drift → hallucination → uncontrolled autonomy.

Over to you

LLM monitoring stack của bạn đang dùng gì? PromptLayer hay Helicone cho token tracking? RAGAS / TruLens cho eval? Hay còn đang log bằng console.log và pray?

Bài gốc từ @_avichawla. Tham khảo thêm: Daily Dose of DS, ZenML, Neptune.ai, RAGOps paper (arXiv 2506.03401).