Lesson 1 of 3 Amazon SageMaker Feature Store

Storing Features in SageMaker Feature Store Online and Offline Stores

This lesson explains SageMaker Feature Store, a managed feature repository that lets teams reuse features and serve exactly the same feature values at training and inference time.

Learning outcomes

After completing this lesson, you will be able to:

  • Define a feature group with record identifier and event time.
  • Explain what the online store serves and how fast.
  • Explain what the offline store keeps and how it is queried.
  • Remove training-serving skew with a shared feature store.

Feature groups and records

A feature group is a table-like collection of features. Its definition includes the feature names and types (integral, fractional, string), a record identifier feature (such as customer_id) and an event time feature that records when each value was observed. Each write is a record: one row of feature values for one identifier at one event time. Feature groups are searchable and can carry descriptions and parameters so other teams can discover them.

True or false

Feature group basics

Exam skills 1.2.2

Check how feature groups and records are defined.

Log in to try this activity Interactive activities are free with an account.

Online store

The online store keeps the latest record for each record identifier and returns it with single-digit millisecond latency through GetRecord and BatchGetRecord. It is used at inference time to enrich a request: a fraud service receives a card number, reads the card's latest features and sends them with the transaction to the model. The online store has a Standard tier and an InMemory tier for the lowest latency, and records can expire with a time to live (TTL).

Sort into groups

Online or offline store?

Exam skills 1.2.2 · 1.1.9

Decide which Feature Store store serves each request.

Log in to try this activity Interactive activities are free with an account.

Offline store

The offline store appends every record written to a feature group to Amazon S3, in Glue (Hive) table format or as Apache Iceberg tables, and registers a table in the AWS Glue Data Catalog. Because it keeps the full history of every feature value, it is used to build training datasets, run analytics with Athena and make point-in-time queries that retrieve feature values as they were when each training label was observed, which prevents future information from leaking into training.

A feature group can have the online store, the offline store or both, depending on whether it serves real-time inference, training or both. The following table compares them.

Online store
ContentsLatest record per identifier
AccessGetRecord / BatchGetRecord, milliseconds
StorageManaged low-latency store
Used forReal-time inference
Offline store
ContentsAll records over time
AccessAthena, Spark, SDK dataset builder
StorageS3 (Glue or Iceberg tables)
Used forTraining, batch inference, analysis

The following diagram shows the two stores of a SageMaker Feature Store feature group and who reads each.

A feature group with both stores. Writes go to the online store, which keeps only the latest record per identifier for millisecond reads at inference, and are appended to the offline store in S3, which keeps every record with its event time for training datasets, Athena analytics and point-in-time queries.
The scenario is illustrative.
Worked example

Removing training-serving skew

A ride-sharing company computes "driver's average rating over the last 30 days" in a nightly batch job for training, but the dispatch service computes it in application code for live predictions. The two disagree for drivers with recent cancellations, and live accuracy is lower than expected.

Creating a driver_features feature group with both stores fixes the issue. The batch job writes features once; training datasets are built from the offline store and the dispatch service reads the online store. Both now use the same computed values, so there is no training-serving skew.

Check yourself

Which two features must every feature group have?

Show answer

A record identifier and an event time feature.

Exam Tips

Remember for the exam

  • Same features for training and low-latency inference: Feature Store with both stores.
  • Every feature group needs a record identifier and an event time feature.
  • Online store: latest value per ID in milliseconds.
  • Offline store: full history in S3 for training.
  • TTL expires stale online records.