Inferensys

Glossary

Batch Features

Feature values computed on static, historical datasets using distributed processing frameworks, typically capturing long-term trends and aggregations for machine learning models.
Data engineer managing feature store on laptop, feature definitions visible, casual data engineering session.

What is Batch Features?

Feature values computed on static, historical datasets using distributed processing frameworks, typically capturing long-term trends and aggregations.

Batch features are feature values computed offline on static, historical datasets using high-throughput distributed processing frameworks like Apache Spark. These features capture long-term statistical aggregations, such as a customer's average monthly spend over the past year or a product's lifetime return rate, and are materialized into the offline store of a feature store for model training and batch inference.

Unlike streaming features, batch features are not updated in real-time and exhibit higher latency, making them suitable for capturing slow-moving trends and historical patterns. They are typically recomputed on a scheduled cadence—daily or hourly—and backfilled using point-in-time correct joins to ensure training datasets are historically accurate and free of data leakage.

OFFLINE FEATURE ENGINEERING

Key Characteristics of Batch Features

Batch features are the foundational building blocks of machine learning, capturing long-term trends and historical aggregations computed over static datasets using distributed processing frameworks.

01

Computed on Static, Historical Data

Batch features are derived from offline data warehouses or data lakes containing snapshots of historical records. Unlike streaming features, they do not process real-time events. The computation runs against a fixed, bounded dataset—for example, all user transactions from the previous three years. This allows for complex, multi-stage aggregation pipelines that would be impossible to execute with low-latency constraints.

  • Source: Data warehouses (Snowflake, BigQuery), data lakes (S3, ADLS)
  • Cadence: Typically daily or hourly, not sub-second
  • Example: A user's total spend over the last 90 days, computed at 2 AM UTC
T+1
Typical Freshness
TB-PB
Dataset Scale
02

Captures Long-Term Trends and Aggregations

The primary purpose of batch features is to encode slow-moving signals and historical patterns. These features provide the model with context that cannot be inferred from a single real-time event. Common aggregations include rolling window statistics, lifetime counts, and decay-weighted averages.

  • Rolling Window: Average order value over the last 30 days
  • Lifetime Metrics: Total number of purchases since account creation
  • Cohort Analysis: A user's percentile rank within their acquisition cohort
  • Seasonality: Purchase frequency during the same calendar month last year
03

Processed via Distributed Frameworks

Due to the massive scale of historical data, batch feature computation relies on distributed processing engines that parallelize workloads across clusters. These frameworks handle data shuffling, partitioning, and fault tolerance to produce feature values efficiently.

  • Apache Spark: The dominant framework for batch feature engineering, using DataFrames and SQL for transformations
  • Apache Hive: SQL-based processing on Hadoop for legacy pipelines
  • dbt: For transformation logic in modern data warehouses, often used for simpler aggregations
  • Execution Pattern: MapReduce-style operations that scan, filter, group, and aggregate entire datasets
04

Stored in the Offline Store

Once computed, batch features are persisted in the feature store's offline store—a high-throughput, scalable storage layer optimized for large-scale retrieval during model training. The offline store acts as the system of record for historical feature values.

  • Storage Backends: Parquet files on object storage, Delta Lake tables, or cloud data warehouses
  • Retrieval Pattern: Full table scans for training dataset generation, not point lookups
  • Point-in-Time Correctness: The offline store must support time-travel queries to reconstruct feature values exactly as they existed at any historical timestamp, preventing data leakage from future information
05

Materialized to the Online Store for Inference

Although computed in batch, these features are often materialized into the online store to serve low-latency predictions. The materialization process copies the latest computed values into a key-value database optimized for point lookups during inference.

  • Materialization Job: A scheduled process that reads the latest batch values and upserts them into the online store
  • Latency Trade-off: Batch features in the online store have T+1 freshness—they reflect the state as of the last batch run, not the current moment
  • Use Case: A user's 'favorite category' computed nightly and served instantly at login the next morning
06

Contrast with Streaming Features

Batch features and streaming features serve complementary roles in a feature store. Batch features provide deep historical context, while streaming features capture immediate intent. Understanding the distinction is critical for feature selection.

  • Batch: User's 90-day average cart size (computed nightly)
  • Streaming: Items in the user's current session cart (updated in real-time)
  • Hybrid Use: A model often combines both—using batch features for long-term preferences and streaming features for session context
  • Infrastructure: Batch uses Spark on offline data; streaming uses Flink or Kafka Streams on event logs
BATCH FEATURES

Frequently Asked Questions

Clear, technical answers to the most common questions about computing, storing, and serving batch features in modern feature stores.

Batch features are feature values computed on static, historical datasets using distributed processing frameworks like Apache Spark or SQL engines, typically capturing long-term trends and aggregations. They are recalculated on a fixed schedule—hourly, daily, or weekly—and materialized into an offline store for training or an online store for inference. In contrast, streaming features are computed incrementally on real-time event data with low latency, capturing immediate user intent. The key distinction is the computation trigger and data scope: batch features operate on bounded, historical data at rest, while streaming features operate on unbounded, continuous data in motion. For example, a user's 90-day average order value is a batch feature, while their clicks in the last 5 minutes is a streaming feature.

FEATURE COMPUTATION PARADIGM

Batch Features vs. Streaming Features

A comparison of feature engineering approaches based on data processing methodology, latency, and use case suitability.

CharacteristicBatch FeaturesStreaming FeaturesOn-Demand Features

Computation Trigger

Scheduled (e.g., hourly, daily)

Event-driven (continuous)

Request-time (synchronous)

Data Scope

Historical, static datasets

Real-time event streams

Raw request payload

Processing Framework

Apache Spark, SQL Warehouses

Apache Flink, Kafka Streams

Feature Store Serving API

Serving Latency

High (pre-computed)

Low (pre-computed)

Medium (computed on read)

Temporal Granularity

Aggregates over days/weeks

Aggregates over seconds/minutes

Point-in-time context

Primary Use Case

Long-term user taste profiles

Session-based intent signals

Contextual input (device, location)

Data Freshness

Hours to days

Sub-second to minutes

Instantaneous

Storage Location

Offline Store

Online Store

Not persisted

Prasad Kumkar

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.