Using Generative AI To Enhance Recommendation Systems

Benjamin Wootton

Benjamin Wootton

Follow me on LinkedIn
Using Generative AI To Enhance Recommendation Systems

Recommendation systems work by analysing the historical behaviours of customers (and similar clusters of customers) in order to generate relevant and personalised recommendations that grow sales.

Notable examples of these systems in action include Amazons recommendation engine and those used by Netflix and Spotify that are used to recommend digital content.

Data scientists use various algorithms and techniques to power these systems, including collaborative filtering, content-based filtering and deep learning based approaches.

In an earlier blog post, we demonstrated how a system like this could be built, using a collaborative filtering based system to suggest movies.

Enhancing Recommendations With Generative AI

Historically, recommendation systems have been built based on relatively traditional data science techniques and machine learning models.

However, Generative AI and large language models (LLMs) have the potential to enhance or complement the performance of these traditional approaches, ultimately driving increased revenue growth and customer satisfaction.

Using eCommerce as an example, we see many areas where this is the case:

  • More Granular Analysis Of Products - Many recommender systems are based on a naive product category. For instance, if the customer has previously been looking at formal shoes, we will look to recommend more formal shoes to them. By leveraging Generative AI, we can analyse the products available for sale in much more detail. We could for instance analyse product images to identify that a shoe we sell is navy blue with a heel, or analyse product descriptions to understand that the shoe is made from genuine leather and waterproof. This type of analysis allows us to build up a very rich picture of the products in our catalogue which we can use when making suggestions.

  • Customer Profile Enhancement - In the same way, we can also use an LLM to build a richer customer profile. As well as bringing structured data into our recommendation algorithm, we can also mine customer data sourced from emails, call transcripts or previous product reviews. Using this, we could for instance identify that the customer previously left a positive review of shoes from a certain brand, or emailed in a written complaint about slow delivery times. These findings can likewise be bought into our recommendation algorithm.

  • Deriving The Recommendation - Having built this rich view of our products and customers, we can also lean on the reasoning abilities of Generative AI to make the actual product recommendation for us, analysing what we know about our customers and products to match the two and make the recommendation that is most likely to result in a sale. This potentially avoids the need for training and running a bespoke machine learning model.

  • Marketing Communications - Once the product recommendation has been identified, Generative AI could then be used to make the proposal to the customer, for instance through an email or a piece of personalised content on the web. It could also be served up for a contact center agent who could encourage cross sell and upsell on calls.

Generative AI is adding value at all parts of the process here. Analysing the products on offer, building a richer profile of the customer, actually making the recommendation and then communicating the offer out. Considering the huge opportunity to grow incremental revenues in this way, this novel technique is certainly worthy of evaluation.

Scenario Walkthrough

To illustrate this, lets walk through an end to end example.

A fictional business sell different type of t-shirts. Three of the product descriptions are included below:

Organic Hemp Blend Eco Tee
The Organic Hemp Blend Eco Tee is made from a sustainable mix of organic hemp and cotton, providing a naturally soft and breathable fabric that’s kind to the environment. Hemp is known for its durability and low environmental impact, making this t-shirt both eco-friendly and long-lasting. The design is minimal and versatile, with a relaxed fit that pairs well with casual outfits. Available in earthy tones like sand, sage, and natural white, this tee is perfect for anyone looking to reduce their environmental footprint while staying stylish and comfortable.

Performance Flex T-Shirt
Built for high-performance, the Performance Flex T-Shirt is made from lightweight, moisture-wicking fabric that keeps you cool and dry during even the most intense activities. Its four-way stretch material allows for unrestricted movement, while flatlock seams reduce chafing for extra comfort. With a streamlined fit and modern design, this t-shirt is perfect for the gym, outdoor sports, or casual workouts. Available in bold colors with reflective accents for evening visibility, it combines practicality with a sleek athletic look.

Vintage Graphic Tee
The Vintage Graphic Tee offers a nostalgic look with its retro-inspired prints and soft, broken-in feel. Made from a high-quality cotton blend, this t-shirt has a slightly oversized fit, giving it a relaxed, laid-back vibe. The faded graphics and distressed details add a touch of character, making it perfect for casual wear or as a statement piece in streetwear fashion. With a variety of vintage-themed designs, this tee is ideal for those who love bold graphics and a throwback aesthetic.

Using an LLM, we can first analyse the product descriptions to extract structured information which could be used as inputs into our recommendation systems. This avoids the need for manual tagging and categorisation, and allows us to tease out subtle characteristics about our products.

For each of the three t shirts, extract a list of tags describing them suitable for input into my recommendation system.  

The following tags are output. Note that this words such as Durable do not appear in the text but are instead intelligently inferred by the model based on other characteristics. This process can be controlled with a more descriptive prompt.

