Author a Feature once, serve it everywhere — one declarative definition powers point-in-time training and warm online ranking at p95 34 ms, with in-session signals live in under 130 ms.
by Tian Tan, Sixuan He, Nick Joung and Julia Powell
Real-time personalization depends on understanding what customers want in the moment. When a retail banking customer checks their accounts, explores credit cards, or opens a loan calculator, each interaction signals their current intent. A relevant offer needs to reach them while they're still in the session.
The challenge is making that intent available to the model. Raw clickstream data must be aggregated into time-windowed features for two purposes: training on historical values as they existed at a given point in time, and serving predictions using current values with millisecond latency. Building these pipelines separately creates duplicate feature definitions that can drift over time and degrade model accuracy.
Databricks Feature Views solve this by letting you define features once for both training and serving. In this blog, we'll walk through an open-source Solution Accelerator that uses Feature Views to build a real-time next-best-offer (NBO) recommender for financial services.

The accelerator includes two parts: a recommender using batch features and an extension that adds streaming, in-session intent. Both are built end-to-end on Databricks, with runnable notebooks you can clone and deploy.
Real-time recommendations require both consistency and speed. Features must be computed the same way during training and serving to avoid train/serve skew, which can degrade model accuracy. At inference time, those features must also be retrieved and scored in milliseconds.
Traditionally, meeting both requirements meant maintaining separate systems: a batch pipeline for training features and a hand-written streaming job for online serving. This creates duplicate logic that can drift over time.
Feature Views eliminate the need for separate feature definitions. You declare the logic once, and Databricks reuses it across training and serving:
At training time, the create_training_set API retrieves feature values as they existed at each labeled event, preventing future data leakage. At inference time, the Model Serving endpoint fetches batch features from the online store using customer_id.
Both workflows use the same feature definitions, avoiding inconsistencies between separately implemented offline and online transformations.
The accelerator implements a real-time next-best-offer (NBO) recommender for retail banking. As a customer browses accounts, explores credit cards or uses a loan calculator, the system ranks a catalog of offers, including credit card upgrades, savings products and personal loans, to recommend the most relevant option during the session.
The recommender combines stable customer context, such as balances, spending, tenure and risk band, with recent clickstream activity that captures in-session intent. A single ranking model uses both types of data, while Feature Views keep feature definitions consistent across offline training and online serving.
The accelerator includes three steps, delivered as runnable notebooks across two parts that share a catalog, schema, online store and feature definitions.

Feature Views let you declare features over batch tables and live Kafka streams using the same approach:
Feature | Declared as | What it gives the model |
30-day average balance |
| Rolling behavior |
90-day spend |
| Fixed-period behavior |
Loyalty tier, risk band, income, tenure |
| Stable customer context |
Category views in the last 10 minutes |
| Freshest in-session intent |
30-day category interest |
| Long window, fresh leading edge |
Spend-to-income ratio |
| Derived, computed per request |
For streaming features, point the declaration at a Kafka topic instead of a table. Feature Views continuously aggregate events into the online store without a separate hand-written streaming job or duplicate feature logic.
SawtoothWindow keeps longer streaming windows practical. For example, a 30-day category count stays fresh as new events arrive without recomputing the entire history for every event.
Using the Feature Engineering SDK, a point-in-time join reconstructs each feature's value as it existed at the time of the historical label, preventing future data leakage. The resulting training set feeds a LightGBM ranker registered in Unity Catalog.
Because training and serving use the same feature declarations, features cannot diverge through separately implemented offline and online transformations.
The ranker runs on a route-optimized Model Serving endpoint. Each request contains {customer_id, candidate offers, session context}. The endpoint retrieves customer features from the online store by key and scores all 40 offers directly, without an additional candidate-narrowing step.
A second route-optimized Feature Serving endpoint exposes the feature values, allowing the application to show why an offer was selected without querying the online store directly.

