In this article
  1. Pipeline concepts to explain
  2. Pipeline code
  3. Metrics, drift and leakage
  4. Follow-up questions
  5. Sources

Pipeline concepts to explain

No vendor documents a standard "MLOps coding round", and companies differ widely in what they ask. Treat this page as a practice list, not a report of what any company asks. The concept answers below cite Google Cloud documentation; the code answers are general engineering, checked by running a short script.1 For the general coding routine, start from the coding interview guide.

What is MLOps, and how is it different from DevOps?

MLOps extends DevOps practice to ML systems. In Google Cloud's description, continuous integration (CI) is no longer only about testing code and components, but also about testing and validating data, data schemas and models (Google Cloud, MLOps pipelines, August 2024). So "MLOps is just DevOps for models" is incomplete: the data and the model are tested and versioned, not only the code.

Why it is asked: it checks whether you know what is new beyond ordinary software delivery. Read the full explanation: Google Cloud, MLOps pipelines.

What do CI, CD and CT mean in an ML system?

Continuous integration (CI) tests and validates code, data, schemas and models. Continuous delivery (CD) deploys a system: an ML training pipeline that automatically deploys another service, the model prediction service. Continuous training (CT) is concerned with automatically retraining and serving the models, and the Google Cloud page calls it a property unique to ML systems (Google Cloud, August 2024).

Why it is asked: the three terms are the shared vocabulary of the field. Read the full explanation: Google Cloud, MLOps pipelines.

What are the MLOps maturity levels?

Google Cloud describes three levels. Level 0 is a manual process, where data scientists build models but deployment is entirely manual. Level 1 is ML pipeline automation, whose goal is continuous training by automating the pipeline, which also gives continuous delivery of the prediction service. Level 2 is CI/CD pipeline automation (Google Cloud, August 2024). The page does not say every team needs level 2, so do not claim it.

Why it is asked: it tests whether you can place a team's current process and name the next step. Read the full explanation: Google Cloud, MLOps pipelines.

What triggers a retraining pipeline?

A retraining pipeline can be triggered by a schedule, new data, performance degradation or a data-distribution change; it can also run on demand. In the TensorFlow Extended (TFX) architecture from Google Cloud, this covers significant changes in the statistical properties of the data (Google Cloud, MLOps architecture with TFX). A good answer adds the trade-off: a schedule is simple but may retrain needlessly, while a drift or performance trigger needs monitoring code that you must write and test.

Why it is asked: it links monitoring code to the retraining decision. Read the full explanation: Google Cloud, MLOps architecture with TFX.

Does deployment mean shipping a model file?

Not at level 1 and above. There, the thing delivered is the training pipeline, which in turn produces and deploys the prediction service (Google Cloud, August 2024). Shipping a file is the level 0 habit. Ask what is versioned, what runs the pipeline, and how a bad model is rolled back, because code reviewed in a pipeline is code you can rerun.

Why it is asked: it separates a one-off notebook handover from a repeatable process. Read the full explanation: Google Cloud, MLOps pipelines.

A trigger starts an ordered pipeline that ends in deploymentFlow of four ordered pipeline steps: validate data, train, evaluate and deploy the prediction service, started by a trigger such as new data or a schedule.Triggerschedule ornew dataValidate dataschema checksTrainEvaluatemetricsDeploypredictionserviceDiagram: Interview Clozo, CC BY 4.0 ·interview.clozo.ai/blog/mlops-coding-interview-questions.html
A pipeline is an ordered set of steps that a trigger such as new data starts.CC BY 4.0 — source: MLOps coding interview questions on CI, CD and CT, schema checks and drift
Text description of the diagram
  • A retraining pipeline can be triggered by a schedule, new data, performance degradation or a data-distribution change.
  • Continuous training is concerned with automatically retraining and serving the models.

Pipeline code

How do you validate incoming rows against a schema?

Write a function that returns a list of errors per row: one error for each missing field and one for each wrong type. Keep it pure, so it is easy to test, and count bad rows rather than stopping at the first. On three illustrative rows, two fail a schema of an integer age and a string country.1 Data and schema checks are part of CI for ML systems. One edge case: isinstance(True, int) is true in Python, so a boolean passes an integer check unless you test for it explicitly.

