Building Recommendation Systems Using Generative AI and Amazon Personalize

Artificial Intelligence & MLOps

In this blog, learn how Generative AI augmented recommendation systems can improve the quality of customer interactions and produce higher quality data to train analytical ML models, taking personalized customer experiences to the next level.

Generative AI has a broad variety of use cases and this is precisely why it is being adopted widely and is rapidly transforming many sectors. However, its application in many areas remains unclear. 

We have worked with numerous customers across industries like retail, SaaS, finance and more to determine avenues to generate value with Generative AI. In some circumstances, Generative AI can even augment data analytics capabilities that are generally approached with traditional AI and machine learning technologies.

In this blog, we will discuss a project we conducted with a confidential client, in which we developed a proof of concept (PoC) to test the use of GenAI in recommendation systems. Spoiler alert: the concept was actually unproven, and surprisingly, that was great news. 

We will explore how GenAI enhances traditional recommendation systems, ponder the benefits and challenges, and provide an overview of how GenAI will set new benchmarks for personalized services.

First, let's look at how we conducted the PoC.

PoC: Personalized Promotions and Customer Experiences

Understanding the Context

In the current digital marketplace, the demand for personalized customer experiences has never been higher. So, the client wanted to adopt GenAI as the core of their recommendation platform to find new data patterns, improve recommendation quality, and develop new product offerings, as traditional promotional strategies often lack the targeted engagement necessary for optimizing conversion rates. This gap between customer expectations and the actual shopping experience highlights a critical need for innovation in how promotions are crafted and delivered.

Business Objectives

The objective was to leverage AI to enhance the personalization of promotional content. By doing so, the client aimed to:

  • Enhance customer engagement and loyalty by providing customers with promotions that match their individual needs.
  • Improve conversion rates by increasing the effectiveness of promotion targeting and consequentially maximizing marketing ROI.

Strategic Goals for the PoC

To achieve the business objectives given the context above, we started a PoC to personalize promotions for each client. The PoC goals were:

  • Validating the concept by demonstrating if GenAI-driven promotions are more appropriate than the ones created using other approaches.
  • Assess the best architecture for a scalable implementation of the recommendation system.

PoC Implementation

We relied on the following datasets:

  • Historical transaction data
  • Customer demographics
  • Mobility data
  • Past promotions

Also, we used pre-trained LLMs from Amazon Bedrock, enabling us to jumpstart the personalization process. The development was divided into five phases:

1. Data Collection & Preparation

The initial phase involved filtering data, selecting relevant columns, and merging tables to create a unified dataset that was ready for analysis and model training. 

Amazon S3 hosted the compressed CSV files containing the data tables for customers, visits, transactions, and promotions, while SageMaker Studio Notebook accessed the data from S3, performed necessary preprocessing, and prepared the data for prompt engineering.

2. Prompt Engineering

We added context using demographics and past transaction data, enriching the model's ability to generate personalized content. 

We re-coded demographics to ensure the model would interpret them accurately and converted the aggregated data from the previous step into a natural language format that Claude v2.1 large language model (LLM) could process. Then, the LLM generated the top-k recommendations.

3. Setup the LLM

We set up the Claude v2.1 model in the SageMaker environment via the Bedrock API, to run inferences using the prompt engineered in the previous step. Utilizing Claude v2.1, we did multi-step queries to dive deep into customer individuality.

4. Generating Recommendations

Finally, we had a model inference feeding the formatted customer data into the LLM to generate promotion recommendations.

For example, the model generates: "For customer 123, offer a 20-off promo code which gives them a 20% discount on electronics, valid for the next two weeks."

Then, we post-process it, converting the model's natural language output into a structured format for practical use. For example, parsing the model's text output to extract promotion details and map them to existing offer IDs in the database.

5. Evaluation and Refinement

The final step is setting up metrics to measure the effectiveness of the recommendations (e.g., conversion rate, customer engagement, ROI, etc). We recommended testing and Iterating. This means, running tests with a control group and the recommended promotions to evaluate the performance. Based on the results, refine the model.

Figure 1: PoC Architecture

PoC Results

We concluded that using GenAI for recommendation systems is costly at the production scale and has limited context processing capabilities. 

However, despite disproving the initial concept, we could achieve both the PoC goals by providing the client with an alternative architecture and validating that GenAI can indeed optimize personalization with the appropriate approach. 

Through a small-scale implementation, we were able to pivot the architecture towards a more suitable and scalable approach, thereby avoiding investment in an unsustainable solution. 

Our final suggestion was to combine GenAI while relying on Amazon Personalize for recommendation infrastructure to overcome the aforementioned challenges. And we will describe that below.

Appropriately Using GenAI For Recommendation Systems

What spiked the cost and diminished the performance of using GenAI as the recommendation system per se was getting data for each customer to personalize the promotions. This means that we got each client's data and prompted it to get a recommendation. Both performance and cost were not reasonable. Another approach is getting a chunk of clients, but then we lose the personalization power. 

Therefore, using Amazon Personalize, the fully managed machine learning service that uses the same data to generate item recommendations, is much more suitable. We combine it with GenAI by getting Personalize's recommendations and crafting content to present to the client, enriching the personalization experience. A high-level solution architecture diagram for using Personalize with GenAI capabilities is shown below.

