Use case AI/ML real-time như phòng chống gian lận và recommendation đang trending, và feature store đóng vai trò then chốt triển khai thành công ra production. Theo feature store open source phổ biến Feast, một câu hỏi thường gặp nhất trong community Slack là: Feast scalable/performant như thế nào? Vì đặc tính quan trọng nhất của feature store cho AI/ML real-time là tốc độ serving feature từ online store đến ML model cho prediction/scoring online. Feature store thành công đáp ứng yêu cầu latency khắt khe (đo bằng milliseconds), nhất quán (p99) và ở quy mô lớn (lên đến hàng triệu query/giây, dataset gigabytes đến terabytes) đồng thời giữ total cost of ownership thấp và accuracy cao.
Như chúng ta sẽ thấy, lựa chọn online feature store và kiến trúc feature store đóng vai trò quan trọng quyết định performance và cost-effectiveness. Không ngạc nhiên công ty thường benchmark kỹ lưỡng trước khi chọn online feature store để xem kiến trúc hoặc store nào performant và cost-effective nhất. Bài viết review kiến trúc và benchmark từ feature store DIY do công ty xây dựng thành công cho use case AI/ML real-time, cũng như feature store open source và commercial. Bắt đầu nào.
1. Open Source Feast
Xem benchmark data và kiến trúc dữ liệu của Feast open source feature store. Feast gần đây benchmark so sánh feature serving latency dùng online store khác nhau (Redis vs Google Cloud DataStore vs AWS DynamoDB). Cũng so sánh tốc độ các mechanism trích xuất feature (Java gRPC server, Python HTTP server, lambda function, v.v.). Xem full benchmark setup và kết quả ở bài blog này. Kết luận: Feast performant nhất dùng Java gRPC server và Redis làm online store.
Sơ đồ trên minh họa cách Better.com (công ty mortgage online) triển khai lead scoring ranking system dùng Feast open source. Như Vitaly Sergey, Senior Software Engineer tại Better.com trình bày, feature được materialized từ offline store (S3, Snowflake, Redshift) sang online store (Redis). Ngoài ra, feature cũng ingest vào online store từ streaming source (Kafka topics). Feast mới thêm support streaming data sources (bên cạnh batch) hiện chỉ support cho Redis. Support streaming rất quan trọng cho AI/ML real-time vì dùng dữ liệu live fresh.
Ví dụ use case lead scoring Better.com: lead mới ingest liên tục trong ngày. Feature từ nhiều nguồn khác nhau, cả entity (lead) và feature dùng scoring đều update liên tục, lead được rank và re-rank. Ngay khi lead mới ingest, nó được score bởi model. Cùng lúc ingest vào online store, có thể muốn re-rank ngay sau. Lead Better.com hết hạn sau 48h, implement trong Redis online store bằng cách set TTL 48h, expire entity (lead) và feature vector liên quan sau 48h. Feature store tự dọn dẹp, không còn entity/feature cũ chiếm storage online quý giá.
Triển khai Feast thú vị khác là Microsoft Azure Feature Store. Xem kiến trúc tại đây. Chạy trên Azure cloud tối ưu low latency AI/ML real-time, support batch và streaming source, tích hợp Azure Data & AI ecosystem. Feature ingest vào online store từ batch source (Azure Synapse Serverless SQL, Azure Storage/ADLS) và streaming source (Azure Event Hub). Nếu đã deploy trên Azure hoặc quen ecosystem Azure, feature store này có thể phù hợp. Online store dùng Azure Cache for Redis, với Enterprise Tiers của Azure Redis bao gồm Active-Active Geo-Duplication tạo cache phân phối toàn cầu với availability 99.999%. Thêm vào đó, giảm cost thêm bằng Enterprise Flash tier chạy Redis trên kiến trúc tiered memory dùng cả in-memory (DRAM) và Flash (NVMe/SSD).
2. Wix DIY Feature Store – Nền tảng MLOps
Dưới đây kiến trúc khác triển khai AI/ML real-time. Là feature store architecture của platform xây dựng website phổ biến Wix. Dùng cho use case real-time: recommendation, churn/premium prediction, ranking, spam classifier. Wix serve 200M+ registered users trong đó chỉ một phần nhỏ là 'active users' tại bất kỳ thời điểm nào. Điều này ảnh hưởng lớn cách implement feature store. Hãy xem.
Thông tin dưới dựa trên TechTalk của Ran Romano khi ông dẫn dắt ML Engineering tại Wix. Trên 90% data trong Wix feature store là clickstream và ML model trigger per website hoặc per user. Ran giải thích cho real-time use case, latency là vấn đề lớn. Cũng có production use case cần trích xuất feature vector trong milliseconds.
Raw data lưu trong file Parquet trên AWS S3 bucket, partitioned by business unit (editors, restaurants, bookings, v.v.) rồi by date. Là phần của Wix data platform dùng bởi data analyst trước Wix ML Platform nhiều năm. Trong quy trình daily build batch dùng Spark, SQL (mất phút đến giờ) trích xuất history feature của user từ S3, pivot và aggregate by user, ingest vào offline store (Apache Hbase). Cung cấp lookup 'by user' nhanh hơn nhiều cho history user. Khi system detect user đang active, quy trình 'warmup' trigger và feature user đó load vào online store (Redis) nhỏ hơn offline store vì chỉ hold history của active user. Warmup process mất vài giây. Cuối cùng, feature trong online feature store liên tục update bằng real-time data fresh trực tiếp từ streaming source per event từ user (dùng Apache Storm).
Kiến trúc này có tỷ lệ write/read thấp hơn Feast, rất hiệu quả về materialization và online storage vì chỉ lưu feature active user thay vì tất cả user. Vì active user chỉ chiếm phần nhỏ registered user Wix, tiết kiệm lớn. Tuy nhiên có giá phải trả. Dù retrieve feature từ online store rất nhanh, trong milliseconds, chỉ khi feature đã có trong online store. Do race condition, warmup mất vài giây, không kịp load feature khi user vừa active. Scoring/prediction cho user đó sẽ fail. OK miễn use case không phải critical flow hoặc mission-critical như approve transaction hoặc prevent fraud. Kiến trúc này cũng rất specific Wix, nơi chỉ phần nhỏ user active tại một thời điểm.
3. Commercial Feature Store Tecton
Xem kiến trúc commercial enterprise feature store Tecton. Như sơ đồ dưới, bên cạnh batch và streaming data source, Tecton support 'out-of-the-box' real-time data source. Gọi là 'real-time features' hoặc 'real-time' transformations. Real-time feature chỉ tính tại inference request. Ví dụ chênh lệch size giao dịch nghi ngờ và last transaction size. Với Better.com dùng Feast open source, Better.com tự develop support real-time feature. Với Tecton, dễ implement hơn vì native support. Giống Feast và Wix, Tecton định nghĩa feature trong registry để logical definition định nghĩa một lần cho cả offline và online store. Giảm đáng kể training-serving skew đảm bảo accuracy cao của ML model cả production.
Về lựa chọn offline store, online store, benchmark: offline feature store Tecton support S3, online store Tecton offer choice giữa DynamoDB và Redis Enterprise Cloud. Trong presentation gần đây, Tecton CTO Kevin Stumpf chia sẻ tips chọn online feature store dựa trên benchmark công ty thực hiện. Bên cạnh benchmark latency và throughput, Tecton benchmark cost online store. Tại sao quan trọng? Với use case high throughput hoặc low latency, cost online store có thể là phần lớn total cost of ownership của cả MLOps platform, tiết kiệm cost rất substantial.
Kết luận benchmark Tecton: với use case high throughput typical cho user Tecton, Redis Enterprise nhanh 3x và ít tốn kém 14x so với DynamoDB.
Catch là gì? Nếu chỉ một use case, không high/consistent throughput, không strict latency requirement, có thể dùng DynamoDB. Xem full details và kết quả benchmark Tecton tại đây.
4. Lightricks dùng Commercial Feature Store Qwak
Ví dụ feature store architecture khác. Lightricks dùng, dựa trên commercial feature store Qwak. Lightricks là unicorn develop mobile app edit video/ảnh, nổi bật app selfie-editing Facetune. Dùng feature store cho recommendation system.
Như sơ đồ, giống Tecton, Qwak support ba loại feature source – batch, streaming, real-time feature.
Lưu ý quan trọng: với Qwak, materialization feature vào feature store thực hiện trực tiếp từ raw data source cho cả offline store (Parquet trên S3) và online store (Redis). Khác so với Feast, Wix, Tecton – materialization online store từ offline store sang online store cho batch source. Ưu điểm: không chỉ transformation logic feature unified across training/serving (như Feast, Wix, Tecton), mà actual transformation/computation feature cũng done uniformly, giảm thêm training-serving skew. Unified data pipeline offline/online trực tiếp từ raw data có potential đảm bảo accuracy cao hơn production. Xem thêm kiến trúc Qwak tại presentation này.
Tóm tắt
Bài viết review highlight benchmark và kiến trúc một số feature store cho AI/ML real-time. Thứ nhất Open Source Feast, thứ hai DIY Wix, thứ ba Tecton, thứ tư Qwak. Cũng review highlight benchmark các công ty làm để xem online store nào performant và cost-effective nhất. Khám phá mechanism/feature server nào dùng trích xuất feature từ online store. Thấy sự khác biệt lớn performance và cost của feature store tùy architecture, loại feature support, component chọn.
Originally published in KDnuggets.