def validate(row, schema):
    errors = []
    for field, kind in schema.items():
        if field not in row:
            errors.append(f"{field}: missing")
        elif not isinstance(row[field], kind):
            errors.append(f"{field}: wrong type")
    return errors

Why it is asked: it tests defensive code at the front of a pipeline. Related practice: Python interview questions.

How do you run pipeline steps in the right order?

Model the steps as a directed acyclic graph (DAG): each step is a node and each dependency an edge. A topological sort then returns an order where every step comes after its dependencies; Kahn's algorithm repeatedly takes steps with no unmet dependency. A step such as training cannot run before data validation and feature building have finished, and the sort enforces it.

Why it is asked: pipeline orchestration is dependency ordering. Read the full explanation: topological sort.

How do you detect a circular dependency in a pipeline definition?

If step A needs B and B needs A, no valid order exists. Run a depth-first search that tracks the nodes on the current path; reaching a node already on the path means a cycle. Alternatively, Kahn's algorithm finds a cycle when some steps never reach zero unmet dependencies. Report the cycle's steps so the author can fix the definition.

Why it is asked: it checks that you reject invalid configuration early. Read the full explanation: detecting a cycle in a directed graph.

How do you count events per key in a stream of logs?

Use a dictionary of counts. With collections.defaultdict(int) a new key starts at zero, so counts[key] += 1 needs no existence check. For a stream, read one record at a time (a generator) so memory depends on the number of distinct keys, not the number of records. State the trade-off: a very large key space needs a store outside memory.

Why it is asked: aggregation over logs is routine feature work. Read the full explanation: defaultdict in Python.

How do you compute a rolling-window metric?

Keep the current window's sum and update it as the window moves: add the new value and subtract the one that leaves. That costs constant time per step instead of re-summing the window. With illustrative values 3, 5, 4, 8 and 6 and a window of three, the means are 4.0, 5.6667 and 6.0.1 The same sliding-window idea appears in string problems.

Why it is asked: it tests whether you avoid recomputing work. Read the full explanation: the sliding window solution.

How do you add retries and caching around a feature call?

For retries, loop a limited number of times, catch only errors that are worth retrying, and wait longer between attempts (backoff), then re-raise at the end so failures stay visible. For caching a pure function, functools.lru_cache keeps recent results, but only inputs that can be hashed work. Never cache a function whose answer changes with time without an expiry.

Why it is asked: it probes reliability instincts, not only syntax. Related practice: Python interview questions.

How do you compute features for many items in parallel?

Split the items into independent chunks and run them in a pool. Threads suit work that waits on input or output, such as network calls; separate processes suit processor-bound (central processing unit (CPU)-bound) work in Python. Keep each chunk free of shared mutable state, collect results in the original order, and handle a failed chunk without losing the rest. State the cost: starting workers and moving data are not free.

Why it is asked: batch feature jobs often need to scale beyond one loop. Read the full explanation: parallel processing.

How do you merge overlapping time windows of training data?

Sort the windows by start time, then sweep: if the next window starts before the current one ends, extend the current end; otherwise begin a new window. Sorting dominates, so the cost grows as n log n for n windows. This is useful for combining overlapping data-extraction ranges into one, for example when late-arriving data re-extracts a period. State how touching windows are handled: if one starts exactly when the other ends, a start less than or equal to the current end merges them, while a strict comparison keeps them apart.

Why it is asked: interval merging is a standard pattern with real pipeline uses. Read the full explanation: merge intervals.

How do you find the k worst predictions?

Compute each example's error and keep the k largest. A min-heap of size k does it in n log k time and k memory: push each error and pop the smallest once the heap exceeds k. Sorting everything works too but costs more; a quickselect finds the k-th value without a full sort. Name the choice and its cost.

Why it is asked: error analysis needs top-k selection over big data. Read the full explanation: k closest points to origin.

Knowing it is half the job. Saying it is the other half.

Interview Clozo is an AI interview copilot for real interview rounds: it hears the question and puts a strong answer on your screen, and you say it in your own words. See the features or how it works.

Start Free Trial →

Metrics, drift and leakage

How do you compute precision, recall and F1 from counts?

Precision is true positives divided by true positives plus false positives; recall is true positives divided by true positives plus false negatives; F1 is their harmonic mean, which equals two times true positives over two times true positives plus false positives plus false negatives. With eight true positives, two false positives and four false negatives (illustrative), precision is 0.8, recall 0.6667 and F1 0.7273.1 Guard against division by zero.