Organic Hemp Blend Eco Tee
- Eco-friendly
- Organic hemp
- Organic cotton
- Sustainable
- Natural fibers
- Durable
- Breathable
- Relaxed fit
- Earthy tones
- Oversized fit

Performance Flex T-Shirt
- Performance wear
- Lightweight
- Moisture-wicking
- Four-way stretch
- Athletic
- Streamlined fit
- Modern design
- Comfortable
- Reflective accents

Vintage Graphic Tee
- Retro-inspired
- Cotton blend
- Oversized fit
- Casual
- Relaxed
- Vintage graphics
- Distressed details
- Bold design
- Streetwear fashion

Next, let's try to source more information about the products by using the LLM to analyse our product reviews. In this instance we are looking at a review for the 'Performance Flex T-Shirt'.

I've been wearing the Performance Flex T-Shirt for a few weeks now, and it’s become my go-to for the gym. The fabric is super lightweight and moisture-wicking, so even during my toughest sessions, I stay cool and dry. The four-way stretch is a game-changer—it moves with me during weightlifting and HIIT workouts without feeling restrictive. Plus, the fit is sleek but not too tight, which gives it a modern look. Overall, it’s the perfect gym shirt for anyone who’s serious about their workouts!

We can ask the LLM to process the review in the same way in order to extract new tags and characteristics about the product:

Extract some tags describing characteristics of the t shirt based early on this review

The results are as follows. Our profile of the products on offer will get richer and more nuanced as we ingest more and more reviews and other data.

Here are the tags based on the review of the Performance Flex T-Shirt:

- Lightweight
- Moisture-wicking
- Four-way stretch
- Flexible
- Comfortable
- Gym wear
- Performance
- Modern fit
- Breathable
- Durable

Finally, we could use an image processing model to analyse the product images and extract further characteristics about the product which can be used to inform our recommendations. Perhaps we can identify distinguishing features about the design and style of the t-shirt in a way which wasn't apparent in the metadata or description.

Building The Customer Profile

Recommendation systems will typically work by analysing customers past behaviour. They may also bring in other structured information about the customer such as their age and location which may be relevant features when making a recommendation.

However, what if we could use the LLM to build out the customer profile from non standard data sources? For instance, we can analyse the customers emails or call transcripts and bring this in to add more colour to our understanding of the customer.

Imagine that our fictional eCommerce t-shirt business make use of content marketing, regularly publishing content on their blog. They have the following articles on their website in an attempt to link their brand to travel and adventure from a marketing and branding perspective:

A Weekend in the Heart of Paris
Paris is a city that never ceases to amaze, and my recent weekend trip was no exception. I wandered the charming cobblestone streets of Le Marais, indulged in flaky croissants from hidden boulangeries, and admired the timeless beauty of the Eiffel Tower at night. The highlight was visiting the Louvre and getting lost in its endless galleries of art and history. Between sipping café au lait at sidewalk cafés and exploring the grandeur of the Notre-Dame, I was swept away by the city’s vibrant culture, history, and romance. Paris truly is the perfect destination for a quick escape filled with charm and elegance.

Adventure in Costa Rica
Costa Rica is the perfect destination for eco-conscious travelers, and my recent trip there proved it. I stayed in a solar-powered eco-lodge nestled in the rainforest, waking up to the sounds of howler monkeys and tropical birds. From hiking through lush jungles in search of waterfalls to snorkeling in crystal-clear waters along the coast, every moment was an immersion in nature. The highlight was visiting a sustainable wildlife reserve, where we saw sloths and toucans in their natural habitat. By choosing eco-friendly accommodations, supporting local conservation efforts, and opting for low-impact activities, I was able to explore this stunning country while minimizing my environmental footprint.

Exploring the Ancient Temples of Angkor Wat
Stepping into the ancient ruins of Angkor Wat in Cambodia felt like walking through history. The temple complex, a sprawling wonder of stone carvings and towering structures, took my breath away with its scale and intricate details. As the sun rose over the main temple, casting a golden glow over the landscape, I was transported back to the era of the Khmer Empire. Exploring the temples, including the iconic Ta Prohm where giant tree roots weave through the ruins, was a mystical experience. The blend of history, nature, and spirituality at Angkor Wat made this one of the most memorable travel experiences of my life.

Let's again make use of an LLM to analyse this content and turn it into more structured information that we can work with:

A Weekend in the Heart of Paris
- Paris
- City break
- Culture
- Art
- History
- Cafés
- Travel
- Architecture
- French lifestyle
- Romance

Eco-Friendly Adventure in Costa Rica
- Eco-friendly travel
- Sustainable tourism
- Costa Rica
- Rainforest
- Wildlife
- Conservation
- Adventure
- Solar-powered
- Hiking
- Nature

