From Notebook to Production: Building End-to-End AI Systems
Mariano Semelman
Lead Data Scientist and Machine Learning Engineer
A workflow for turning AI or ML notebooks into production systems with decisions, reusable code, evaluation, serving, and monitoring.
When you take an AI or ML notebook to production, don't start by copying cells into a service. Start with the decision the system supports. Then make the data path explicit and extract the code people need to reuse. Add evaluation gates, choose the serving path, and close the release with monitoring and feedback.
Use this sequence with Notebook to Production AI Systems, Production, Machine Learning System Design, and MLOps. For LLM and RAG systems, use the LLM and RAG Production Roadmap alongside this sequence.
Modern AI work still fits a CRISP-DM-style lifecycle. Teams first understand the business and data, then prepare data and model, then evaluate and deploy. They can use the notebook during exploration, but they shouldn't ship it as the product.[1]
Name the business decision before you name the model. A notebook can make a prediction look useful while the real workflow needs a rule or ranking. It may need a review queue, retrieval answer, or product action instead.
Business-to-ML translation draws that boundary. Teams sometimes need a decision or workflow rather than a model call.[1] Keep AI Engineering and Data Products close to the problem framing. Don't treat deployment as a packaging step.
Start the intake with the business case and KPIs, then check alternative solutions and problem specificity before modeling. Add stakeholder pairing, buy-in, and concern handling before the team commits to production work.[2] Use those conversations to define success and failure before any production code exists.
Start simple and fail fast when the team is still testing product value. Product feedback and fast learning should come before heavier model or platform complexity.[3][3] The first production version should be the smallest baseline that can touch the workflow. It should show whether users and KPIs move before the team adds complexity.
Teams can use AI-assisted prototypes in that early loop only when the generated code stays reviewable. Use AI coding tools for codebase-aware drafting and debugging. Then treat the result as a candidate implementation that still needs tests and ownership.[4]
For translator-led prototypes, the handoff is part of the workflow. A rough script, spreadsheet, or dashboard can validate demand. Treat it as proof of value rather than the production design. Once the use case is clear, name the owner who can rewrite and operate the useful part. That owner also explains and supports the system.[5]
That owner may keep some code, rebuild from scratch, or automate the manual version. Ownership should move from "the person who proved it" to the team that can maintain the system.
Write a one-page production brief before you extract code:
Keep that brief next to KPIs, Metrics, and Data Product Adoption while you scope the work.
Move the notebook into a project that another person can run without your memory. Keep the notebook if it helps exploration, but move reusable code into modules and tests. Add configuration plus scheduled or callable entry points.
Production readiness depends on maintainable, modular, testable code. It also requires stakeholder buy-in and restraint against overcomplicated solutions. Refactor notebook-shaped "walls of text" into smaller pieces that someone can test and change.[6]
Research work uses notebooks and experiment tooling to run benchmarks for hypothesis-driven work. Production ML engineering adds lifecycle ownership, engineering rigor, and reproducibility. It also requires PyTorch and Docker practice. Cloud infrastructure and web frameworks matter too.[7]
Metaflow is one workflow-tooling example for that handoff. It helps data scientists connect modeling code to cloud resources and scheduler infrastructure without turning notebooks into the production system.[8]
CJ Jenkins describes the career-transition version of the same gap. An academic researcher may understand statistics and modeling. They may still need Python and API practice before the work can become a production artifact.
Docker and deployment practice matter too. That matters when a notebook result has to become a service another team can run.[9]
For a role-change version of that handoff, the data scientist to machine learning engineer path narrows this workflow to packaging and serving. It also adds monitoring and runtime ownership.
The learner-to-practitioner version is practical. Learners move from exploratory analysis toward reusable code, project structure, and production habits.[10] In Daniel Egbo's account, that move included virtual environments and cloud computing as much as code refactoring. The production step also makes the run context explicit enough for another machine or teammate.
Use a small project structure before you add platform complexity:
project/ notebooks/ src/ tests/ configs/ pipelines/ app/ evals/ README.md
Put exploration in notebooks/ and reusable code in src/, then use src/ for transformations and feature builders. Add prompts, retrieval code, and model wrappers there too.
Put API or worker entry points in app/. Put training, batch scoring, index refreshes, or other repeatable jobs in pipelines/. Put evaluation cases and expected behavior in evals/.
This structure connects the notebook to Software Engineering, Testing, and Reproducibility. Rerun the system from known inputs and check the output, test result, or failure. For engineers bringing software habits into ML work, use ML for Software Engineers as the adjacent path for learning data, modeling, and production ownership.
Extract code in this order:
Maria Vechtomova describes the platform version of this handoff: a cookie-cutter repository can provide naming conventions, permissions, credentials, deployment wiring, and cost tags before a data scientist adds model logic. The template still expects the reusable logic to move into functions, classes, modules, and a package; CI/CD then handles the known packaging path. This standardizes the boundary without pretending that a notebook is production code.[11][11]
Production notebooks fail when the data path lives only in ad hoc cells. Build the path from ingestion to training, retrieval, batch scoring, or online inference as a pipeline people can look at.
The classic production ML path moves from notebooks into ingestion and buffers, then processing, storage, and Docker jobs. Cloud storage such as Parquet on S3 can sit on that path, along with SQL or dataframe transformations.[12]
Event ingestion with queues such as Kafka or Kinesis solves a different problem from batch processing.[12]
Use the simpler path until a harder requirement forces a more complex one:
For the broader pipeline sequence, use How to Build Data Pipelines and Data Pipelines. Use Batch vs Streaming when freshness changes the architecture. Use Apache Airflow only after your workflow needs scheduling, dependencies, retries, or backfills.
Compare Airflow with simpler schedulers, CloudWatch, and Lambda before adding a workflow orchestrator. Queues and Kubernetes may be useful later, but start simple and iterate when the workflow needs more control.[12]
Use this simple-first path when the product value and operating requirements are still uncertain:
The output of this escalation is a value note, a repeatable containerized job, an owned model artifact, and a written reason for every added component. If the proof cannot show user or business value, return to the production brief; if the runtime is hard to operate, reduce the stack before adding another tool.[12][12][12]
Treat evaluation as the bridge between notebook experiments and production changes. A metric in a notebook helps select a candidate. A production evaluation suite protects the system when someone changes a feature or prompt. It should also catch regressions from model, retrieval, serving-code, and data source changes.
Complex AI systems need gold-standard datasets and systematic evaluation. The OLX content-generation example combines prompt engineering with LLM-as-judge checks for factuality against the input listing.[1]
For classic ML, add testing alongside timeboxed bake-offs and cost-benefit tradeoffs. Start with simpler baselines and iterative MVPs, and use feature engineering plus tests before investing in harder-to-maintain approaches.[6]
Build evaluation gates before launch:
For LLM systems, pair this page with LLM Evaluation Workflows, LLM Production Patterns, and the LLM and RAG Production Roadmap. If the system uses retrieval, test retrieval quality separately from answer generation so failures don't hide behind one aggregate score.
Production AI readiness also depends on data trust, integration tests, prompt evaluation, and cost checks.[4] Use that episode when the notebook contains prompts, agents, or model calls that need tests beyond offline accuracy.
Choose serving after you know who needs the output and how quickly they need it. Some systems can precompute predictions or embeddings. Others need an API, worker, queue, or batch job. Some need a dashboard or human review interface.
Compare live API calls with precomputed predictions before choosing a serving path. Include Dockerized training, model storage, managed endpoints, and cost tradeoffs in that decision. Message queues can sequence jobs instead of turning everything into a single synchronous request.[12][12]
Modern AI systems often move away from notebooks toward services and observability tools. FastAPI, `uv`, and Arize are one example stack for that shift.[1]
High-stakes systems need a production surface that frontline users can work with as decision support. That surface includes UI, training, and trust-building. It also needs explicit operational limits, not only scoring code.[14][14]
The same domestic-risk case keeps the handoff end to end: evaluate metrics and bias before deployment, address privacy and legal constraints, train the people who use the tool, and monitor drift and alerts after launch. In a high-impact workflow, a notebook result is not production-ready until those human and operational boundaries are part of the release plan.[14][14][14][14]
Keep control boundaries explicit:
For LLM serving, compare fine-tuning and retrieval with hosted APIs and open-source models. Include latency, cost, and drift in that decision.[15] Use that framing when the notebook result can ship as retrieval, a prompt chain, a tuned model, or an external API call.
If structured code or a rule solves the problem, don't hide that logic inside a model call.[1] That advice is useful when you work with Agent Engineering, AI Agents, and LLM Production Patterns. Don't make them default answers to every product problem.
Launch only after someone owns service levels, monitoring, incident response, and feedback intake. A notebook ends when the analysis is convincing. A production system keeps changing after users see it.
Release work starts with service levels and impact assessment before incident response and postmortems. It can also include live test sets, small A/B tests, and root-cause debugging.[2]
User bug reports and postmortem action items turn production failures into backlog work. Track input distribution changes and feature drift. Add logging, feature stores, and reproducibility when the system needs them.[2]
AI products can collect explicit user feedback and behavioral feedback. Capture both when they're available.[1]
Monitor at four levels:
Tie those signals to Model Monitoring, Data Quality and Observability, A/B Testing, and Metrics. Use monitoring to decide when to rollback, retrain, or re-index. It should also tell the team when to change a prompt, update a rule, or ask for more labels.
Use this sequence when you turn a notebook into a system:
This sequence keeps the notebook useful without pretending it's the system. It connects the production work to decisions and reusable code. It also covers data paths, evaluation gates, serving boundaries, and monitoring.[7]
S24 · Episode 3
Mariano Semelman
Lead Data Scientist and Machine Learning Engineer
S21 · Episode 5
S20 · Episode 5
S18 · Episode 7
S15 · Episode 7
S15 · Episode 3
S14 · Episode 6
Hugo Bowne-Anderson
Head of Developer Relations at Outerbounds
S6 · Episode 9
Mariano Semelman
Lead Data Scientist and Machine Learning Engineer
S6 · Episode 6
S5 · Episode 5
Mihail Eric
Founder of Pametan Data Innovation
S4 · Episode 6
Lina Weichbrodt
Generalist machine learning developer at Deutsche Kreditbank
S4 · Episode 5
Ben Wilson
Practice Lead Resident Solutions Architect at Databricks
S4 · Episode 2
S3 · Episode 4
Lior Barak
Author of Data Is Like a Plate of Hummus
S1 · Episode 2
How it started, who's here, and everything that goes on here: courses, events, Slack, and more.