CertSafari
    Databricks Certified Machine Learning Associate· Lessons

    Domain 4 · Lesson 43/48

    Batch, streaming and real-time model serving compared

    Identify the differences and advantages of model serving approaches: batch, realtime, and streaming

    17 min read
    2% of exam
    7 sources
    Published 22 Oct 2026
    Docs as of 17 Oct 2026

    What you will be able to do

    • Tell batch, streaming and real-time inference apart by what triggers scoring, what gets scored, and who waits for the result
    • Pick the serving approach that fits a scenario's latency, throughput and cost requirements, and explain why the other approaches fit worse
    • Recognise when precomputed batch predictions published to a key-value store can meet a low-latency requirement without a real-time endpoint

    Key concept

    Serving approach — How a trained model's predictions reach their consumer. Batch scores a whole table on a schedule, streaming scores only the new rows as they arrive, and real-time answers one request at a time behind a REST API. The approaches trade latency against cost and throughput.

    1.Three ways a model's predictions reach their consumer

    A registered model is only useful once its predictions reach something that acts on them. Databricks offers three ways to get them there, and the real difference between them is who is waiting for the answer. In batch inference, a scheduled job scores a whole table and writes the results, and nobody waits on any single row. In streaming inference, a pipeline that is always running (or triggered often) scores each new record as it lands and appends the result. In real-time inference, a caller such as a checkout service or web app sends one request and blocks until the model replies.

    The three are separate options on the platform, not one product tuned three ways. Databricks lists batch serving and low-latency online serving as distinct deployment options. Model Serving is the real-time option: each model you serve becomes a REST endpoint that an application calls directly. Batch and streaming jobs run as ordinary data pipelines. They load the registered model and write predictions to storage, and consumers read the predictions from there.

    Cost and latency move in opposite directions across the three. Batch and streaming score many rows per unit of compute, so they are cheap per prediction, but a prediction appears minutes or hours after its input. A real-time endpoint answers in milliseconds, but it has to be provisioned and kept ready for requests that might arrive at any moment. For any workload, the first question is how soon after the input each prediction must exist, and whether a person or system is blocked waiting for it.

    Checkpoint 1 of 8· Match them up

    Match each workload to the serving approach that fits it best

    Tap a term, then the definition that fits it.

    Sources123

    2.Batch inference: score the whole table on a schedule

    Batch inference reads every row currently in the source and scores all of them in one run. The engine does not track what it has already processed, so each run reprocesses the data and overwrites the previous results. That makes the logic simple and the output complete: every run reflects all the data available at that moment. Batch sources are usually partitioned, for example by day or region, so a run can be limited to a slice of the data instead of reprocessing everything.

    The cost of this simplicity is latency. Batch can meet requirements measured in hours or minutes, but not seconds or milliseconds. For many ML workloads that is fine. Take a churn model scored against the full customer table every night, with results read by a dashboard the next morning. No prediction is needed within seconds of a customer event, so a nightly job is the cheapest and simplest design that meets the requirement. A real-time endpoint for that workload would keep serving infrastructure running for a job whose consumer reads results once a day. A streaming pipeline would keep running to watch a source that does not change overnight.

    The batch job itself is ordinary Python or Spark code. It loads the registered model, often by its champion alias so that a newly promoted version is picked up on the next run, then scores the data and writes the predictions out. For Python models, mlflow.pyfunc.load_model() returns the model as a generic Python function with a predict method. The same model can also be exported as a Spark UDF so that scoring is spread across a cluster. Both techniques are covered in batch inference with pandas. Batch jobs usually write their predictions to tables in the production catalog, to flat files, or over a JDBC connection.

    Checkpoint 2 of 8· Check yourself

    A nightly batch job scores the full customer table with the champion churn model. Some of yesterday's customer records reach the source table only after last night's run has finished. What happens to those records on tonight's run?

    Checkpoint 3 of 8· Exam question

    A retail analytics team scores a churn model against the full customer table once every night and writes the predictions to a Delta table that a dashboard reads the next morning. No individual prediction needs to be available within seconds of a new customer event. Which serving approach best fits this workload, and why?

    Sources452

    3.Streaming inference: score only what is new, as it arrives

    Streaming inference keeps track of what it has already processed and scores only data that arrived since the last run. New results are appended to earlier ones instead of overwriting them. That makes streaming more efficient than batch, because no row is scored twice. It also makes streaming faster: it can meet latency requirements anywhere from hours down to seconds and milliseconds. On Databricks, Structured Streaming is the underlying engine. It treats cloud object storage and Delta tables as streaming sources, and Auto Loader picks up new files as they land in cloud storage.

    The efficiency costs accuracy. When late records arrive, a batch job processes them together with the rest of their hour and overwrites the old result, so the output comes out correct. A streaming job sees only the late rows. It must have kept the state of earlier calculations, such as running sums and counts, to correct the result. Stateful work like joins, aggregations and deduplication makes streaming logic complex, and its results cannot always be accurate when data arrives late or out of order. Simply scoring each new row with a model is stateless, which is why per-record inference is a good fit for streaming.

    In practice, streaming inference means the model becomes one step inside a pipeline. Consider IoT sensor readings ingested continuously through Auto Loader into Lakeflow Spark Declarative Pipelines (formerly Delta Live Tables). Each reading needs an anomaly score, but no person or downstream system is waiting on any single call. Applying the model as a transformation inside the pipeline scores each reading as it flows through, and no separate scheduled job is needed. A recurring batch job would fall behind the data between runs. Calling a REST endpoint for every row would make the pipeline block on network round-trips it has no need to wait for. Spark pandas UDFs scale both batch and streaming inference across a cluster. The mechanics of the pipeline are covered in streaming inference with declarative pipelines. Streaming jobs usually write predictions to Unity Catalog tables or to message queues such as Apache Kafka.

    Structured Streaming has two trigger types. Micro-batch mode, the default, processes new data in small batches and suits latencies measured in seconds or minutes. Real-time mode (RTM) processes records as they arrive and is aimed at sub-second operational work such as fraud detection, but it needs dedicated compute. Even in RTM, the output still goes to a sink, the destination a pipeline writes to, such as a table or a Kafka topic, so a caller would have to read its result from there afterwards. A streaming pipeline produces a stream of results, not a reply to a caller.

    Checkpoint 4 of 8· Check yourself

    Your team wants to retire the Model Serving endpoint that the checkout service calls for fraud scores. The checkout service holds the payment screen until it gets a score. The proposed replacement is a Structured Streaming pipeline in real-time mode (RTM). What should you recommend?

    Checkpoint 5 of 8· Exam question

    A sensor-monitoring pipeline built on Lakeflow Spark Declarative Pipelines ingests IoT readings continuously via Auto Loader and needs to attach an anomaly score to each reading as it flows through the pipeline, without a person or downstream system waiting on any single call. Which serving approach fits this scenario, and what makes it a better fit than the alternatives?

    Sources46327

    4.Real-time serving: answer each request behind a REST API

    Real-time inference is for a caller that sends one input and waits for one prediction. Model Serving exposes each served model as a REST API with high availability and low latency. It runs on serverless compute that automatically scales up or down as demand changes, so you save infrastructure cost when traffic drops and keep latency low when traffic spikes. Unlike batch or streaming, which can simply load the champion model inside a pipeline, a real-time use case needs dedicated infrastructure that deploys the model as a REST endpoint.

    A fraud model that must approve or decline a card swipe within 100 milliseconds, with request volume that rises and falls sharply over the day, is the standard example. The checkout service needs an answer about this particular transaction, so a nightly job that pre-scores yesterday's transactions cannot help: the swipe has not happened yet. A streaming table writes its score to a Delta table, and the checkout service would then have to find that row and read it back. A fixed-size cluster that is always on costs money at 3 a.m. and can still run out of capacity at noon. An autoscaling REST endpoint meets both the latency requirement and the varying load.

    Endpoints also handle feature lookup and model updates themselves. Feature tables are Unity Catalog tables that hold the input features a model is trained on, such as a customer's purchases over the last 30 days. If the served model version was trained on them, the model stores which features and functions it depends on, and Model Serving uses those stored dependencies to look the feature values up from online stores, which are low-latency stores meant for lookups at request time. When a new version replaces the old one, the existing configuration keeps serving requests until the new one is ready, so the update causes no downtime. Creating and querying an endpoint is covered in real-time deployment and querying, and splitting traffic between models on one endpoint is covered in splitting traffic between endpoints.

    Checkpoint 6 of 8· Check yourself

    Investigators at a card issuer want every transaction that arrives on a Kafka topic scored for fraud within a second. Flagged transactions should be written to a Delta table that they review. No checkout service or other caller waits for the score. Which design fits?

    Checkpoint 7 of 8· Exam question

    A fraud-detection model must return an approve/decline decision to a checkout service within 100 milliseconds of a card being swiped, and the volume of requests varies sharply between business hours and overnight. Which approach satisfies both the latency and the variable-load requirement?

    Sources127

    5.Choosing an approach, and when precomputed predictions are enough

    The three serving approaches compared on the dimensions that decide a scenario
    AspectBatchStreamingReal-time
    What triggers scoringA schedule; all rows in the source or partitionNew data arriving; only rows not yet processedAn individual request from a client
    Typical latencyHours to minutesMinutes down to seconds or millisecondsLow latency, the caller waits for the reply
    Cost profileMost cost-effective for high throughputCost-effective for high throughput; efficient because only new data is processedDedicated REST endpoint infrastructure, autoscaled with demand
    Where predictions goProduction catalog tables, flat files, JDBCUnity Catalog tables or message queues like Apache KafkaReturned in the REST API response

    Most scenarios can be decided with the table. The one that catches people out is a low-latency requirement for a prediction that does not depend on anything happening at request time.

    Needing a prediction with low latency is different from needing to compute it with low latency. If every input is known in advance, as with a score per customer, per product or per account, a batch job can compute all the predictions offline and publish them to an online key-value store such as DynamoDB or Cosmos DB. The application then looks up a stored value, which is fast, and you pay batch prices for the scoring. This only works if the prediction can be computed before the request arrives. A swipe at checkout, a search query typed a moment ago, or anything else that depends on data available only at request time still needs a real-time endpoint.

    Checkpoint 8 of 8· Check yourself

    Four product teams each need a prediction shown within milliseconds. Which of them still needs a real-time Model Serving endpoint, rather than a batch job that publishes to an online key-value store?

    Sources24

    Sources

    (7)

    Every claim above is drawn from one of these pages, quoted as it was written on the date shown.

    1. 1.
      “Each model you serve is available as a REST API that you can integrate into your web or client application.”
      ↩︎ Three ways a model's predictions reach their consumer
      “The service automatically scales up or down to meet demand changes, saving infrastructure costs while optimizing latency performance.”
      ↩︎ Real-time serving: answer each request behind a REST API
      “Model Serving provides a highly available and low-latency service for deploying models.”
      ↩︎ Real-time serving: answer each request behind a REST API
    2. 2.
      “Batch or streaming inference is generally the most cost-effective option for higher throughput, higher latency use cases.”
      ↩︎ Three ways a model's predictions reach their consumer
      “Batch jobs typically publish predictions to tables in the production catalog, to flat files, or over a JDBC connection.”
      ↩︎ Batch inference: score the whole table on a schedule
      “Streaming jobs typically publish predictions either to Unity Catalog tables or to message queues like Apache Kafka.”
      ↩︎ Streaming inference: score only what is new, as it arrives
      “Model Serving automatically uses this dependency graph to look up features from appropriate online stores at inference time.”
      ↩︎ Real-time serving: answer each request behind a REST API
      “the model stores the dependencies for the features and functions.”
      ↩︎ Real-time serving: answer each request behind a REST API
      “Model Serving executes a zero-downtime update by keeping the existing configuration running until the new one is ready.”
      ↩︎ Real-time serving: answer each request behind a REST API
      “these batch predictions can be published to an online key-value store such as DynamoDB or Cosmos DB”
      ↩︎ Choosing an approach, and when precomputed predictions are enough
      “Batch or streaming inference is generally the most cost-effective option for higher throughput, higher latency use cases.”
      ↩︎ Key concept
      “For real-time use cases, you must set up the infrastructure to deploy the model as a REST API endpoint.”
      ↩︎ Exam trap 2
      “these batch predictions can be published to an online key-value store such as DynamoDB or Cosmos DB”
      ↩︎ Exam trap 3
      “For real-time use cases, you must set up the infrastructure to deploy the model as a REST API endpoint.”
      ↩︎ Checkpoint
      “For real-time use cases, you must set up the infrastructure to deploy the model as a REST API endpoint.”
      ↩︎ Checkpoint
      “low-latency predictions are required, but predictions can be computed offline, these batch predictions can be published to an online key-value store”
      ↩︎ Checkpoint
    3. 3.
      “Batch and streaming scoring supports high-throughput, low-cost scoring at latencies as low as minutes.”
      ↩︎ Three ways a model's predictions reach their consumer
      “Use Spark Pandas UDFs to scale batch and streaming inference across a cluster.”
      ↩︎ Streaming inference: score only what is new, as it arrives
    4. 4.
      “With batch processing, the engine does not keep track of what data is already being processed in the source.”
      ↩︎ Batch inference: score the whole table on a schedule
      “Slower, could handle latency requirements from hours to minutes, but not seconds or milliseconds.”
      ↩︎ Batch inference: score the whole table on a schedule
      “With streaming processing, the engine keeps track of what data is being processed and only processes new data in subsequent runs.”
      ↩︎ Streaming inference: score only what is new, as it arrives
      “Processing logic could be complex, especially for stateful processing such as joins, aggregations, deduplications, etc.”
      ↩︎ Streaming inference: score only what is new, as it arrives
      “Faster, could handle latency requirements from hours to minutes, seconds, and milliseconds.”
      ↩︎ Choosing an approach, and when precomputed predictions are enough
      “Results cannot always be accurate, considering out-of-order and late-arrival data.”
      ↩︎ Exam trap 1
      “With batch, data from previous hours is reprocessed each hour, and the previously calculated results are overwritten to reflect the latest results.”
      ↩︎ Checkpoint
    5. 5.
      “For Python MLflow models, an additional option is to use mlflow.pyfunc.load_model() to load the model as a generic Python function.”
      ↩︎ Batch inference: score the whole table on a schedule
    6. 6.
      “Auto Loader Incrementally and efficiently process new data files as they arrive in cloud storage.”
      ↩︎ Streaming inference: score only what is new, as it arrives
    7. 7.
      “Real-time mode (RTM) is a trigger type for Structured Streaming that is up to 100x faster than micro-batch mode.”
      ↩︎ Streaming inference: score only what is new, as it arrives
      “Use RTM for operational workloads that require immediate response to streaming data, such as fraud detection and real-time personalization.”
      ↩︎ Real-time serving: answer each request behind a REST API

    Spotted a mistake, or was something unclear? Tell us.