Exploring the Ancient Temples of Angkor Wat
- Cambodia
- Angkor Wat
- Ancient temples
- History
- Culture
- Spirituality
- Ruins
- Khmer Empire
- UNESCO World Heritage
- Adventure travel

We now know that if a logged-in customer engages with our content titled 'Eco-Friendly Adventure in Costa Rica', that he is potentially interested in eco-friendly travel, sustainability and nature. We can therefore propose relevant products to him with this new found understanding of his preferences and lifestyle.

This is an insight which would have entirely flown under the radar without this type of analysis.

Using an LLM For Making The Recommendations

In the last two sections we have used an LLM to build up our understanding of our products and our customers. This could be used to give our existing models much better and richer datasets to work with.

However, it may also be possible to use the LLM to apply reasoning and derive the actual recommendation.

Conceptially. this involves asking the LLM the question - based on what we know about a customer, what should we recommend to them right now?

An example might be this:

If a customer has read the blog about Costa Rica, which t-shirt do you think we should reccomend to them?

The following recommendation is identified:

If a customer has read the blog about Costa Rica and is interested in eco-friendly travel, we should recommend the Organic Hemp Blend Eco Tee. Its sustainable, natural fibers and eco-conscious design align perfectly with the values of someone who is passionate about eco-friendly practices and nature, making it an ideal match for their interests.

This is really quite remarkable! We are asking the LLM quite a complex question to say, given that we know our customer has read a blog, analyse the blog to understand what it's about and suggest a product from our catalogue to reccomend for them. The LLM got this right in this albeit toy example.

There are a few downsides to this approach of letting the LLM do the reasoning.

First, it can be costly since you need to pay for each inference call. However, if it leads to increased revenue over and above the system in place today, the investment could of course be justified.

Additionally, LLMs tend to be slower compared to traditional machine learning inference calls meaning that this isn't appropriate for real time scenarios.

This said, it is still a really interesting approach which warrants careful evaluation and analysis for businesses looking to grow revenues in this way.

Generating The Customer Offer

Finally, LLMs can have a role to play in generating the offer. In the example below, we have taken the personalsied recommendation and proposed the product to the customer tailoring it based on our enhanced customer profile. We could leverage the LLM to further customise the language based on other demographic information such as age and gender.

Subject: Alex, Meet Our New Organic Hemp Blend Eco Tee – Just for You!

Hi Alex,
We hope you're doing well! Based on your interest in sustainability and eco-friendly living, we wanted to personally introduce you to our brand-new Organic Hemp Blend Eco Tee. This t-shirt is crafted from a blend of organic hemp and cotton, designed for both comfort and sustainability. We know how much you value environmentally conscious choices, and this tee is the perfect match—it’s durable, breathable, and made from natural fibers that are kind to the planet.
To make it even better, we’re offering you an exclusive 10% discount on your first purchase of the Organic Hemp Blend Eco Tee! Just use the code ECO10 at checkout.
We truly believe this tee will align with your lifestyle, and we’d love to hear how you like it! Feel free to reach out if you have any questions.
Best regards,
Customer Support Team

Performance Of This Approach

This approach offers significant advantages. By incorporating more context about our products and customers into the recommendation systems, we can clearly improve their overall performance. Using an LLM for this type of analysis is straightforward and relatively quick to implement.

Using an LLM to actually make recommendations is a newer and more experimental concept, but I owuld argue that it's relatively low risk to try and then measure its effectiveness empirically through A/B testing.

Architecture

I would like to close with a few thoughts on how we would architect a solution like this.

  • The unstructured product and customer data such as reviews, product descriptions and product images would ideally be bought into a cloud hosted data lake to make it easy for the LLM to analyse;

  • We would ideally implement a streaming architecture whereby when a new piece of information is uploaded into the lake, the recommendations are generated in near real time as new pertinent infromation becomes available;

  • The processing would make use of a service such as AWS Bedrock, giving us the ability to switch and experiment with different models easily;

  • The actual recommendations would potentially need to be served from a cache or transactional database to make it fast for rendering on transactional systems or customer facing websites.

A caching strategy and only pre-computing results for our most active customers could be a good balance between cost and performance.

Conclusion

In this article we have demonstrated the significant benefits which using an LLM could bring across the entire lifecycle of making intelligent customer recommendations.

We discussed the tradeoffs of this approach compared with deploying a recommendation system based more traditional machine learning systems.

We discussed architecturally how we would implement this, allowing us to integrate all customer data, processing it in near real time, and surfacing the recommendations to our websites and transactional systems.

If you are interested in potentially enhancing your recommendation systems with Genrative AI, please get in touch with us contact us for an informal discussion.

Join our mailing list for regular insights:

We help enterprise organisations deploy advanced data, analytics and AI enabled systems based on modern cloud-native technology.

© 2024 Ensemble. All Rights Reserved.