Kokil Thapa - Professional Web Developer in Nepal
Freelancer Web Developer in Nepal with 15+ Years of Experience

Kokil Thapa is an experienced full-stack web developer focused on building fast, secure, and scalable web applications. He helps businesses and individuals create SEO-friendly, user-focused digital platforms designed for long-term growth.

MLOps: From Notebook to Production

By Kokil Thapa | Last reviewed: August 2026

Moving a machine learning model from an experimental Jupyter notebook to a reliable production service is fundamentally a software engineering challenge, not just a data science one. MLOps: From Notebook to Production demands the same discipline you apply to web applications: version control, automated testing, reproducible environments, and observable deployments. While my daily work centers on Laravel, Symfony, and eCommerce systems, the integration points between modern web platforms and ML services are increasingly common, whether for recommendation engines, fraud detection, or legal document classification in Nepal’s growing legal-tech sector. This guide translates core DevOps principles I use for CI/CD pipeline setups into actionable patterns for shipping stable ML systems.

How do you transition MLOps from notebook to production reliably?

The most common failure mode in ML projects isn’t bad algorithms; it’s unmanaged handoffs. A notebook is an interactive scratchpad where state lives in memory, dependencies are implicit, and execution order is non-linear. Production requires deterministic, repeatable, and auditable workflows. The transition succeeds only when you refactor exploratory code into modular, tested components managed by standard software tooling.

ExperimentJupyter NotebooksAd-hoc Data LoadsManual ValidationImplicit StatePipelineModular Python PkgsGit Version ControlAutomated TestingContainer BuildsServingREST/gRPC APIModel RegistryMonitoring & AlertsAuto-scaling
The three-stage MLOps: From Notebook to Production workflow separates experimentation from automated pipelines and live serving

Start by extracting reusable logic from notebooks into proper Python packages. Functions should accept explicit inputs and return outputs without side effects. Use type hints and docstrings. Store this code in Git, not in cloud storage or local folders. Define dependencies explicitly via pyproject.toml or requirements.txt pinned to exact versions. On real client projects integrating ML with Laravel backends, I’ve found that treating the ML component like any other microservice—subject to the same linting, testing, and review standards—prevents integration debt from accumulating silently.

Establishing a baseline workflow

  1. Extract: Move feature engineering, preprocessing, and inference logic into importable modules.
  2. Parameterize: Replace hardcoded paths and hyperparameters with configuration files (YAML/TOML).
  3. Test: Write unit tests for data transformations and integration tests for end-to-end prediction flows.
  4. Containerize: Create a Dockerfile that installs dependencies and runs your inference service deterministically.
  5. Orchestrate: Use tools like Prefect, Dagster, or Airflow to schedule retraining and validation jobs.

This structure mirrors how we handle complex backend services in modern Laravel architecture: separation of concerns, configuration over hardcoding, and automated verification before deployment. The difference is that ML adds data and model artifacts as first-class citizens alongside code.

What infrastructure supports MLOps from notebook to production in 2026?

Production ML infrastructure must solve three problems: reproducibility, scalability, and observability. In 2026, the stack has matured beyond bespoke Kubernetes manifests toward integrated platforms that reduce operational overhead while maintaining flexibility. Your choices depend heavily on team size, regulatory constraints, and existing cloud commitments.

ComponentOpen Source / Self-HostedManaged Cloud (AWS/GCP/Azure)Key Trade-off
Model RegistryMLflow, BentoMLSageMaker Model Registry, Vertex AIControl vs. maintenance burden
Feature StoreFeast, Tecton (OSS core)SageMaker Feature Store, Vertex FSLatency requirements vs. cost
OrchestrationPrefect, Dagster, AirflowMWAA, Cloud Composer, Azure Data FactoryFlexibility vs. ops overhead
ServingTriton, Seldon Core, FastAPISageMaker Endpoints, Vertex AI PredictionCustomization vs. auto-scaling ease
MonitoringPrometheus + Grafana, EvidentlyCloudWatch, Vertex AI MonitoringIntegration depth vs. vendor lock-in

