SageMaker Feature Store: MLA-C02 study notes and practice questions
What to know about SageMaker Feature Store for the MLA-C02 exam, from the Data Preparation for ML and AI domain (28% of the exam guide), then 2 free questions to test it. Part of the MLA-C02 study guide.
Feature Store questions ask how to share features across teams and stop training and serving from computing them differently (training-serving skew).
Building blocks
Feature group: a set of features with a schema, a record identifier (such as customer_id) and an event time feature.
Online store: the latest value per record, read in milliseconds with GetRecord or BatchGetRecord during inference.
Offline store: every version over time in S3, with a Glue Data Catalog table created by default, so Athena can query history with SQL.
A feature group can have one or both stores.
TTL on the online store expires old records.
Getting features in
PutRecord writes to the online store (and on to the offline store) for streaming updates.
Batch ingestion from Data Wrangler, Spark, Glue or the SDK.
Feature Processor runs Spark transformations on a schedule or trigger and writes the results.
Avoiding leakage
Training data must use feature values as they were at the time of each label, not today’s values. Point-in-time (time travel) queries on the offline store, using the event time, build training sets without leaking future information.
Sharing and governance
Features can be discovered and reused across teams, and shared across accounts with AWS RAM.
IAM controls access per feature group; data is encrypted with KMS.
Lineage tracking shows which models used which features.
When not to use it
A single model with simple, static features stored in S3 may not need Feature Store. It earns its place when several models or teams reuse features, or when real-time inference needs fresh values.
Common traps
Computing features differently in the training notebook and the endpoint. Use one feature group for both.
Joining on today’s values for historical labels, which leaks the future.
Reading the offline store for real-time inference. Use the online store.
A ski resort runs a dynamic lift-ticket pricing model. Its prediction service needs about 40 features per request, such as recent bookings and snow depth for each resort, and it must answer within tens of milliseconds.
The same features must also be available as historical snapshots so the team can retrain the model each week, and the training and serving copies must come from the same feature definitions.
Which design meets these requirements?
Choose one answer.
AA. Create a feature group with only the online store enabled, since the prediction service is the most important consumer.
BB. Create a SageMaker Feature Store feature group with the online store enabled for the prediction service and the offline store enabled for training datasets.
CC. Keep the features in Amazon S3 as Parquet files only, and have the prediction service read the files for each request.
DD. Write the features to an Amazon DynamoDB table for serving, and export a copy to Amazon S3 with a separate script before each training run.
Show the answer and explanation
Answer: B
A. Wrong: The online store keeps current values for lookups, so it does not give the weekly retraining job the historical snapshots it needs. The team would have to build a second pipeline for training data.
C. Wrong: Reading files from S3 for each request is far slower than the tens-of-milliseconds target. The option also gives no shared feature definitions between training and serving.
D. Wrong: DynamoDB can serve the low-latency reads, but the two copies come from separate code paths and can drift apart. The team would own the consistency that Feature Store provides.
Explanation
Feature Store separates the same feature definitions into an online store for low-latency inference and an offline store in Amazon S3 for historical training data. Serving and training then use the same feature group. Single-store designs and separate DynamoDB and S3 copies each miss one requirement.
A regional bank has built a feature group in SageMaker Feature Store for customer spending features. The fraud team wants to build a training dataset from the last 18 months of feature values without affecting the online lookups used during card authorizations.
The team wants to query the history with standard SQL, and it does not want to build or maintain its own export pipeline for the feature data.
Which approach meets these requirements?
Choose one answer.
AA. Query the online store with repeated GetRecord calls for each customer and date, and save the results to a local file on a notebook instance.
BB. Turn on a time-to-live setting on the online store so that old records are kept for exactly 18 months, and query that store with Athena.
CC. Enable the offline store on the feature group, and query its history in Amazon S3 with Athena through the Glue Data Catalog table Feature Store builds.
DD. Copy each feature value from the online store into a new Amazon DynamoDB table every hour, and run a nightly scan of that table to build the training dataset.
Show the answer and explanation
Answer: C
A. Wrong: The online store is designed for current lookups at authorization time, and per-record calls for 18 months of history are slow and costly. The result also does not use the SQL access the team wants.
B. Wrong: Athena queries Amazon S3 and the Data Catalog rather than the online store, so this does not provide the SQL path. A time-to-live setting also deletes records rather than keeping the history for training.
C. Right: Correct. The offline store keeps historical feature records in Amazon S3, and by default Feature Store builds an AWS Glue Data Catalog table for the feature group, so Athena can query it with SQL. Training queries never touch the online store used for authorizations. Learn more: Create a dataset from your feature groups (opens in a new tab)
D. Wrong: Hourly copies add a second pipeline and scan the table during the nightly build, which is slow and expensive. The offline store already keeps this history and is queryable directly.
Explanation
The offline store keeps feature history in Amazon S3, and Feature Store builds an AWS Glue Data Catalog table for it by default, so Athena can query the history with SQL. The online store stays dedicated to low-latency reads at authorization time. Pulling history through the online store or copying it into other tables adds cost and a second pipeline.
Want more on SageMaker Feature Store? The 5 full-length practice sets have 8 more SageMaker Feature Store questions, 325 in all, none of them in the free exam. One payment of $14.99, no subscription. See the practice sets →