On-demand features are feature values calculated synchronously during an online inference request. Unlike pre-materialized batch or streaming features, they are not stored in the online store. Instead, the feature serving infrastructure executes a user-defined transformation function at query time, using raw request payload data—such as a user's current GPS coordinates or a product SKU—to generate the feature vector immediately. This mechanism is critical for incorporating real-time, non-historical context that cannot be pre-computed.
Glossary
On-Demand Features

What is On-Demand Features?
On-demand features are machine learning feature values computed at the moment of a prediction request, using raw data passed directly to the feature store, rather than being pre-computed and stored.
This approach is essential for high-cardinality or ephemeral context, like calculating the real-time distance to a store or applying a cryptographic hash to a session ID. By shifting computation to the Serving API, on-demand features eliminate the storage cost and staleness risk associated with materializing every possible value. However, they introduce additional inference latency, requiring careful optimization of the transformation logic to meet strict service-level objectives.
Key Characteristics of On-Demand Features
On-demand features are computed at the moment of inference using raw data passed directly to the feature store, enabling personalization on context that cannot be pre-materialized.
Request-Time Computation
Unlike pre-computed features that are materialized and stored, on-demand features execute transformation logic synchronously during the prediction request. The raw input data—such as a user's current session ID, geolocation coordinates, or real-time device context—is passed to the feature store, which applies the defined transformation and returns the computed feature vector immediately. This ensures the model always acts on fresh, context-specific data that would be impossible or impractical to pre-calculate for every possible input combination.
Stateless Transformation Functions
On-demand features rely on pure, stateless functions that take raw request data as input and return deterministic feature values. These functions are typically defined in Python or SQL and registered in the feature registry alongside pre-computed features. Key properties include:
- Idempotency: The same input always yields the same output
- No side effects: Functions do not write to external state
- Lightweight execution: Designed to complete in single-digit milliseconds to avoid adding latency to the inference path
Hybrid Feature Retrieval
A single inference request typically combines both pre-computed and on-demand features into a unified feature vector. The online store retrieves pre-materialized features—such as historical purchase aggregates or long-term preference embeddings—while simultaneously executing on-demand transformations for real-time context. The feature store's serving API orchestrates this parallel retrieval and computation, merging results before delivering the complete vector to the model endpoint.
Contextual Input Sources
On-demand features ingest data from the live request payload rather than historical data warehouses. Common input sources include:
- HTTP request headers: Device type, browser, IP-derived location
- Session metadata: Current page URL, time on site, scroll depth
- Real-time sensor data: GPS coordinates, accelerometer readings
- User-supplied parameters: Search query text, filter selections This architecture enables personalization based on immediate situational context that has no persistent historical record.
Cold Start Mitigation
On-demand features are a critical tool for addressing the cold start problem in personalization systems. When a new user arrives with no historical interaction data, pre-computed features return null or default values. On-demand features compensate by extracting predictive signals from the current session context—such as referral source, landing page category, or device type—allowing the model to make informed predictions from the very first interaction without waiting for behavioral history to accumulate.
Latency Budget Considerations
While on-demand features provide maximum freshness, they consume a portion of the end-to-end inference latency budget. Best practices include:
- Capping transformation complexity: Avoid heavy computation or external API calls
- Leveraging feature caches: Cache results for identical inputs within a time window
- Monitoring P99 latency: Track on-demand computation time separately from retrieval time Architects must balance the value of real-time context against the strict latency SLAs required for user-facing personalization.
Frequently Asked Questions
Clear answers to common questions about computing feature values at request time for real-time machine learning inference.
On-demand features are machine learning feature values computed at the moment of a prediction request using raw data passed directly to the feature store, rather than being pre-computed and stored in advance. When a model serving endpoint calls the Serving API, the feature store executes a user-defined transformation function—such as a Python UDF or lambda—on the fly, using context like the user's current GPS coordinates, session metadata, or real-time API responses. This mechanism is essential for context that cannot be pre-materialized because it is unique to each request, such as the distance between a user's live location and a store, or the current time of day encoded as a cyclical feature. The computation typically completes within single-digit milliseconds to avoid violating the latency budget of the online inference pipeline.
On-Demand vs. Pre-Computed Features
A comparison of feature computation and serving paradigms for real-time machine learning inference.
| Metric | On-Demand Features | Pre-Computed Features | Hybrid Approach |
|---|---|---|---|
Computation Timing | At request time | Before request (batch/stream) | Mixed |
Latency Profile | Higher (10-100ms+) | Ultra-low (< 5ms) | Low (5-20ms) |
Data Freshness | Real-time | Stale (depends on materialization) | Configurable |
Requires Online Store | |||
Handles Contextual Input | |||
Compute Cost at Inference | High | Negligible | Moderate |
Storage Overhead | Minimal | High | Moderate |
Suitable for Session Data |
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
Core concepts that interact with on-demand feature computation in a feature store architecture.
Feature Serving
The low-latency process of retrieving feature vectors and delivering them to a model endpoint. On-demand features are computed during this serving step rather than being retrieved from a pre-materialized cache. The serving infrastructure must route requests to the appropriate computation logic, often via a Serving API (REST or gRPC), and combine the results with pre-computed features from the Online Store to assemble the final feature vector.
Streaming Features
Feature values computed incrementally on real-time event data using stream processing engines like Apache Kafka or Flink. Unlike on-demand features, which use data passed at request time, streaming features are pre-computed as events arrive and stored in the online store. They capture immediate user intent—such as session click count or items viewed in the last 5 minutes—and are refreshed continuously.
Feature Vector
A one-dimensional array of numerical values representing the aggregated features for a specific entity at a specific point in time. When on-demand features are used, the final feature vector is a composite:
- Pre-computed features retrieved from the online store
- On-demand features computed at request time using client-supplied context This combined array is the direct input to the machine learning model for inference.
Online Store
The low-latency database component of a feature store designed to serve pre-computed feature vectors during real-time prediction. On-demand features bypass the online store entirely—they are never materialized or persisted there. Instead, the online store supplies the static, pre-computed portion of the feature vector, while on-demand computation handles dynamic context like real-time geolocation, device type, or session-specific parameters passed in the inference request.
Feature Freshness
A metric defining the maximum acceptable age of a feature value before it is considered stale. On-demand features achieve zero staleness by definition—they are computed at the moment of request using the most current data available. This contrasts with batch features, which may have freshness measured in hours or days, and streaming features, which may have sub-second to minute-level freshness depending on pipeline latency.
Feature Registry
A centralized metadata catalog that tracks feature definitions, schemas, lineage, and versions. On-demand features are registered here with their transformation logic and input parameters documented. This enables discovery and reuse across teams—a data scientist can find an existing on-demand feature definition, understand its required inputs, and incorporate it into a new Feature View without re-engineering the computation.

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us