For teams in Nepal or regions with budget sensitivity, self-hosted open-source stacks on modest VPS instances can be viable for low-traffic internal tools. However, for client-facing systems requiring high availability, managed services often justify their cost through reduced incident response time. When building legal-tech portals like those for court marriage or notary services, predictability matters more than cutting-edge optimization; I typically recommend managed inference endpoints unless data sovereignty laws mandate local hosting.

Data LayerRaw StorageFeature StoreValidation DBLabel StoreTrainingGPU ClusterExperiment TrackerHyperparam TunerEval HarnessRegistryModel ArtifactsMetadata & LineageApproval GatesVersion TagsServeInference APIBatch JobsCanary DeployTelemetry
Four-layer infrastructure topology enabling MLOps: From Notebook to Production with clear data flow boundaries

Critical infrastructure decisions include choosing between batch and real-time inference early. Batch processing suits nightly report generation or document analysis workflows common in legal-tech. Real-time serving demands lower latency SLAs and autoscaling policies. Both require artifact versioning; never overwrite a model file in place. Use semantic versioning tied to Git commits and dataset hashes. This traceability is non-negotiable for debugging regressions or meeting compliance audits.

How do you implement CI/CD for MLOps from notebook to production?

Continuous integration for ML extends traditional software CI to validate data quality, model performance, and infrastructure compatibility. A pipeline that only checks syntax will ship broken predictions. You need gates that catch distribution shifts, metric regressions, and dependency conflicts before they reach users.

# Example GitHub Actions workflow snippet for ML CI
name: ML Pipeline Validation
on: [push]
jobs:
  validate:
    runs-on: ubuntu-24.04
    steps:
      - uses: actions/checkout@v4
      - name: Set up Python 3.12
        uses: actions/setup-python@v5
        with:
          python-version: '3.12'
      - name: Install dependencies
        run: pip install -r requirements.lock
      - name: Run data schema tests
        run: pytest tests/test_data_contract.py
      - name: Train & evaluate shadow model
        run: python train.py --config configs/prod.yaml --output-dir ./artifacts
      - name: Check metric thresholds
        run: |
          ACCURACY=$(jq '.accuracy' ./artifacts/metrics.json)
          if (( $(echo "$ACCURACY < 0.85" | bc -l) )); then
            echo "Accuracy below threshold: $ACCURACY"
            exit 1
          fi
      - name: Build inference container
        run: docker build -t ml-service:${{ github.sha }} .

This workflow enforces three critical checks absent in notebook workflows: data contract validation, performance regression testing, and container build verification. Data contracts ensure upstream changes don’t silently break feature pipelines. Metric thresholds prevent degraded models from being promoted. Container builds guarantee the artifact tested matches what deploys. For teams already using GitLab CI for web apps—as I do for multiple sister sites sharing a DevOps automation pipeline—extending existing runners to handle ML jobs reduces context switching and leverages institutional knowledge.

Deployment strategies that reduce risk

  • Shadow Mode: Deploy new models alongside production without routing user traffic. Compare predictions offline for days before promotion.
  • Canary Releases: Route 5% of traffic to the new model. Monitor error rates and business metrics for anomalies before full rollout.
  • Blue-Green: Maintain two identical environments. Switch traffic atomically after validation. Enables instant rollback.
  • A/B Testing: Route traffic based on experiment design. Measure causal impact on KPIs, not just technical metrics.

Choose based on blast radius tolerance. Legal document classifiers may tolerate shadow mode for weeks. Fraud detection systems might need blue-green for rapid rollback capability. Always automate the promotion decision where possible; manual approvals introduce delay and inconsistency.

What monitoring completes MLOps from notebook to production?

Traditional application monitoring (latency, errors, throughput) is necessary but insufficient for ML systems. Models fail silently: they return valid HTTP 200 responses with increasingly wrong predictions. Effective MLOps monitoring tracks three dimensions: system health, data drift, and model decay.

Live SystemInference RequestsInput Features LogPrediction OutputsAnalysisDrift DetectionPerformance MetricsAnomaly ScoringActionAlert EngineersTrigger RetrainingRollback ModelFeedback Loop
Closed-loop monitoring system completing MLOps: From Notebook to Production with automated feedback triggers

