<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Issam Hammi on Medium]]></title>
        <description><![CDATA[Stories by Issam Hammi on Medium]]></description>
        <link>https://medium.com/@issam.hammi?source=rss-750b727f5c20------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*dmbNkD5D-u45r44go_cf0g.png</url>
            <title>Stories by Issam Hammi on Medium</title>
            <link>https://medium.com/@issam.hammi?source=rss-750b727f5c20------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 22:05:30 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@issam.hammi/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Serving features efficiently for online inference with Fast Feature Store]]></title>
            <link>https://medium.com/amex-gbt-technology/serving-features-efficiently-for-online-inference-with-fast-feature-store-5a1f26c61e8a?source=rss-750b727f5c20------2</link>
            <guid isPermaLink="false">https://medium.com/p/5a1f26c61e8a</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[mlops]]></category>
            <category><![CDATA[ai-ml-platform]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[ml-platform]]></category>
            <dc:creator><![CDATA[Issam Hammi]]></dc:creator>
            <pubDate>Wed, 01 Apr 2026 10:13:25 GMT</pubDate>
            <atom:updated>2026-04-01T10:13:25.594Z</atom:updated>
            <content:encoded><![CDATA[<h3>Part 2 New solution: Fast Feature Store</h3><h3>Introduction</h3><p><a href="https://medium.com/amex-gbt-technology/serving-features-efficiently-for-online-inference-with-fast-feature-store-part-1-8992fdce2eb4">In Part one</a> of this series, you learned about our use cases and the limitations with the online feature store solutions. Now, in Part two , you’ll get to know our in-house online feature store, starting with the list of requirements for this new solution.</p><h3>Requirements</h3><p>Given the limitations we faced in previous use cases introduced in Part one, we decided to design a new solution. Our goal was to build something that would give us more management over the features being served to the models. Our requirements included:</p><ul><li><strong>Improved latency:</strong> We believed we could have better response times if we were using a different storage in addition to less limitations by the AWS API when fetching features.</li><li><strong>Cost optimization:</strong> A Hotel Ranking AI System solution would only work if we had a large instance to store all the features in-memory. If we found a less restrictive storage than Sagemaker feature store, we could potentially use a smaller instance for the inference and save money.</li><li><strong>Minimal code change on inference code</strong>: Migrating from one solution to another is always tricky and would consume Machine Learning engineer bandwidth. So we wanted the changes to be as minimal as possible.</li></ul><h3>High-level architecture</h3><p>After several grooming sessions, we decided to go with an architecture that would allow us to reuse existing components and iterate quickly.</p><figure><img alt="High-level architecture. The data is transferred from the offline feature store into Redis, then served by Fast-Feature-Store to the AI Systems." src="https://cdn-images-1.medium.com/max/1024/1*CMzq6BEe7GjI1W5HZ2ooIw.png" /><figcaption>Figure 1: High-level architecture. The data is transferred from the offline feature store into Redis, then served by Fast-Feature-Store to the AI Systems.</figcaption></figure><p>We can distinguish two main phases: the ingestion and the serving part. While the ingestion is similar to what we had previously with Sagemaker, the serving is quite different since we’re now introducing a new service in the middle.</p><h4>Ingestion mechanism</h4><p>This part has not changed with the move to the Fast Feature (FFS) store; Machine Learning Engineers write the job that’s scheduled by Airflow and runs on Kubernetes.</p><p>Instead of ingesting into the Sagemaker feature store, the data is directed to the new online store. Later in this article we’ll discuss the challenges of ingesting data into Redis.</p><h4>FastAPI service</h4><p>We considered having a library which allowed the inference services to call ElastiCache directly. Although it would have been an appealing solution, we appreciated having a service in the middle to enable more management and flexibility for potential future scenarios.</p><p>We were comfortable with Python and FastAPI but we were concerned by the expected traffic. For peace of mind, we did a series of tests detailed later in this article.</p><h3>Road to production</h3><h4>First POC</h4><p>For the first POC, we wanted to validate the approach as fast as possible. So, we deployed a very first version of Fast Feature Store with Redis running as a side car. An init container was added to load the data into Redis at the startup of the Pod.</p><p>We then deployed a Flight Ranking AI System Sagemaker endpoint calling FFS. This endpoint was set to receive shadow test traffic. We measured response times against the equivalent of the Flight Ranking AI System using the Sagemaker Feature Store, and measured a reduction of response times by 60%.</p><figure><img alt="Architecture of the first version of the Fast Feature Store" src="https://cdn-images-1.medium.com/max/839/1*VjUdSsEeGbguk5J4WCvlIw.png" /><figcaption>Figure 2: Architecture of the first version of the Fast Feature Store.</figcaption></figure><h4>Moving to Redis</h4><p>We considered several options for the online feature store. Given our requirements, we limited ourselves to solutions that would offer minimal latency for read operations with scaling capabilities.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/812/1*qTxXewnaVXZucdzfFWqxCg.png" /></figure><p><a href="https://redis.io/docs/latest/develop/data-types/hashes/"><em>Link to Redis hashes documentation.</em></a></p><p>To minimize operational costs, we finally opted for <strong>Elasticache for Redis.</strong></p><h4>Breaking Redis</h4><p>After the success of POC using Flight Ranking AI System features with fast-feature-store, we discovered a new challenge: ingesting hotel ranking features. Loading flight ranking feature data into Redis was a straightforward process:</p><p>1. Create a <a href="https://redis.io/docs/latest/develop/data-types/hashes/">redis hash</a> for each feature.</p><p>2. Run “<strong>HSET feature-group:feature key value”</strong> for each key-value pair for a given feature.</p><p>3. Repeat both steps until all data is ingested into Redis.</p><p>This approach worked well for Flight Ranking AI System, but there’s a significant gap between the number of features for flight and hotel. Flight Ranking AI System has tens of feature groups split across different points of sale, and the largest feature set for Flight Ranking AI System has a few million rows. Hotel Ranking AI System has few feature groups globally, and the largest feature set is way bigger with tens of millions of rows. Redis is perfectly capable of handling data sets of this size — <em>if </em>the data is structured in a sane way.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/468/1*NnF3YZLnaQONZ0Q3wl5VCw.png" /><figcaption>Figure 3: Example of Flight Ranking AI System feature data storage in Redis.</figcaption></figure><p>Scaling a Redis cluster could be an entire blog post of its own but for our purposes, the core idea is that any given hash key is assigned a <em>slot </em>in Redis. Redis has <a href="https://redis.io/docs/latest/operate/oss_and_stack/reference/cluster-spec/#key-distribution-model">16,384 hash slots</a> available, and the slot number is calculated by taking the CRC16 of the hash key modulo 16384. This means that a pair of feature groups with a feature containing tens of millions of key-value pairs will all be stored in a single Redis slot because their CRC16 hash remains constant.</p><p>However, a dataset of this size exceeds the capacity of a single Redis slot backed by a single shard in our chosen cluster topology. The solution to this was to refactor the hotel data set to have a unique hash, not just for each feature, but for each feature <em>and </em>a unique key for the given data set. Most of the hotel feature data uses composite keys for a feature.</p><p>For example, consider the following feature value:</p><pre>user: &quot;u_7755&quot;<br>hotel: &quot;h_123456&quot;<br>hotel_rating: excellent</pre><p>Previously, the hash key would have been <strong>hotel_user:hotel_rating</strong>, with a composite key of <strong>(“u_7755”, “h_123456”)</strong> and a value of excellent.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/468/1*QpH75RssJ78l6c_gIbggKw.png" /><figcaption>Figure 4: Example of Hotel Ranking AI System feature data storage in Redis.</figcaption></figure><p>Now, the hash key is <strong>hotel_user:hotel_rating:u_7755</strong> with a single key of <strong>h_123456 </strong>and a value of <strong>excellent</strong>. This is a simple change to make, and it allowed all rows of hotel data to evenly spread out across all shards and replicas in our Redis clusters.</p><p>The choice of having the user id as part of the hash name and not the hotel id is not random. While we can request multiple keys of a hash in the same request (HGET), we cannot request multiple hashes at once. Since we’re retrieving features for multiple hotels for the same user, we’ve decided to have the user id as part of the key and not the opposite.</p><h4>Bulk feature ingestion</h4><p>With this challenge out of the way, the next obstacle we discovered was reliably ingesting substantial amounts of data into Redis. You won’t be surprised to learn that sending an HSET command to a remote Redis cluster, waiting for an acknowledgement, and wrapping this in a for-loop that iterates tens of million times, is not a reliable process. At best, it’s inefficient. At worst, feature ingestion would mysteriously fail without any meaningful error messages to troubleshoot.</p><p>Bulk ingestion is a common use case for Redis. <a href="https://redis.io/docs/latest/develop/clients/patterns/bulk-loading/">Two approaches are recommended</a> for bulk ingestion of data: command-line pipes, and pipelines. We initially tested the first approach, but since our feature ingestion code was all in Python, we’d have to execute external <strong>redis-cli</strong> commands via <a href="https://docs.python.org/3/library/subprocess.html#subprocess.run">subprocess.run.</a> This is both <em>ugly </em>and very clunky to handle in Python code.</p><p>Instead, we implemented <a href="https://redis-py-cluster.readthedocs.io/en/stable/pipelines.html">Redis pipelines</a>. Rather than sending one Redis command at a time, a Redis pipeline object is created. Individual HSET commands are assembled in batches, and then the pipeline is executed to send one individual command. In our testing, splitting our feature data into batches of 100k records at a time (or “chunks”) proved reliable and performant enough for our use case. Implementing Redis pipelines improved Hotel Ranking AI System feature ingestion time by around 20%, and it allowed ingestion of hotel features to <em>work </em>consistently every time.</p><h4>FFS performance and validation</h4><p><strong>Stress testing before going real</strong><br>Since fast-feature-store is a brand-new service, we had no historical data we could use to figure out how to use fast-feature-store when under heavy traffic. Instead, we used <a href="https://grafana.com/docs/k6/latest/">k6</a> — a lightweight, open-source tool that can, among other things, perform synthetic load testing. One test scenario that k6 supports is <a href="https://grafana.com/blog/2024/01/30/breakpoint-testing/">breakpoint testing</a>. This is a suitable way to discover performance bottlenecks in an application by slowly increasing load until the application begins to fail. When that happens, looking at application utilization metrics (such as CPU, network, etc.) will give you an idea on what metric to use to expand your application when under load.</p><p>To simulate load with actual data, we wrote a CICD pipeline that will collect a large, random assortment of features directly from Redis, store it as a JSON blob, and then use random entries from this payload to query fast-feature-store with actual, real-world values.</p><p>This worked great in limited tests, but we soon found that our k6 pods would quickly run out of memory during longer tests. Creating copies of our large JSON payloads for each k6 worker process caused the k6 pods to run out of memory but k6 has a feature to address this very problem: the <a href="https://k6.io/docs/examples/data-parameterization/#performance-implications-of-sharedarray">SharedArray data type</a>. This lets you load your test payload into memory space that’s shared amongst all k6 workers to prevent having multiple copies of the test payload in-memory at once.</p><p>And the result of several days of fast-feature-store stress testing? We are CPU-bound. This makes sense, as fast-feature-store is a Python application using FastAPI, and stores little in-memory. Since fast-feature-store runs on Kubernetes, we were able to simply enable horizontal pod autoscaling when CPU usage across all pods is over 90%.</p><p><strong>The impact on deployed models<br></strong>To assess the performance of FFS on real data, we deployed Flight Ranking AI System and Hotel Ranking AI System in production to receive shadow traffic (the responses were not made available to the customers). The only difference between the applications receiving live traffic and shadow traffic, was the feature store they were pointing to. We could then compare response times between the two versions for the same requests.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x2lkav0-lbWYRkE3g3SGng.png" /><figcaption>Figure 5: Using the shadow testing framework to test Fast Feature Store with production traffic</figcaption></figure><figure><img alt="Flight Ranking AI System response times comparison." src="https://cdn-images-1.medium.com/max/704/1*sVAwVseoU4KZdC6r5fnsyQ.png" /><figcaption>Flight Ranking AI System response times comparison.</figcaption></figure><figure><img alt="Hotel Ranking AI System response times comparison." src="https://cdn-images-1.medium.com/max/704/1*Fy7Wbxdt6S-G9MdPSU1sLA.png" /><figcaption>Hotel Ranking AI System response times comparison.</figcaption></figure><p>As expected, inference time was faster for Flight Ranking AI System thanks to Fast Feature Store, but longer for Hotel AI System since the features were stored in the internal memory of the machine running the model. Now there were an API call to retrieve the features from an external location.</p><p>The last verification step before rolling out the Fast Feature store was to make sure it has no impact on how the model behaves. In other words, predictions must be independent from the feature store solution.</p><p>To verify, we compared the live model (having the previous feature store version) responses with the shadow model responses. For Hotel Ranking AI System, 100% of hotels had the same score with both versions in a lab environment. And for Flight Ranking AI System, more than 99% of flights had the same score in prod environment. That’s because we noticed some keys were still in the Sagemaker feature store even if they weren’t anymore in the offline feature store.</p><h4>Cost comparison before vs after</h4><p>Let’s do a comparison for production costs based on Amazon public pricing.</p><p><strong>Sagemaker endpoint costs<br></strong>For endpoint costs, it’s worth comparing the Hotel Ranking AI System since it’s the only case where the instance type has been changed.</p><p>For the Hotel Ranking AI System, we could change from ml.r5.4xlarge instances to ml.m5.large, and saving 90% on Sagemaker endpoint costs.</p><p>Overall, we noticed cost reductions of 61% for the whole system: Old Sagemaker instances + Sagemaker Feature Store (for Flight Ranking AI System) or In-memory feature store (for Hotel Ranking AI System) vs New Sagemaker Instances + Fast Feature Store Kubernetes Pods + Redis. <a href="http://medium.com/amex-gbt-technology/transforming-our-costs-migrating-our-ml-model-serving-infrastructure-from-aws-sagemaker-to-f17864713a42">Here</a> we talk how we reduced even more our costs by using Kubernetes to host our inference engines.</p><h3>The future</h3><p>Relying on the Fast Feature store is a big leap forward. It gives us much more flexibility and opens doors for more advanced patterns.</p><h4>A/B testing of features</h4><p>A/B testing is a request that’s been asked several times where ML engineers were interested in evaluating the impact of two different versions of the same feature on live traffic. We can potentially enable that feature by having fast-feature-store as a service in the middle between the inference code and the feature storage.</p><h4>Better monitoring</h4><p>Although Sagemaker allows exploring their feature store through Athena for example, we experienced lots of difficulties knowing what features were used for a specific inference request in production. We now have full management over the data being served and have logs in Datadog. However, we’ll potentially utilize our Data Lake to improve features and overall prediction scores.</p><h4>Real-time and streaming</h4><p>Imagine the following use case, a user on the Amex GBT Egencia website is struggling to complete their checkout.</p><p>We have some information about the user in our feature store, such as:</p><ul><li>The number of past bookings.</li><li>Their role in the company.</li></ul><p>But we could potentially complement them through a mechanism that would retrieve live information such as:</p><ul><li>Time spent on the checkout page.</li><li>Number of errors.</li><li>Type of errors.</li></ul><figure><img alt="Near real-time feature engineering." src="https://cdn-images-1.medium.com/max/884/1*iojpWPcnnEv35kmVhPj87w.png" /><figcaption>Figure 6: Near real-time feature engineering.</figcaption></figure><p>The feature store would contain all the information required by a machine learning model to determine the next action, such as: ‘open the chatbot’, ‘suggest different values for mandatory fields based on past bookings’.</p><p>To achieve that state, we’d need to build a complicated infrastructure relying on technologies such as Apache Flink to process streaming data.</p><figure><img alt="Streaming data processing." src="https://cdn-images-1.medium.com/max/1024/1*zLLSZzlw8aGw0W3vG4kd0w.png" /><figcaption>Figure 7: Streaming data processing.</figcaption></figure><p>Although this is quite advanced and probably not needed as of now, it could be interesting to keep that pattern in mind and feed live data to Elasticache for live inference.</p><h4>Offline Feature Store</h4><p>We often refer to the training store described in the first part of this article as an offline store. It would probably be our next big step as a well-defined offline store which would bring:</p><ul><li><strong>Features lineage and reusability</strong>: The offline store preserves the feature lineage, providing a clear audit trail of how features were derived from raw data. This traceability is crucial for maintaining transparency and reproducibility in ML projects. Additionally, by storing features, the offline store facilitates the reuse of these features across different models and projects within the organization promoting efficiency and consistency.</li><li><strong>Consistency</strong>: Making sure the features used in model training match those in production. Offline feature stores bridge the gap between offline development and online deployment, promoting consistency and reliability.</li><li><strong>Efficiency and time savings</strong>: By streamlining the creation and maintenance of features, offline feature stores save considerable time and resources, allowing data scientists and machine learning engineers to focus on more involved aspects of their work.</li></ul><p>Feature engineering needs its own article. So,<strong> </strong>an<strong> article on how the offline feature store is fully integrated with our Data Lake is coming soon.</strong></p><h3>Conclusion</h3><p>On this project we managed to fulfil many goals:</p><ul><li>Cost reduction: 61%.</li><li>No significant performance impact: For Hotel Sort (as expected, extremely hard to beat an in-memory feature store) we had some impact on the performance. This impact was considered acceptable by stakeholders. For Flight Ranking AI System, we managed to improve performance by 65%.</li><li>Flexibility: We’re now free to use the database we want. Today we’re using Redis OSS, but can change to any alternative if we find a better one.</li><li>Extensibility: We’ll be able to implement feature such as A/B testing of features as requested by Machine Learning Engineers.</li><li>Flexibility: The new service allows us to expand seamlessly and support any number of clients, without the fixed request limits of previous solutions.</li></ul><p>This project successfully delivered on all fronts: cost savings, acceptable performance, and enhanced flexibility. The new architecture gives us the freedom to choose our storage layer, enables advanced ML capabilities, and removes previous growth constraints — allowing us to support any number of clients. We’re now equipped to grow confidently and adapt as your needs evolve.</p><h3><strong>Sources</strong></h3><p><a href="https://www.hopsworks.ai/dictionary/feature">https://www.hopsworks.ai/dictionary/feature</a></p><p><a href="https://mitsloan.mit.edu/ideas-made-to-matter/machine-learning-explained">https://mitsloan.mit.edu/ideas-made-to-matter/machine-learning-explained</a></p><p><a href="https://cogitotech.medium.com/what-are-features-in-machine-learning-and-why-it-is-important-e72f9905b54d">https://cogitotech.medium.com/what-are-features-in-machine-learning-and-why-it-is-important-e72f9905b54d</a></p><p><a href="https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_FeatureGroup.html">https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_FeatureGroup.html</a></p><p><a href="https://www.featurestore.org/what-is-a-feature-store">https://www.featurestore.org/what-is-a-feature-store</a></p><p><a href="https://www.featureform.com/post/feature-stores-explained-the-three-common-architectures">https://www.featureform.com/post/feature-stores-explained-the-three-common-architectures</a></p><p><a href="https://redis.io/docs/latest/operate/oss_and_stack/management/scaling/">https://redis.io/docs/latest/operate/oss_and_stack/management/scaling/</a></p><p><a href="https://redis.io/docs/latest/develop/use/patterns/bulk-loading/">https://redis.io/docs/latest/develop/use/patterns/bulk-loading/</a></p><p><a href="https://grafana.com/docs/k6/latest/">https://grafana.com/docs/k6/latest/</a></p><p><a href="https://huyenchip.com/2022/08/03/stream-processing-for-data-scientists.html">https://huyenchip.com/2022/08/03/stream-processing-for-data-scientists.html</a></p><p><a href="https://aws.amazon.com/elasticache/pricing/">https://aws.amazon.com/elasticache/pricing/</a></p><p><a href="https://aws.amazon.com/sagemaker/pricing/">https://aws.amazon.com/sagemaker/pricing/</a></p><p><em>This article represents the personal perspectives of the author and should not be considered an official statement, endorsement, or position of GBT or its affiliates.</em></p><p><em>American Express and certain associated logos are trademarks of American Express, used in approved formats by GBT Travel Services UK Limited and its authorized sublicensees pursuant to a limited license. American Express holds a minority interest in Global Business Travel Group, Inc. (NYSE: GBTG), which operates as a separate company from American Express.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5a1f26c61e8a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/amex-gbt-technology/serving-features-efficiently-for-online-inference-with-fast-feature-store-5a1f26c61e8a">Serving features efficiently for online inference with Fast Feature Store</a> was originally published in <a href="https://medium.com/amex-gbt-technology">Amex GBT technology</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>