docs/blog/faster-feature-transformations-in-feast.md
December 5, 2024 | Francisco Javier Arceo, Shuchu Han
Thank you to Shuchu Han, Ross Briden, Ankit Nadig, and the folks at Affirm for inspiring this work and creating an initial proof of concept.
Feature engineering is at the core of building high-performance machine learning models. The Feast team has introduced two major enhancements to On Demand Feature Views (ODFVs), pushing the boundaries of efficiency and flexibility for data scientists and engineers. Here's a closer look at these exciting updates:
Traditionally, transformations in ODFVs were limited to Pandas-based operations. While powerful, Pandas transformations can be computationally expensive for certain use cases. Feast now introduces Native Python Mode, a feature that allows users to write transformations using pure Python.
Key benefits of Native Python Mode include:
Using the cProfile library and snakeviz we were able to profile the runtime for the ODFV transformation using both Pandas and Native python and observed a nearly 10x reduction in speed.
Until now, ODFVs operated solely as transformations on reads, applying logic during online feature retrieval. While this ensured flexibility, it sometimes came at the cost of increased latency during retrieval. Feast now supports transformations on writes, enabling users to apply transformations during data ingestion and store the transformed features in the online store.
Why does this matter?
Here's an example of applying transformations during ingestion:
@on_demand_feature_view(
sources=[driver_hourly_stats_view],
)
df = pd.DataFrame()
df["conv_rate_adjusted"] = features_df["conv_rate"] * 1.1
return df
With this new capability, data engineers can optimize online retrieval performance without sacrificing the flexibility of on-demand transformations.
These enhancements bring ODFVs closer to the goal of seamless feature engineering at scale. By combining high-speed Python-based transformations with the ability to optimize retrieval latency, Feast empowers teams to build more efficient, responsive, and production-ready feature pipelines.
For more detailed examples and use cases, check out the documentation for On Demand Feature Views. Whether you're a data scientist prototyping features or an engineer optimizing a production system, the new ODFV capabilities offer the tools you need to succeed.
The future of Feature Transformations in Feast will be to unify feature transformations and feature views to allow for a simpler API. If you have thoughts or interest in giving feedback to the maintainers, feel free to comment directly on the GitHub Issue or in the RFC.