Feature Versioning and Lineage
What You'll Learn
You'll learn how to track feature definitions over time and trace which features were used to train and serve specific model versions—critical for debugging, auditing, and reproducibility.
Why Feature Versioning Matters
Imagine you deploy a model to production, and six months later its performance degrades. Was it data drift, or did someone change how a feature is calculated? Without feature versioning, you're flying blind.
Feature definitions evolve: business logic changes, bugs get fixed, or new data sources become available. Each change creates a new "version" of a feature, even if it has the same name. Tracking these versions ensures you can:
- Reproduce past predictions exactly as they were made
- Debug model degradation by identifying feature definition changes
- Audit compliance by proving which data went into which model
What is Feature Lineage?
Feature lineage traces the complete history of a feature from raw data sources through transformations to the final feature values consumed by a model. It answers:
- Which raw tables/columns created this feature?
- What transformation code was applied (and which version)?
- Which models consumed this feature version?
Think of it like a family tree: every feature has "parents" (source data) and "children" (models that use it), with the transformation logic as the connecting DNA.
How It Works in Practice
Feature stores maintain metadata linking:
- Feature name + version → transformation code commit hash
- Model version → specific feature versions used during training
- Timestamp → feature definition active at that time
When you register a feature like user_avg_purchase_amount_v2, the store records the SQL query or Python function, its dependencies, and a unique version identifier. When you train a model, it logs exactly which feature versions were retrieved.
Key Takeaway: Feature versioning and lineage create an audit trail that links data sources, transformation logic, feature values, and models—enabling true reproducibility and faster debugging when models behave unexpectedly.