Key takeaway
- Real-time machine learning for enterprise leaders: online prediction, feature stores, continual learning, evaluation, trade-offs and an adoption path.
Real-time machine learning means a model serves predictions from fresh data at the moment of the request and, in its strictest form, also updates itself as new data arrives. Most enterprise systems need only the first part: online prediction with features kept fresh by a streaming pipeline. Continual learning is the harder, rarer step, and it should be earned by evidence, not assumed.
This guide is for CTOs, architects and platform leads who must decide where real-time machine learning pays off and what it demands from the data platform. It covers the machine learning layer. For the Spark and Kafka pipeline underneath it, see our guide to real-time streaming with Apache Spark and Kafka.
What is real-time machine learning?
Chip Huyen, in her widely cited article on the subject, separates two things. Batch prediction precomputes results at fixed intervals, such as every few hours or daily. Online prediction generates results when the request arrives. She argues that batch prediction is not a prerequisite for online prediction. The article also describes stages of maturity, summarised below.
| Level | What happens | What you need | When it fits |
|---|---|---|---|
| Batch prediction | Predictions are precomputed on a schedule | Scheduled jobs and a store for results | Results can be stale for hours; users with history |
| Online prediction with batch features | Session activity looks up precomputed embeddings or features at request time | Streaming infrastructure; candidate generation before ranking | Session-based recommendations, new or logged-out visitors |
| Online prediction with online features | Features are computed at request time or by a stream engine seconds before | Stream processing engine, feature store, model store, better development environments | Fraud detection, pricing, estimates that depend on the last few minutes |
| Continual learning | The model updates on a trigger: time, performance drop or drift | Triggers, continual evaluation, an orchestrator | Only where data shifts fast and the update cost is justified |
Source: Chip Huyen, Real-time machine learning: challenges and solutions (January 2022, updated January 2023).
When does a business need it, and when does it not?
The test is whether a decision loses value while it waits for the next batch run. Fraud screening, recommendations for visitors with no history and loan or payment decisions are typical cases. Analytical work that feeds people on a human timescale, such as churn analysis, segmentation and sales forecasting, rarely needs it.
Cost can point the same way. As reported by Huyen, Grubhub had about 31 million users in 2020 but only about 2 percent of them logged in on a given day, so her illustration is that precomputing daily predictions for everyone wastes roughly 98 percent of the compute. Online prediction avoids work for inactive users. These are the author's figures for one company; treat them as an illustration, not a benchmark.
What does a real-time ML architecture look like?
The pattern is an event-driven pipeline: events enter a streaming platform, a stream processor turns them into features, a feature store serves those features to the model, and monitoring watches the result. Each layer has a clear job.
| Layer | Job | Example, according to its docs |
|---|---|---|
| Event streaming | Publish and subscribe to event streams, store them durably, process them as they occur or later | Apache Kafka lists these three capabilities on its introduction page |
| Stream processing | Compute windowed features with state and event time | Apache Flink describes application state as a first-class citizen, event-time processing with watermarks, and checkpointing that keeps state consistent after failures (Flink applications) |
| Feature store | Serve the same features for training and for online requests | Feast ingests features from batch sources and makes them available online through materialisation (Feast concepts) |
| Model serving | Apply the model to the feature vector within the request latency budget | Inference endpoint, custom application code or a portable model format |
| Monitoring | Track feature quality, drift and prediction quality | See the monitoring and evaluation section below |
Huyen separates real-time features, computed at request time and fresh to milliseconds but sensitive to latency, from near-real-time features, precomputed by a stream engine and stale by seconds but off the request path. Choosing between them is a latency and cost decision for each feature, not for the whole system. She also describes "log and wait": reusing the features logged at prediction time to reduce training-serving skew.
Where predictions will also be shown live to users or operators, the display layer has its own design choices, covered in our guide to real-time streaming data visualisation. For the wider decision context, see real-time intelligence.
How are continually learning models trained and evaluated?
Huyen describes four stages of continual learning. The first is manual, stateless retraining from scratch. The second is automated retraining on a schedule, which mainly adds a model store. The third is automated, stateful training, which fine-tunes on new data and needs model lineage and reproducible streaming features. The fourth is continual learning proper, where updates are triggered by time, a performance drop or drift, and which needs triggers, continual evaluation and an orchestrator.
Evaluation changes most. Stationary test sets no longer suffice once a model adapts to a changing environment. The options she lists are backtesting, progressive evaluation, shadow deployment, A/B testing, canary analysis and bandits. Bandits are harder to implement than A/B tests, so they are rarely used outside large technology companies. In one experiment she cites, an A/B test needed over 630,000 samples for a 95 percent confidence interval, while Thompson sampling identified a model that was 5 percent better with under 12,000 samples. Offline model testing still matters before any online rollout; see our guide to machine learning model testing.
What are the trade-offs and risks?
| Risk | Why it happens | Control |
|---|---|---|
| Monitoring overload | Models can have thousands of features and most statistical changes are benign, so the hard part is finding the changes that matter | Alert on a short list of features tied to business outcomes; review the rest on a schedule |
| Training-serving skew | Features are built one way for training and another in production | One feature definition for both paths; log features at prediction time |
| No standard infrastructure | Online training stacks are often built in-house and kept confidential by companies that have them | Start with online prediction and scheduled retraining before continual learning |
| Cost of retraining | Stateless daily retraining repeats work | Consider stateful training; Huyen reports that Grubhub cut training cost 45 times after the switch in 2021 |
| Unreviewed model changes | A model that updates itself changes decisions without a release | Version every model, keep rollback, and keep a decision trace for audit |
When not to use it: if the business can wait for the next batch run, or if the team has no mature streaming infrastructure, start with batch prediction and add online features for one use case at a time.
Is the DARPA Real Time Machine Learning programme the same thing?
No. DARPA's Real Time Machine Learning (RTML) programme addressed a different problem: ML systems that are trained before deployment and cannot adapt in the field, such as on autonomous vehicles and sensor arrays. According to its page, it worked on hardware generators and compilers that create ML application-specific integrated circuits (ASICs) from high-level source code with no human in the loop, including a compiler from a high-level ML framework to Verilog. The page gives no dates and states that the programme is complete and no longer maintained. See the DARPA RTML page.
How should an enterprise adopt it?
- Pick one decision that loses value when it waits, and write down the latency it needs.
- Move that model to online prediction with batch features first.
- Add online features through a stream processor and a feature store only where the decision needs them.
- Add automated retraining with a model store and shadow deployment.
- Consider continual learning only if drift is frequent and measured, and keep rollback and audit in place.
Governance runs through every step. ElixirData Context OS keeps governed context, versioned policy and decision traces in one decision layer above AI agents, which is the kind of record a self-updating model needs. Elixir Govern (formerly AgentGRC) keeps autonomous agent actions inside policy, with the audit trail risk teams need.
To map one real-time decision your models make, and the data, features and policy it depends on, book a Context Workshop. See what happens in the workshop.
Frequently asked questions
What is real-time machine learning?
It is a setup where a model produces predictions from fresh data when a request arrives. In its strictest form the model also updates as new data arrives, which is called continual learning. Many production systems need only the first part, online prediction with fresh features.
What is the difference between real-time and batch prediction?
Batch prediction precomputes results at fixed intervals, such as every few hours or daily. Online prediction generates results when the request arrives, which helps with new or logged-out visitors who have no precomputed result. Batch prediction is not a prerequisite for online prediction.
Do I need a feature store for real-time machine learning?
A feature store is one of the listed requirements for online prediction with online features, alongside a stream processing engine and a model store. Feast, for example, makes features from batch sources available online through a process it calls materialisation.
How do you evaluate a model that keeps changing?
A stationary test set no longer suffices once a model adapts to a changing environment. Approaches include backtesting, progressive evaluation, shadow deployment, A/B testing, canary analysis and bandits. Bandits are harder to implement than A/B tests.
Is the DARPA Real Time Machine Learning programme the same thing?
No. DARPA's RTML programme targeted hardware generators and compilers that create ML ASICs from high-level source code. Its page says the programme is complete and no longer maintained. It is a hardware effort, whereas this guide covers the software and data architecture for online prediction.
Follow XenonStack on LinkedIn: XenonStack on LinkedIn for new guides on agentic AI, data and platform engineering.
Ready to put AI agents to work? Explore ElixirClaw, the agentic OS platform to build, orchestrate and govern AI agents.
Explore the XenonStack platform family: ElixirData · ElixirClaw · ElixirHub · NexaStack · MetaSecure · Neural AI · AgentGRC · AgentSRE · AgentAnalyst · AgentInstruct · AgentRAI · AgentScrum · AgentSearch · AgentForce · AI Aviator · SAIF Aviator · CohortIQ · XenonStack AI · XenonStack UAE