Figure 2: Recommended architecture for recommendation systems

Enhancing Amazon Personalize with GenAI

Amazon Personalize now offers the Content Generator, a Generative AI feature designed to elevate traditional suggestions into dynamic, thematic narratives. This enhancement transforms traditional recommendations into captivating themed experiences that significantly boost user engagement and sales.

These themes can be particularly effective in promotional contexts, such as a merchandise sales campaign themed ‘Summer Adventures’ for outdoor gear and accessories, enhancing user engagement and improving the specificity of promotions.

Traditional vs. GenAI-Enhanced Recommendation Systems

Traditional recommendation systems rely on analyzing user behavior and item characteristics to predict preferences. They might use algorithms that focus on past interactions, like purchases or views, to suggest similar items or those that other similar users have liked.

However, GenAI introduces a new paradigm by generating content or item features based on understanding the data context. AWS Bedrock can help by providing GenAI foundation models that can greatly improve the recommendation system. It can, for instance, create comprehensive product descriptions or user evaluations from scratch, improving the dataset that recommendation models are trained on. 

To summarize, below are the potential enhancements with GenAI that can be used for the promotions recommendation use case:

  • Thematic Promotions: Utilizing the ‘Content Generator’ to generate thematic promotions that truly connect with user interests, ensuring promotions are not only seen but felt.
  • Enhanced Metadata Utilization: Utilizing recommendation metadata from Amazon Personalize to generate more detailed and personalized content, such as tailored promotional emails that closely match individual user preferences and behaviors, enhancing customer engagement.

While GenAI shows promising possibilities, it's important to balance the advantages against the costs. In many cases, traditional methods powered by services like Amazon Personalize may still be the best choices due to their scalability and cost-effectiveness. Yet, the integration of GenAI can offer unparalleled advantages in creating more personalized user experiences.

Architectural Overview: Amazon Personalize with AWS Bedrock

The architecture for integrating Amazon Personalize with GenAI via AWS Bedrock involves several key components working in harmony:

1. Data Collection and Processing: The first step is gathering user interaction data, item metadata, and other relevant information. This data serves as the foundation for training the recommendation models. Here, you can use services like Amazon S3 for storage, and AWS Glue for data transformation.

2. Model Training with Amazon Personalize: Amazon Personalize allows you to quickly train personalized recommendation models. It automatically optimizes the models based on the provided data, ensuring that the recommendations improve over time.

3. Feature Enhancement with AWS Bedrock: Here, GenAI comes into play. AWS Bedrock can be used to enhance the item features or generate new user content. For instance, you can enrich the dataset for Amazon Personalize by generating synthetic user reviews based on product features or creating detailed item descriptions with aspects users care about.

4. Integration and Deployment: The enriched recommendations are then integrated into the application. This can be done through APIs, ensuring seamless delivery of personalized recommendations to end-users.

5. Feedback Loop: It is important to establish a continuous feedback mechanism to monitor user interactions with promotions. This data should be fed back into Amazon Personalize to refine and optimize the models, ensuring that the promotions remain effective and user-centric over time.

Conclusion

In summary, integrating GenAI with Amazon Personalize allows for more personalized and engaging content and recommendations, better aligning with customer interests and enhancing the effectiveness of targeted campaigns.

Are you exploring ways to take advantage of Analytical or Generative AI in your organization? Partnered with AWS, Caylent's data experts have extensively helped organizations implement AI solutions with a focus on strategies that generate real ROI. Get in touch with our team to learn how we can accelerate your AI endeavors.

Accelerate your GenAI initiatives

Leveraging our accelerators and technical experience

Browse GenAI Offerings
Artificial Intelligence & MLOps
Danilo Figueiredo

Danilo Figueiredo

As a Cloud Data Engineering Manager at Caylent, Danilo Figueiredo has been leading several different engagements in the data realm, from database migration to generative AI, ensuring they align with Caylent's standards. He also mentors architects and engineers and collaborates closely with Project Managers during the projects and with the pre-sales team during the proposal phase. In his free time, Danilo enjoys engaging in group activities with friends and family, such as games, travel, and culinary experiences, drawing energy from these shared moments.

View Danilo's articles
 Sankalp Prabhakar

Sankalp Prabhakar

Sankalp is an ML Architect with a passion for building impactful machine learning solutions on AWS. He focuses on creating scalable, robust models that drive business growth and enhance operational efficiency across various industries.

View 's articles

Related Blog Posts

OpenAI vs Bedrock: Optimizing Generative AI on AWS

The AI industry is growing rapidly and a variety of models now exist to tackle different use cases. Amazon Bedrock provides access to diverse AI models, seamless AWS integration, and robust security, making it a top choice for businesses who want to pursue innovation without vendor lock-in.

Artificial Intelligence & MLOps

AI-Augmented OCR with Amazon Textract

Learn how organizations can eliminate manual data extraction with Amazon Textract, a cutting-edge tool that uses machine learning to extract and organize text and data from scanned documents.

Artificial Intelligence & MLOps

Caylent Inks Multi-Year Strategic Collaboration Agreement with AWS to Deliver Value-Driven Generative AI Solutions to Customers, Accelerating Ideas to Impact

Artificial Intelligence & MLOps
News