Two measurements matter most for a real-time recommender: how quickly a click becomes a model-visible feature and whether training and serving produce identical feature values.
We benchmarked the accelerator end-to-end using its smallest configuration: a small serving endpoint and a single-node online store, without tuning. Streaming events became model-visible in approximately a tenth of a second, while the training and serving paths produced identical values.
Each pair of bars shows the median (p50) and 95th percentile (p95) latency. The first two measure request latency and are directly comparable. The third measures feature freshness, from event ingestion to online availability, rather than the time a user waits. The dashed line marks the 50 ms budget that both serving paths meet.
A complete ranking request, including online feature retrieval and inference, fits within a 50 ms budget on the smallest endpoint size. Adding the live streaming feature increases latency by just 3-4 ms.
The ranking endpoint sustained approximately 56 requests per second (RPS), while the Feature Serving endpoint sustained approximately 390 RPS before p95 latency exceeded 50 ms.
Measured throughput tracked concurrency divided by service time to within 15%, providing a practical sizing formula:
required concurrency = 4 × ceil(target RPS ÷ measured RPS at your SLO)
Based on these results, supporting 150 ranking requests per second within a 50 ms p95 service level objective (SLO) requires concurrency 12.
We used the accelerator's benchmark notebooks with warm endpoints, an in-region client, and light load. With request keys distributed across 2,000 customers using a Zipfian distribution to increase cache misses, ranking latency measured 33 ms p50 and 48 ms p95.
We measured feature freshness per event, from the Kafka write to the value becoming readable in the online store. For consistency, we compared offline materialized values against the online store for every customer using null-safe equality.
These results have two limitations. First, ranking endpoints use scale-to-zero, so the first request after an idle period can incur a cold start of tens of seconds. Second, the reported latency combines feature retrieval and inference. The 27 ms measurement therefore isn't directly comparable to benchmarks reporting feature-read latency alone.
The accelerator demonstrates a working real-time recommender, not a proven revenue uplift. Because it uses synthetic data, we don't claim improvements in conversion. Instead, it gives teams a starting point to measure business impact.
Before production, teams must also implement eligibility, consent, suitability and suppression controls. Ranking offers is a modeling step, not a final offer decision. The accelerator demonstrates the feature engineering and serving infrastructure, not these business rules.
The accelerator lets you start with batch features, then add real-time streaming without rebuilding your feature infrastructure.
Use Declarative Automation Bundles (DABs) to deploy the accelerator:
Deployment order matters: The app depends on the Part 2 serving endpoints, which the notebooks create at runtime. Deploy the jobs, run Part 1 and Part 2, then deploy the app. Everything runs on serverless compute governed by Unity Catalog.
Feature Views let you define features once for point-in-time-correct training and low-latency online serving across AWS, Azure and GCP. Explore the accelerator to see how batch and streaming features come together in a real-time recommender.
What are Feature Views?
Feature Views let you define feature transformations once and reuse them across model training and online serving. They support batch and streaming features, with point-in-time-correct historical values for training and low-latency access to current values for inference.
How do Feature Views prevent train/serve skew?
Feature Views use shared feature definitions across training and serving, avoiding inconsistencies caused by maintaining separate transformation logic. The create_training_set API also uses point-in-time joins to reconstruct feature values as they existed at each historical label, preventing future data leakage.
Can Feature Views support real-time streaming features?
Yes. Feature Views can continuously aggregate events from Kafka into an online store without requiring a separate hand-written streaming job. The accelerator demonstrates this using RollingWindow for recent session activity and SawtoothWindow for longer historical windows.
What performance does the next-best-offer accelerator achieve?
In the benchmark configuration, the ranking endpoint achieved 34 ms p95 latency, including online feature retrieval and inference. The ranking endpoint sustained approximately 56 requests per second, while the Feature Serving endpoint sustained approximately 390 requests per second before exceeding the 50 ms p95 latency budget.
What do I need to run the next-best-offer accelerator?
You'll need a Databricks workspace, a configured Databricks CLI profile and the accelerator's GitHub repository. Part 1 deploys the batch-feature recommender using Declarative Automation Bundles. Part 2 additionally requires a Unity Catalog Kafka connection and Amazon MSK connectivity to incorporate live session activity.
Subscribe to our blog and get the latest posts delivered to your inbox.