What you will be able to do
- Build a leakage-free training set by pairing a spine timestamp with a feature view's timestamp_col in generate_training_set
- Explain how the ASOF join picks a feature value for each spine row
- Prove that a training set contains no feature values from after each label's time
- Freeze a verified training set as an immutable, versioned Dataset
Key concept
Point-in-time (ASOF) lookup — For each spine row, the Feature Store returns the latest feature row for the same entity key whose timestamp is at or before that row's spine timestamp. Each label only sees feature values that already existed when the prediction would have been made.
1.Why a training set needs a timestamp on every row
Temporal leakage happens when a training row carries a feature value the model could not have known at prediction time. Take a churn label dated 1 March. If it is joined to a customer's activity count computed on 20 March, the model learns from the future. It looks excellent offline and then underperforms in production, where the future is never available. The fix is to anchor every training row to a moment in time and only allow feature values from before that moment.
The anchor is the spine: a Snowpark DataFrame that holds the entity IDs, a timestamp, the label columns and any extra training columns. The spine timestamp is the time each prediction would have been made. The Feature Store fetches the requested features for each entity ID, as they stood at that row's timestamp. So the spine says *who* and *when*, and the feature views supply *what was known then*.
The feature side needs a timestamp too. A feature view (managed or external) declares a timestamp_col that records when each feature row became valid. Without it the feature view has no history to search, so the lookup cannot be time-aware. A feature view that carries time-series features must name its timestamp column.
Checkpoint 1 of 8· Check yourself
You are building a churn training set. Each label row is dated the day the churn prediction would have been made. The Feature Store must not leak future activity into these rows. Which timestamp do feature values have to be at or before?
The spine anchors each training row with a timestamp, and features are looked up as they stood at that moment. The feature view's timestamp_col only gives the history that gets searched. Using generation time or refresh time would let rows see feature values computed after the prediction moment, which is temporal leakage.
“Requested features are retrieved for the list of entity IDs, with point-in-time correctness with respect to the provided time stamp.”Source: docs.snowflake.com
2.How the ASOF join picks each feature value
The Feature Store implements point-in-time correctness with an ASOF JOIN. For each spine row, it matches on the entity join key and then looks backwards in time: of all the feature rows for that key stamped at or before the spine timestamp, it keeps the latest one. Rows stamped after the spine timestamp are never candidates, which is what keeps future data out of the model.
Two plausible-sounding alternatives behave differently. An equality join on timestamps would drop almost every row, because feature timestamps rarely equal label timestamps exactly. Replaying each feature table with Time Travel would only show the table's physical state at a past moment, and that is limited by retention. The ASOF join needs neither. It reads the timestamped history in the feature table and picks the right row per key.
Checkpoint 2 of 8· Check yourself
A teammate wants to prevent leakage by replaying each feature table with Time Travel at every label's timestamp. The spine passed to generate_training_set has a timestamp column, and each feature view defines timestamp_col. How does the Feature Store attach feature values to each spine row?
Point-in-time correctness comes from an ASOF JOIN. For each spine row it picks the most recent feature row for that key at or before the spine timestamp. It reads the timestamped history in the feature table, so it needs neither an exact timestamp match nor Time Travel retention.
“Backfill and point-in-time correct features with ASOF JOIN”Source: docs.snowflake.com
Checkpoint 3 of 8· Exam question
Which mechanism does the Snowflake Feature Store use when generate_training_set receives a spine_timestamp_col and feature views that define a timestamp_col?
Correct answer: D — An ASOF JOIN that matches each spine row to the latest feature row for the same entity key at or before the spine timestamp
- A. Incorrect. An equality join would drop most spine rows, because label times rarely match feature timestamps exactly. Point-in-time retrieval needs a nearest-prior match instead.
- B. Incorrect. Time Travel is limited by retention and operates on one timestamp per query, not per spine row. The Feature Store does not rely on it for point-in-time lookups.
- C. Incorrect. A cross join would be prohibitively expensive at training-set scale. Snowflake provides a purpose-built temporal join that avoids materializing that product.
- D. Correct. The point-in-time lookup is implemented with an ASOF JOIN whose match condition keeps the closest feature row not later than the spine time, per entity key.
3.Calling generate_training_set without leaking
generate_training_set adds feature values to the spine. The parameter that switches on the time-aware lookup is spine_timestamp_col. You must supply it for time-series features, because it is the column name that turns on the automatic point-in-time lookup. spine_label_cols marks the label columns. include_feature_view_timestamp_col decides whether the feature row's own timestamp is copied into the output.
training_set = fs.generate_training_set(
spine_df=MySourceDataFrame,
features=[registered_fv],
save_as="data_20240101", # optional
spine_timestamp_col="TS", # optional
spine_label_cols=["LABEL1", "LABEL2"], # optional
include_feature_view_timestamp_col=False, # optional
)spine_timestamp_col names a column of the spine, such as LABEL_TS. It does not name the feature view's EVENT_TS. The feature view's timestamp was fixed when the feature view was registered with timestamp_col, and the join compares the two. Passing the feature column as the spine column compares feature time with itself, so nothing anchors the lookup to the label date.
Three common wrong setups all leak. Leaving out spine_timestamp_col drops the point-in-time lookup, so labels are no longer pinned to their own dates. Calling read_feature_view and left-joining on CUSTOMER_ID attaches the current value to every historical label. The refresh schedule only controls when the feature table updates. It does not decide which past row a given label should see. Hand-rolled joins also lose the guarantee the Feature Store gives for free.
Inference uses the same lookup. retrieve_feature_values takes a spine_df and a spine_timestamp_col, so batch scoring for a past date receives the feature values valid at that date, using the same logic that built the training set.
Checkpoint 4 of 8· Fill the gap
In this call, "TS" is the spine column holding the time each prediction would have been made. Which parameter name in the blank turns on the point-in-time lookup?
training_set = fs.generate_training_set(
spine_df=MySourceDataFrame,
features=[registered_fv],
save_as="data_20240101", # optional
? ="TS", # optional
spine_label_cols=["LABEL1", "LABEL2"], # optional
include_feature_view_timestamp_col=False, # optional
)spine_timestamp_col names the spine's own timestamp column. Its name is what switches on the automatic point-in-time lookup. timestamp_col is set on the feature view when it is registered, and include_feature_view_timestamp_col only controls whether the feature row's timestamp is copied into the output.
Source: docs.snowflake.comCheckpoint 5 of 8· Exam question
A data scientist is building a churn model. The spine DataFrame holds CUSTOMER_ID, LABEL_TS (the date each prediction would have been made) and CHURNED. The customer_activity feature view was registered with timestamp_col="EVENT_TS". Which call builds a training set that avoids temporal leakage?
Correct answer: A — Call fs.generate_training_set(spine_df, features=[fv], spine_timestamp_col="LABEL_TS", spine_label_cols=["CHURNED"]) so each label gets feature values valid then
- A. Correct. With
spine_timestamp_colset, the Feature Store runs an ASOF-style lookup that returns, for each spine row, the latest feature row whose timestamp is at or before the label timestamp, so no later values leak in. - B. Incorrect. Without a spine timestamp column the lookup has no point in time to anchor on, so each label receives current feature values, which include information from after the prediction date.
- C. Incorrect. Reading the feature view returns only the latest materialized state per entity. A refresh schedule does not align values to historical label dates, so past labels get present-day features.
- D. Incorrect. The spine timestamp must be a column of the spine that states when the prediction was made. A feature timestamp is not a spine column, and comparing a column with itself provides no temporal filter.
Sources1
4.Proving that no future values leaked in
A point-in-time training set can be checked row by row, and you should check it before you trust a new feature view. Set include_feature_view_timestamp_col=True so each output row keeps the timestamp of the feature row that was matched. Then assert that this feature timestamp is less than or equal to the spine timestamp on every row. A single row where the feature timestamp is later than the spine timestamp is proof of leakage.
A second test uses a crafted spine. Pick one entity whose feature history you know, and add spine rows just before and just after a known feature update. The row before the update must return the old value. The row after must return the new one. If the earlier row already shows the new value, the lookup is reaching forward. One common cause is a feature view registered without timestamp_col, which leaves the lookup nothing to compare against.
Checkpoint 6 of 8· Check yourself
Before trusting a new feature view, you want proof that no training row picked up a feature value from after its prediction moment. Which test gives that proof row by row?
Keeping the matched feature row's timestamp in the output lets you compare it with the spine timestamp on every row. One row where the feature timestamp is later than the spine timestamp proves leakage. Row counts and refresh schedules say nothing about which past row a label saw. Passing EVENT_TS as the spine column compares feature time with itself.
“include the timestamp column from the feature view by setting include_feature_view_timestamp_col”Source: docs.snowflake.com
Sources1
5.Freezing a checked training set as a Dataset
A leakage-checked training set is only reproducible if you materialize it in a form that cannot change. Managed feature views keep refreshing from new source data. Rerunning the same generate_training_set call in three months can therefore return different values, because the inputs to the lookup will have changed. Saving the query text does not freeze the data.
| Output | How you get it | Fixed for later retraining? |
|---|---|---|
| Snowpark DataFrame | generate_training_set without save_as | No: ephemeral, not materialized |
| Table | generate_training_set with save_as | No: immutability not guaranteed, limited metadata |
| Snowflake Dataset | generate_dataset with name and version | Yes: immutable, file-based snapshot |
generate_dataset takes the same spine and timestamp arguments plus a required name and an optional version, and it always materializes the result. The output is a Snowflake Dataset (a versioned, immutable snapshot). An auditor's "retrain on exactly the same rows" request then comes down to reading that version again.
dataset: Dataset = fs.generate_dataset(
name="MY_DATASET",
spine_df=MySourceDataFrame,
features=[registered_fv],
version="v1", # optional
spine_timestamp_col="TS", # optional
spine_label_cols=["LABEL1", "LABEL2"], # optional
include_feature_view_timestamp_col=False, # optional
desc="my new dataset", # optional
)Registering a new feature view version after every refresh does not solve this. Feature view versions exist for changed definitions: features and columns cannot be modified in place, so a new version is how you change them. A new version does not snapshot data. The Dataset version is the snapshot.
Checkpoint 7 of 8· Match them up
An auditor may later ask you to retrain on exactly the same rows. Match each way of producing or versioning the training data to what it actually gives you.
Tap a term, then the definition that fits it.
Only a Snowflake Dataset from generate_dataset is an immutable snapshot, so retraining on the same rows means reading that version again. A save_as table is materialized but can still change. A feature view version captures a changed definition, not the data.
“Materialized tables currently don’t guarantee immutability and have limited metadata support. If you require these features, consider using Snowflake Datasets instead.”Source: docs.snowflake.com
Checkpoint 8 of 8· Exam question
An auditor asks a team to retrain a fraud model three months from now on exactly the same training rows. The feature views are managed and keep refreshing from new source data. What should the team do when producing the training data today?
Correct answer: B — Call fs.generate_dataset with a name and version so the result is materialized as an immutable, versioned Snowflake Dataset
- A. Incorrect. The query is only a definition. Managed feature views are refreshed in place, so rerunning later reads different underlying data, and restated or backfilled rows can change results.
- B. Correct. A Dataset stores a materialized snapshot of the training data under a version, so the exact rows can be reloaded later regardless of what the feature views have since refreshed.
- C. Incorrect. Time Travel retention is bounded, costs storage, and reproduces a table state, not the specific training join. It is not designed as a reproducibility record for training data.
- D. Incorrect. Feature view versions identify feature definitions, not data snapshots. Creating one per refresh multiplies objects and still leaves each version's data changing as it refreshes.
Sources
(4)
Every claim above is drawn from one of these pages, quoted as it was written on the date shown.
- 1.
“Requested features are retrieved for the list of entity IDs, with point-in-time correctness with respect to the provided time stamp.”
↩︎ Why a training set needs a timestamp on every row“For time-series features, provide the timestamp column name to automate the point-in-time feature value lookup.”
↩︎ Calling generate_training_set without leaking“include the timestamp column from the feature view by setting include_feature_view_timestamp_col”
↩︎ Proving that no future values leaked in“Snowflake Datasets provide an immutable, file-based snapshot of data, which helps to ensure model reproducibility”
↩︎ Freezing a checked training set as a Dataset“Requested features are retrieved for the list of entity IDs, with point-in-time correctness with respect to the provided time stamp.”
↩︎ Exam trap 1“Materialized tables currently don’t guarantee immutability and have limited metadata support.”
↩︎ Exam trap 2“Materialized tables currently don’t guarantee immutability and have limited metadata support. If you require these features, consider using Snowflake Datasets instead.”
↩︎ Checkpoint - 2.
“A timestamp column name is required if your feature view includes time-series features.”
↩︎ Why a training set needs a timestamp on every row“Feature definitions and columns cannot be modified. To change the features in a feature store, create a new version of the feature view.”
↩︎ Freezing a checked training set as a Dataset - 3.
“Backfill and point-in-time correct features with ASOF JOIN”
↩︎ How the ASOF join picks each feature value - 4.https://docs.snowflake.com/en/developer-guide/snowflake-ml/feature-store/advanced-feature-engineeringOfficial docs
“preventing future data from leaking into the model”
↩︎ How the ASOF join picks each feature value“selects the most recent snapshot row for each entity key at or before the spine timestamp”
↩︎ Key concept“selects the most recent snapshot row for each entity key at or before the spine timestamp”
↩︎ Prediction