Why it is asked: it tests exact metric definitions and edge cases. Related practice: Python interview questions.

How do you check a feature for drift with the Population Stability Index?

The Population Stability Index (PSI) is a score that compares the share of values in each bin between a reference sample and a new sample: the sum of (actual share minus expected share) times the natural log of their ratio. With illustrative bin shares 0.5, 0.3, 0.2 in training and 0.4, 0.3, 0.3 in production, PSI is 0.0629.1 Fixed bin edges and a small floor on empty bins are needed.

Why it is asked: it tests whether you can turn a monitoring idea into code. Related reading: Google Cloud on retraining triggers from data-distribution change.

How do you prevent data leakage in preprocessing?

Leakage happens when information from the test data influences training. A common cause is fitting a scaler or encoder on the full dataset before splitting. Split first, fit preprocessing on the training part only, and apply the fitted object to validation and test data. Putting preprocessing and model in one pipeline object makes the correct order hard to break.

Why it is asked: it separates a model that scores well from one that works. Related practice: coding interview guide.

How do you avoid training-serving skew?

Training-serving skew is a difference between how features are computed in training and in serving, so the model sees different inputs in production. Reduce it by sharing one feature-computation function between both paths, testing it on the same sample rows, and logging served features so they can be compared with training data. Mismatched code paths are a common cause.

Why it is asked: it is a classic production failure that code review can prevent. Related practice: Python interview questions.

How do you count subarrays or windows that hit a target in a metric stream?

Use prefix sums and a hash map. Keep a running total and a count of how often each earlier total appeared; at each element, the number of windows ending there with the target sum equals the count for total minus target. Start the map with a total of 0 seen once, so windows that begin at index 0 are counted. It runs in linear time and one pass, which fits streaming checks such as "how many windows summed to exactly a budget". Counting windows that exceeded a budget needs a different method, such as two pointers for non-negative values.

Why it is asked: it tests a pattern that avoids a nested loop. Read the full explanation: subarray sum equals k.

How do you log and compare experiment runs in code?

Write each run's parameters, data version, code version and metrics to one record with a unique id, so any result can be reproduced and compared. Keep records append-only. In an interview, a small dictionary-based tracker is enough; name the missing pieces, such as storage, artifacts and a registry, instead of pretending to build them all.

Why it is asked: reproducibility is a core MLOps concern. Related practice: coding interview guide.

Follow-up questions

What are MLOps coding interview questions?

They are coding tasks around ML pipelines: validating data, ordering steps, computing metrics or drift scores, and wrapping calls with retries or caches. The twenty above are a practice set. Which ones a company asks varies, and this page does not report any company's questions.

What does an MLOps coding round contain?

No source documents a standard round, so expect variation by company. Preparing the ordinary coding patterns, then the pipeline ideas above, covers the likely ground; the coding interview guide sets out the method and the Python questions cover the language side.

How should you practise for an MLOps coding interview?

Write each code answer yourself, run it on a small input, and say its cost aloud. Then explain the pipeline idea behind it: which step the code belongs to and what breaks if it fails. Pair this with graph and interval practice such as topological sort.

Is there a standard MLOps coding round?

Not on any evidence read for this page. Google Cloud documents the practice of MLOps, not an interview format, so treat claims about a fixed round as unsourced.

Key takeaways
  • MLOps adds data, schema and model testing to CI, and continuous training is new to ML systems.
  • At level 1 and above, the delivered thing is the training pipeline, not a model file.
  • Pipeline code questions are mostly ordinary patterns: ordering, counting, windows, intervals and top-k.
  • Know metric and drift formulas well enough to write them with edge cases handled.
  • Say which pipeline step each task belongs to, and what breaks if it fails.

Sources

  1. MLOps: Continuous delivery and automation pipelines in machine learning (Google Cloud Architecture Center) — Google Cloud, 28 Aug 2024
  2. Architecture for MLOps using TensorFlow Extended, Agent Platform Pipelines, and Cloud Build (Google Cloud Architecture Center) — Google Cloud, 26 Oct 2026
  3. Python documentation: collections.defaultdict and functools.lru_cache — Python Software Foundation, 26 Oct 2026