DevOps বনাম MLOps
এই পাঠে যা শিখবেন
- DevOps এবং MLOps — কোন axis-গুলো common, কোন axis নতুন
- প্রতিটি stage (build, test, deploy, monitor)-এ ML যা যোগ করে
- DevOps team-কে MLOps mindset-এ আনার strategy
- Reproducibility-এর difference — software বনাম ML
১ · DevOps quickly recap
DevOps হলো development + operations-এর integration। মূল ধারণা:
- Version control: code git-এ। প্রতিটি change traceable।
- CI: code change → automated build + test।
- CD: tested code automated deploy।
- Infrastructure as code: Terraform, Ansible — manual provisioning নেই।
- Monitoring: uptime, latency, error rate।
- Iterative culture: short cycles, fast feedback, blameless postmortem।
২ · MLOps যা যোগ করে — তিনটি axis
Software system: code।
ML system: code + data + model।
তিনটি axis-ই বদলায় — তিনটিকেই version, test, monitor করতে হবে। DevOps tools একটি axis (code) cover করে; বাকি দু'টোতে নতুন tooling।
৩ · Side-by-side comparison
প্রতিটি stage-এ MLOps যা যোগ করে:
- Versioning:
- DevOps: git for code.
- MLOps: git + DVC/Git LFS for data + Model Registry for models. GitGitdistributed version control system। Code-এর জন্য optimized — text diff-এ কাজ করে। GB-scale binary file-এ কাজ করে কিন্তু painful। বড় binary file-এ ভাল কাজ করে না।
- Testing:
- DevOps: unit, integration, E2E.
- MLOps: unit + data validation + model performance test + fairness test + drift simulation।
- Build artifact:
- DevOps: Docker image, jar, binary.
- MLOps: Docker image + serialized model + feature transformer + metadata (MLflow signature)।
- Deployment:
- DevOps: blue-green, rolling, canary।
- MLOps: same patterns + shadow deployment + champion-challenger + A/B test।
- Monitoring:
- DevOps: latency, error rate, CPU।
- MLOps: above + data drift + concept drift + prediction distribution + accuracy (yet ground truth lag)।
- Rollback:
- DevOps: previous container image।
- MLOps: previous model version + matching feature schema + matching data snapshot।
- Reproducibility:
- DevOps: same input → same output (deterministic)।
- MLOps: same code + same data + same seed + same hardware → same model (much harder)।
৪ · নতুন MLOps-নির্দিষ্ট ধারণা
যেগুলো DevOps-এ exist করে না:
- Data drift: input distribution বদল (Lesson 25)।
- Concept drift: input-output সম্পর্ক বদল (Lesson 26)।
- Training-serving skew: training ও production-এর feature mismatch (Lesson 12)।
- Model registry: versioned model + lifecycle stages (Lesson 11)।
- Feature store: centralized feature definition + serving (Lesson 12)।
- Experiment tracking: hyperparameter + metric + artifact log (Lesson 8)।
- Continuous training (CT): production-এ মডেল নিজে নিজে refresh।
- Model interpretability: SHAP, LIME, attention visualization।
- Fairness audit: subgroup performance, bias detection।
৫ · DevOps tools-এর fit/misfit
- Git — works partially: code yes, large data no। DVC দরকার।
- Jenkins/GH Actions — works: ML pipeline trigger করতে পারে। কিন্তু "model better than baseline?" type test লিখতে হয়।
- Docker — perfectly fits: reproducible environment।
- Kubernetes — works with extensions: Kubeflow, Kserve — ML-specific add-on।
- Prometheus/Grafana — works: infrastructure metric। ML-specific custom metric add করতে হয়।
- SonarQube — limited: code quality, but model quality না।
৬ · একটি concrete pipeline comparison
# --- DevOps pipeline (web app) ---
name: deploy-webapp
on: [push]
jobs:
build:
steps:
- uses: actions/checkout@v4
- run: npm install
- run: npm test # unit tests
- run: docker build -t app .
- run: docker push app
- run: kubectl rollout restart deployment/app
# --- MLOps pipeline (ML service) ---
name: deploy-ml-model
on:
push:
paths: ['src/**', 'data/**', 'config/**']
schedule:
- cron: '0 2 * * *' # nightly retrain
jobs:
build_and_train:
steps:
- uses: actions/checkout@v4
- run: dvc pull # data version pull
- run: pytest tests/ # code tests
- run: python validate_data.py # ⭐ data validation
- run: python train.py # ⭐ training
- run: python evaluate.py --baseline # ⭐ regression vs baseline
- run: python check_fairness.py # ⭐ fairness gate
- run: mlflow models build-docker # model + image
- run: kubectl apply -f canary.yaml # ⭐ canary, not full
- run: python shadow_compare.py # ⭐ shadow validation
ভাবনার প্রশ্ন
প্র ০১ একটি traditional DevOps team-কে MLOps-এ convert করতে হবে। কোন ৩টি concept তাদের সবচেয়ে আগে শেখাবেন? কেন?
DevOps engineer-রা already infrastructure ও automation expert। তাদের সবচেয়ে অপরিচিত areas-এ ফোকাস করতে হবে।
Concept ১ — Data versioning + reproducibility:
- DevOps-এ "input always same" — code-এর যা version, output সেটারই।
- ML-এ — same code, different data → different model। তাই data-ও versioned হতে হবে।
- Tool: DVC, Git LFS, lakeFS।
- Mental model: "model = function(code, data, seed, hardware)"।
- ৬ মাস পরে "এই model কেন এই prediction দিল?" — উত্তর তখনই সম্ভব যখন data version traceable।
Concept ২ — Drift (data + concept):
- DevOps-এ once deployed, code static। ML-এ model দিন দিন stale হয়।
- Latency, error rate ঠিক — কিন্তু accuracy কমছে — এই scenario DevOps mental model-এ নেই।
- PSI, KS test, alert rules — শেখাতে হবে।
- Practical first lesson: "এই model গত ৩ মাসে accuracy কত? জানা না — মানে drift detection নেই।"
Concept ৩ — Training-serving skew:
- DevOps-এ — single artifact production-এ যায়।
- ML-এ — training environment + serving environment, দু'টো ভিন্ন stack হতে পারে।
- Feature engineering যদি pandas (training) আর Java (serving)-এ ভিন্নভাবে — silent bug।
- Solution: Feature Store, single transformation pipeline।
কেন এই ৩টি priority:
- প্রতিটি — silent failure mode। DevOps engineer-এর instinct alert নয়, কারণ "system up ও latency ঠিক"।
- প্রতিটি data-axis-এ — DevOps-এর কম-পরিচিত territory।
- এগুলো বুঝলে — registry, MLflow, Feast — সব tool intuitive লাগবে।
Practical onboarding plan (৪ সপ্তাহ):
- সপ্তাহ ১: Pre-existing model হাতে দিন। Drift simulate করুন (input distribution বদলান)। দেখান latency সব ঠিক, কিন্তু prediction ভুল।
- সপ্তাহ ২: DVC + MLflow setup। Reproducibility hands-on।
- সপ্তাহ ৩: Feature Store concept; pandas/Spark-এ same transformation।
- সপ্তাহ ৪: PSI implementation + Grafana alert।
মূল উপলব্ধি: DevOps engineer-দের MLOps-এ আনার সবচেয়ে কার্যকর উপায় — হাতে-কলমে। Theory পড়ালে অনেকে "extra paperwork" ভাবে। একটি drift event live debug করালে — মানসিক switch ঘটে।
প্র ০২ "DevOps টি rich, mature; MLOps tooling এখনো immature" — এই statement-টি কতটা সত্য? উদাহরণসহ।
২০২২-এর আগে এই কথা সত্য ছিল। ২০২৫-এর পরে অনেকটাই ভুল — কিন্তু কিছু dimension-এ সত্য থেকে গেছে।
Mature MLOps tools (২০২৫):
- Experiment tracking: MLflow (২০১৮), W&B — production-grade, multi-tenant।
- Pipeline orchestration: Kubeflow, Airflow, Prefect — battle-tested।
- Model serving: Triton, BentoML, TorchServe — performance-optimized।
- Data versioning: DVC (২০১৭), lakeFS — কাজ করে।
- Drift detection: Evidently, NannyML, WhyLabs — useful।
Still-immature areas:
- End-to-end integration: tool-গুলো individually মজবুত — সব একসাথে কাজ করানো এখনো painful।
- Standards: DevOps-এ OCI image, OpenAPI — universal। MLOps-এ "model" format অনেক — ONNX, TF SavedModel, PyTorch state_dict, MLflow flavor। Interop limited।
- Bangla / multilingual NLP eval: tool-চাইল্ড অবস্থা।
- LLM observability: rapidly evolving (Langfuse, Helicone) কিন্তু conventions still settling।
- Cost attribution: "এই team কত GPU hour use করল" — এখনো manual reconciliation।
Best-of-breed vs platform debate:
- Best-of-breed: MLflow + DVC + Feast + Triton + Argo — flexible, কিন্তু integration tax।
- Platform: SageMaker, Vertex AI, Databricks — opinionated, faster start, but lock-in।
- Hybrid common: managed registry + self-hosted serving।
"Tool fragmentation" — DevOps history-র echo:
- ২০১২-এ DevOps-ও tool-fragmented ছিল — Puppet vs Chef vs Ansible vs Salt। ১০ বছরে কয়েকটাই survive।
- MLOps সেই phase-এ — consolidation আসছে। Kubeflow + MLflow + Feast — common stack হয়ে যাবে।
Practical implication for Bangladesh teams:
- Cutting-edge tool-এ go করার চেয়ে — ১-২ বছরের জন্য proven tool। MLflow + DVC + FastAPI + K8s — solid baseline।
- Documentation maturity check: GitHub stars, recent commits, Slack/Discord active।
মূল উপলব্ধি: MLOps tooling-এর landscape ২০২২-পরবর্তী time-এ rapidly mature হয়েছে। কিন্তু integration ও standards এখনো DevOps-এর মতো settled না। তাই "tool combination"-এর choice MLOps-এ DevOps-এর চেয়ে বেশি impactful।
প্র ০৩ "Reproducibility" — software-এ vs ML-এ — কেন ML-এ এটা এত কঠিন?
Reproducibility-র difference MLOps-এর সবচেয়ে subtle ও foundational topic-এর একটি।
Software reproducibility:
- Same source code + same compiler version + same config = same binary, same behavior।
- Docker image-এ কী আছে — sufficient।
- Edge case: floating-point order, but rare।
ML reproducibility — ৪টি extra axis:
- Data: same dataset version, same row order সাধারণত (sometimes shuffle seed needed)।
- Random seed: NumPy, PyTorch, CUDA — তিনটি আলাদা PRNG।
- Hardware: CPU vs GPU different rounding; এমনকি ভিন্ন GPU model ভিন্ন result।
- Library version: TensorFlow 2.10 vs 2.11 — একই code, ভিন্ন output edge case-এ।
Hardware non-determinism — সবচেয়ে কঠিন:
- cuDNN-এর কিছু op non-deterministic — performance reasons।
torch.backends.cudnn.deterministic = True— slower but reproducible।- Multi-GPU training — gradient aggregation order varies।
- Mixed precision training — accumulate order matters।
Reproducibility tax:
- Strict reproducibility-এ training ১০-২০% slow হতে পারে।
- "Bit-exact reproducibility" rarely needed — "statistically equivalent" সাধারণত যথেষ্ট।
- Compliance/audit context-এ strict reproducibility critical (e.g., banking)।
Levels of reproducibility:
- Level 1 — Reproducible model selection: "this hyperparam combo wins" — most teams need this।
- Level 2 — Reproducible model weights: bit-exact। Rare requirement।
- Level 3 — Reproducible inference: "this input → this output" — production guarantee, easier।
Practical recipe:
- Data version pin (DVC hash)।
- Code git commit pin।
- Docker image SHA pin।
- Random seed log।
- Hardware logged (GPU model, CUDA version)।
- If strict: cudnn deterministic, fixed thread order।
মূল উপলব্ধি: ML reproducibility software-এর extension না — qualitatively কঠিন। MLOps-এর প্রায় ২০% effort এই সমস্যার আশেপাশে। DevOps engineer-এর জন্য এটাই সবচেয়ে surprising দিক — "একই code-এ একই output আসছে না কেন?"। উত্তর: data, seed, hardware — তিনটিই তো বদলেছে।
প্র ০৪ "DevOps tools আমাদের আছে — MLOps tooling কেন আবার আনব?" — একজন CTO-কে concrete justification দিন।
এই argument অনেক জায়গায় বাজে — DevOps team-এর pride বা CFO-র cost concern থেকে। Concrete numbers ও pain points দরকার।
Argument structure — pain → cost → MLOps-specific tool:
Pain ১ — Untraceable model decisions:
- "আজ production model কোন code, কোন data, কোন hyperparam-এ trained?" — উত্তর জানা না।
- Cost: regulator audit-এ অপ্রস্তুত। Bangladesh Bank guideline ২০২৩-এ AI explainability mandate।
- MLOps tool: MLflow (৭ লাখ BDT/year hosted, ১ লাখ self-hosted) → full traceability।
Pain ২ — Slow experimentation:
- "নতুন feature add → train → compare result" loop ১ সপ্তাহ লাগে।
- Cost: ৬ engineer × ১ সপ্তাহ × ১২ iteration/year = ৭২ engineer-week wasted।
- MLOps tool: pipeline orchestrator + cached steps → cycle ১-২ দিনে।
Pain ৩ — Silent model degradation:
- Production model accuracy decay — কেউ track করে না।
- Real example (anonymous Bangladeshi e-commerce): recommendation CTR ৬% → ৩.৮% over ৪ months → ১২ লাখ/month revenue loss।
- MLOps tool: drift monitoring (Evidently free, NannyML free) + alert।
Pain ৪ — Training-serving skew bugs:
- Frequent silent prediction error — debug-এ ৮-১৫ ঘণ্টা গড়।
- Cost: ৩-৪ incident/year × ১২ ঘণ্টা × ১,৫০০ BDT/hour = ২ লাখ BDT।
- MLOps tool: Feature Store (Feast, ফ্রি) + schema validation।
Pain ৫ — No fast rollback:
- খারাপ model push হলো — পুরোনো version-এ ফিরতে ২-৩ ঘণ্টা manual।
- Cost: business critical service-এ কোটি টাকার impact।
- MLOps tool: Model Registry + canary + automated rollback (Argo Rollouts)।
Total justification (consolidated for ৬-engineer team):
- Annual cost of NOT having MLOps: ৩০-৫০ লাখ BDT (incidents + slow iteration + lost revenue)।
- Annual cost of MLOps stack (open-source, modest cloud): ৮-১৫ লাখ BDT।
- ROI: 2-3× within first year।
"Hybrid" pitch (CTO-friendly):
- "DevOps tools-গুলো reuse করি — Jenkins/GH Actions, Kubernetes, Prometheus। ML-specific add: MLflow + DVC + Evidently — ৩টি OSS tool।"
- Resistance কমানোর জন্য "extension" framing, "replacement" না।
মূল উপলব্ধি: CTO-কে convince করতে — emotional argument না, numbers। প্রতিটি pain point-এর actual cost calculate। প্রতিটি tool-এর actual cost compare। ROI চারটা case-এই 2× এর বেশি — তাই decision easy। কিন্তু কাজটা data দেখিয়ে করতে হবে।
অনুশীলন
-
চিন্তা করুন: আপনি একটি স্টার্টআপে join করেছেন যাদের solid DevOps আছে কিন্তু ML নেই। MLOps শুরু করতে আপনার ৩-মাসের roadmap লিখুন।
- মাস ১: Existing DevOps tooling audit। MLflow setup, DVC introduce। One model migrate।
- মাস ২: Pipeline orchestrator (Airflow), drift monitoring baseline। Team training।
- মাস ৩: Model registry adoption, CI integration। Feature Store evaluate (যদি multi-team)।
-
লিখুন: DevOps টিম meeting-এ ২ মিনিটের pitch — "MLOps আমাদের দরকার কেন।" Bullet points-এ।
- "আমরা software-এ uptime track করি — ML-এ accuracy track করি না।"
- "একটি model কোন data থেকে এসেছে — জানা যায় না।"
- "Drift হলে — alert নেই; revenue silently leak।"
- "DevOps stack বেশিরভাগ reuse — শুধু ৩টি ML-specific tool যোগ।"
- "ROI within first year — concrete pain × frequency × hourly cost।"
-
তুলনা: একটি web app deploy ও একটি ML model deploy — পার্থক্যের একটি ৫-row table তৈরি করুন।
- Artifact: container vs container + model file + metadata।
- Test: unit/E2E vs unit + data validation + perf regression।
- Rollout: canary on req/sec vs canary on req/sec + accuracy + drift।
- Rollback: old image vs old model + matching schema/data version।
- Monitor: latency/error vs latency/error + drift + accuracy।