Key takeaway
- Feature engineering for real-time ML: feature types, online and offline feature stores, training-serving skew, governance, cost and an adoption sequence.
Feature engineering for real-time ML is the work of turning live events into model inputs within the latency budget of the decision, using exactly the same definitions that were used in training. The hard part is not the transformation itself. It is keeping training and serving consistent, computing windowed features from streams, and keeping every feature auditable once it drives a live decision. This guide is for CTOs, CDOs, heads of engineering and platform architects who have to decide where that logic should live.
It builds on our guide to real-time machine learning and the wider machine learning pipeline. Here the focus is narrower: which features suit streaming, how a feature store separates offline and online use, what goes wrong, and the order in which to adopt it.
What is feature engineering in real-time ML?
Feature engineering is the process of selecting, creating and transforming input variables so that a model can learn the patterns in the data. In a house-price model, for example, "years since last renovation" can be more informative than raw build year. In real-time ML the same idea applies, with one added constraint: each feature must be computable from data available at the moment of prediction, within a few milliseconds to seconds, and recomputable later for training without peeking into the future.
How does real-time feature engineering differ from batch?
| Aspect | Batch feature engineering | Real-time feature engineering |
|---|---|---|
| When features are computed | On a schedule over a fixed dataset, offline | As events arrive, or on request at prediction time |
| Typical latency target | Minutes to hours, as the schedule allows | Milliseconds to seconds, set by the decision |
| Main risk | Stale features | Training-serving skew, late or out-of-order events, cost of low-latency reads |
| Typical storage | Data warehouse or lake tables | Offline store for history plus an online store holding the latest values |
| Model update | Retrain on a fixed dataset | Retrain on triggers such as new data or degradation, features refreshed continuously |
For the wider stack that carries these events, see our overview of real-time analytics tools.
Why is a feature store central to real-time ML?
The Google Cloud MLOps guidance describes a feature store as a centralised repository that standardises how features are defined, stored and accessed, serving both training and online prediction. It warns that deploying a model without shared features forces teams to rebuild features in production, "which can lead to training-serving skew". It also expects a feature store to offer low-latency real-time serving alongside high-throughput batch serving.
The Feast documentation describes the same split: an offline store for "historical feature extraction used in model training" and an online store for "serving features at low-latency in production systems". Feast generates point-in-time correct feature sets, which stops future values leaking into training data. It uses a push model for online serving, and lets you push streaming features but does not pull from streaming sources or manage streaming pipelines for you.
The Amazon SageMaker Feature Store documentation follows a similar design. Its online store keeps only the latest record per feature for low-millisecond reads, while its offline store keeps every record as an append-only history. Streaming sources such as Apache Kafka or Amazon Kinesis can feed the online store through the synchronous PutRecord call. The documentation gives no numeric latency benchmark, so treat "low millisecond" as a design aim to test in your own environment.
Which feature types fit real-time ML?
| Feature type | Example | When it fits | Watch for |
|---|---|---|---|
| Request-time features | Basket size, device type, amount of this transaction | Always available in the request itself | Must be computed inside the latency budget |
| Windowed aggregates | Count of card transactions in the last 10 minutes | Fraud, abuse, demand signals | Window definition must match training exactly; late events change results |
| Entity history features | Customer average order value over 90 days | Personalisation, credit and churn decisions | Usually precomputed in batch and read from the online store |
| Encoded categorical features | One-hot encoded country or channel | Low-cardinality categories | Unseen categories at serving time need a defined fallback |
| Text features | TF-IDF or embeddings of a support message | Routing and classification | Embedding models add inference cost to the critical path |
| Derived custom features | Ratio of spend to usual spend | Where domain knowledge captures what raw columns cannot | Each one is a definition that needs an owner and a test |
The scikit-learn preprocessing guide documents standard transforms such as standardisation and one-hot encoding. Its scaler fits statistics on the training set so that the same transformation can be re-applied later. In a real-time system that fitted state is part of the feature definition and must be versioned and shipped to serving, otherwise scaled values will differ between training and production.
What are the main challenges, and how are they handled?
- Training-serving skew: define each feature once and serve it to both paths from the same store, as the Google Cloud guidance above recommends.
- Point-in-time correctness: when building training sets, join each label to the feature values that existed at that moment, not the latest values.
- Latency: precompute what can be precomputed, read entity history from the online store, and compute only request-time features inline.
- Data quality in streams: handle missing values, outliers and malformed events before features are written, and decide what the model does when a feature is absent.
- Drift: the Google guidance lists retraining triggers including significant changes in data distributions and noticeable performance degradation. Monitor feature distributions as well as model accuracy.
What should leaders know about governance, security and cost?
- Governance: every feature that drives a live decision should have an owner, a definition, a version and a record of which model uses it. Our guide to model validation testing covers how models are checked before release.
- Security and privacy: features often contain personal or sensitive data. Apply the same access control and retention rules to the online store as to the source systems, and avoid features that proxy for protected attributes.
- Cost: an online store with low-latency reads is a running cost. Only features that are needed at prediction time should be written to it; the rest can stay offline.
- Auditability: being able to reconstruct which feature values a decision used is what allows a model-driven action to be reviewed afterwards.
Where decisions need governed context and a decision trace, ElixirData Context OS keeps governed context, versioned policy and decision traces in one decision layer above AI agents. For plain-language questions over enterprise data with real-time insight, AgentAnalyst lets teams ask questions of enterprise data in plain language and get real-time insights.
What are the best practices for real-time feature pipelines?
- Start from the decision: work out the latency budget and the cost of a wrong decision before choosing features.
- Check relevance: rank features by importance and drop those that add latency without adding accuracy.
- Handle missing data explicitly: choose imputation or a missing-value indicator, and use the same rule in both paths.
- Scale and encode consistently: persist fitted scalers and encoders with the model version.
- Reduce dimensionality where it helps: feature selection or PCA can cut inference cost, but test the effect on accuracy.
- Test the pipeline: compare offline and online values of the same feature for the same entity and time, and alert on differences.
- Automate release: treat feature definitions as code within continuous delivery for machine learning (CD4ML) and your MLOps process.
When is real-time feature engineering not the right choice?
If the decision can wait an hour or a day, scheduled batch features are simpler, cheaper and easier to audit. Real-time features earn their cost when the value of a decision decays within seconds, as in fraud screening, dynamic recommendations or operational alerts. Teams also over-invest when a model barely uses the freshest signals: measure how much accuracy is lost when features are an hour old before building a streaming path.
How should an enterprise adopt it, step by step?
| Step | What to do | Output |
|---|---|---|
| 1. Pick one decision | Choose a use case with a clear latency budget and owner | Decision and latency target |
| 2. Inventory features | List each feature, its source, freshness need and owner | Feature catalogue |
| 3. Separate offline and online | Decide which features must be served online | Online and offline feature sets |
| 4. Build one definition path | Write each feature once for training and serving | Shared feature code |
| 5. Test for skew | Compare offline and online values continuously | Skew report and alerts |
| 6. Monitor and retrain | Track feature drift and model performance, set retraining triggers | Retraining policy |
Tool choice follows the process; our overview of machine learning tools lists common options.
What will change in real-time feature engineering next?
Automated feature generation, feature learning from unlabelled data, domain-specific feature sets and explainability of feature contributions are the directions most often discussed. They reduce manual effort, but they do not remove the need for point-in-time correctness, shared definitions and ownership. Treat vendor claims about automation as something to test on your own data.
To map one decision your real-time models should make, and the features, context and policy it depends on, book a Context Workshop. See what happens in the workshop.
Frequently asked questions
What is feature engineering in real-time machine learning?
It is the selection, creation and transformation of model inputs so they can be computed from live data within the latency budget of the decision, using the same definitions as in training.
What is training-serving skew?
It is a mismatch between the features used to train a model and those used when it serves predictions. Google Cloud's MLOps guidance says deploying without shared features can lead to it, and a feature store can prevent it by acting as a common data source.
What is the difference between an online and an offline feature store?
The offline store holds historical feature values for training and batch scoring. The online store serves the latest values at low latency for real-time prediction, as described in the Feast and Amazon SageMaker Feature Store documentation.
What is point-in-time correctness?
It means each training example only uses feature values that were available at that moment, so future information does not leak into training. Feast generates point-in-time correct feature sets for this purpose.
When should a team avoid real-time features?
When the decision can wait, because batch features are simpler, cheaper and easier to audit. Measure how much accuracy is lost with older features before building a streaming path.
Next Steps for Real-Time Machine Learning
Talk to our experts about implementing real-time machine learning systems. Learn how industries use real-time ML to optimize operations and improve decision-making, leveraging AI for efficiency and responsiveness.
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