Implement ground truth collection wherever possible. For a legal document classifier, this means logging which documents humans later correct or approve. For recommendation systems, track click-through and conversion rates per model version. Without delayed labels, you’re flying blind. Set alerts on statistical process control charts rather than fixed thresholds; natural variation shouldn’t trigger pages at 3 AM. Tools like Evidently AI or WhyLabs integrate with Prometheus/Grafana stacks familiar to web developers, reducing the learning curve.

Data drift detection deserves special attention. Feature distributions shift seasonally, after upstream schema changes, or due to external events. In Nepal’s legal-tech context, new legislation or procedural changes can abruptly alter document structures. Monitor input feature statistics continuously. Configure alerts when PSI (Population Stability Index) exceeds 0.2 or KS-test p-values drop below significance levels. These signals often precede performance degradation by days or weeks, giving you proactive remediation windows.

Practical next steps for MLOps from notebook to production

Shipping reliable ML systems requires respecting software engineering fundamentals that web developers have practiced for decades. Start small: pick one existing notebook-based workflow and migrate it to a versioned, tested, containerized service. Instrument it with basic logging and metric tracking before adding advanced drift detection. Treat MLOps: From Notebook to Production as an incremental journey, not a big-bang transformation. The goal isn’t perfect infrastructure; it’s reducing the mean time to recovery when models inevitably misbehave. If your team needs help architecting the integration layer between ML services and your existing web platform, or establishing CI/CD pipelines that span both domains, reach out to discuss your specific constraints. Reliable systems are built one disciplined step at a time.

Frequently Asked Questions

MLOps applies DevOps principles to machine learning, automating model training, testing, deployment, and monitoring to ensure reliable production performance.

Basic open-source MLOps on existing infrastructure costs Rs 50,000–150,000 (USD 375–1,125) for initial setup; cloud-managed services start around USD 200/month plus compute.

Adopt MLOps when models impact revenue, require frequent retraining, serve multiple environments, or need audit trails beyond ad-hoc notebook deployments.

A functional pipeline requires versioned data and code repositories, automated CI/CD for training and validation, containerized serving infrastructure, and continuous monitoring for drift. In my experience integrating AI APIs into Laravel applications, skipping any of these four pillars leads to silent failures where the model degrades without alerting stakeholders. For Nepal-based teams with limited DevOps resources, I recommend starting with GitHub Actions and Docker before investing in complex orchestration platforms like Kubeflow that demand dedicated maintenance overhead.

Treat models as artifacts linked to specific code commits, dataset versions, and hyperparameter configurations using tools like MLflow or DVC. Never overwrite production model files manually. On projects where I have integrated LLM APIs for legal-tech portals, we tag every API configuration change and prompt template version in Git alongside application code. This ensures that if output quality drops after an update, we can instantly trace whether the regression came from the model provider, our prompting logic, or underlying data changes rather than guessing blindly.

Traditional DevOps manages deterministic code where identical inputs produce identical outputs, while MLOps handles probabilistic systems dependent on data quality and statistical distributions. Model performance decays over time as real-world data shifts, requiring continuous validation pipelines absent in standard software deployment. When building AI-integrated web systems, I must account for non-deterministic responses that pass unit tests but fail business logic checks. This necessitates evaluation datasets and behavioral assertions alongside standard integration tests, adding complexity that pure software engineers often underestimate during initial architecture planning.

Implement statistical monitoring comparing live inference data against baseline training distributions using PSI or KL divergence metrics. Set alerts when drift exceeds thresholds before accuracy degrades noticeably. For client projects processing Nepali text or local transaction patterns, seasonal variations during Dashain or fiscal year-end often trigger false drift alerts if baselines are not calendar-aware. I configure monitoring windows aligned with business cycles rather than arbitrary rolling averages. Automated retraining triggers should require human approval initially until the team trusts the drift detection logic enough to enable full automation safely.

MLflow for experiment tracking, DVC for data versioning, and BentoML for serving provide a lightweight stack without Kubernetes complexity. These integrate with existing Git workflows familiar to PHP and Python developers. For agencies or startups in Kathmandu operating on constrained budgets, this combination avoids vendor lock-in and expensive cloud bills while maintaining professional standards. I have found that teams transitioning from notebook-based development adapt faster to this modular approach than monolithic platforms requiring dedicated platform engineering staff. Start simple and add orchestration only when manual coordination becomes the actual bottleneck.

Encrypt data at rest and in transit, enforce RBAC on model registries, audit all access logs, and never store credentials in notebooks or code repositories. Use secret managers like HashiCorp Vault or AWS Secrets Manager. For legal-tech platforms handling client documents or personal identifiers, I isolate PII processing into separate containers with restricted network policies. Model artifacts themselves may memorize sensitive training data, so implement differential privacy or synthetic data generation where compliance demands it. Regular penetration testing should specifically target inference endpoints, as attackers increasingly probe ML APIs for data leakage through model inversion attacks.

Hardcoded paths, missing dependency specifications, unvalidated input schemas, and ignored error handling cause most failures. Notebooks encourage sequential exploration, not reproducible engineering. Refactor into modular functions with explicit type hints and comprehensive test coverage before containerization. On early AI integration projects, I learned that notebook environments mask version conflicts that crash production servers. Always define dependencies in requirements.txt or pyproject.toml and validate against clean virtual environments. Document assumptions about data shape and range explicitly rather than relying on implicit memory of what worked during experimentation six months prior.

Combine unit tests for preprocessing logic, integration tests for end-to-end inference, and behavioral evaluations against golden datasets representing edge cases. Accuracy metrics alone miss regressions in specific user segments or critical business scenarios. For eCommerce recommendation integrations, I maintain evaluation sets covering new products, low-inventory items, and cross-category purchases that generic benchmarks overlook. Automate these evaluations in CI pipelines blocking merges when performance drops below agreed thresholds. Human review remains essential for subjective outputs like generated legal summaries where automated metrics correlate poorly with actual usefulness or compliance requirements.

Yes, via REST APIs or message queues connecting Laravel applications to Python-based ML services. The web application handles business logic and user interaction while delegating inference to dedicated microservices. On projects like Nepal Gift Card and legal portals, I deploy FastAPI or Flask services behind Nginx reverse proxies, communicating through authenticated HTTP endpoints or Redis queues for async processing. This separation allows independent scaling and technology choices. Avoid embedding Python directly in PHP processes; the operational complexity and debugging difficulty outweigh perceived simplicity. Treat the ML service as an external dependency with defined SLAs and circuit breakers.

Track business KPIs alongside technical metrics like latency, error rates, and prediction distribution stability. Log inputs and outputs for offline analysis while respecting privacy constraints. Set up dashboards visible to both engineers and business stakeholders. Technical accuracy means nothing if conversion rates drop or support tickets increase. For booking systems I have built, we correlate recommendation confidence scores with actual completion rates weekly. Anomalies trigger investigations before users complain. Monitoring must include upstream data quality checks since garbage inputs produce plausible-looking but wrong outputs that pass model-level validation while silently damaging business outcomes.

Cloud GPU instances (AWS p4d, GCP a2) or on-premise NVIDIA A100/H100 servers with CUDA drivers, container runtimes supporting GPU passthrough, and shared storage for large datasets. For Nepal-based teams, cloud GPUs billed hourly avoid capital expenditure risks. Reserve spot instances for training and dedicated instances for serving to balance cost and reliability. Ensure your CI runners have CPU-only fallbacks for linting and lightweight tests to avoid wasting expensive GPU hours on trivial validations. Container images must pin exact CUDA and cuDNN versions matching host drivers precisely, as mismatches cause cryptic runtime failures consuming hours of debugging time.

Right-size compute by profiling actual resource usage, use spot instances for batch training, cache intermediate artifacts to avoid redundant computation, and set hard spending alerts. For Nepali clients, I often recommend starting with CPU-only inference optimized via ONNX Runtime before justifying GPU expenses. Many NLP and tabular models perform adequately on modern CPUs with proper quantization. Negotiate reserved capacity discounts once usage stabilizes rather than committing upfront. Track cost per prediction as a first-class metric alongside accuracy; a marginally better model costing ten times more to serve rarely delivers proportional business value for SMBs operating on thin margins.

Share this article

Quick Contact Options
Choose how you want to connect me: