Paid Ads, Segmentation & Marketing with AI

Hi, This is Bhavik. I would like to apply for the Senior Paid Search Specialist post at Trendhim. I’ve decided to showcase my recent research work for E-commerce and how we can implement it into Trendhim shop.

In this page, I’m going to present my recent work in AI & LLM for E-commerce based Marketing and how it can help understand the customer journey, ad performance & product recommendation. On top of that, the chatbot created using LLM and Chains will revolutionize customer interaction.

The work is divided into 3 parts:

  1. Exporting & transforming e-commerce (ex. Amazon product data set here) into Redis Vector Storage and feeding the data to LLM (OpenAI, Later on, Private Language Model for data safety) for Contextual Language Modeling.
  2. Using AI to do Vector Similarity Searches for better product recommendations and matching
  3. Understanding & retaining customers, through AI-based RFM (Recency Frequency Monetary) segmentation in real-time.

1. Problem
2. Context
3. Contextualising LLM
4. Solution Architecture
5. Extension
6. Scope

1. Exporting e-commerce (ex. Amazon Product here) into Redis Vector Storage and feeding the data to LLM (OpenAI, Later on Private Language Model for data safety) for Chatbot

In this work, I’ve used a publicly available Amazon product data set (link) and transformed it into a machine learning model using vector embedding, and combined with Langchain, it would give us insights into the product’s details. Along with the Language Model chained with prompt templates, it can answer various questions like what did users like about it?

Product: https://www.amazon.com/Powerstep-Pinnacle-Orthopedic-Insoles-Support/dp/B000KPIHQ4 (Powerstep Pinnacle Insoles)

In this example, I’ve transformed “reviews’ of one particular product (Pinnacle shoe insoles). Then I transformed it into vector embedding using Hugginface and stored in Redis vector storage.

There are around 500 reviews that i’ve stored as vectors in Redis which we can access along with Language Model to query it through a prompt template or chatbot.

Redis has wonderful real-time search performance since search and recommendation systems have to run incredibly fast. The VSS functionality in Redis has low search latency. https://redis.com/solutions/use-cases/vector-database/

There are 4371 reviews that have been filtered out for a product. Then they are transformed into vector database using Huggingface and fed into Redis vector storage.

Reviews > Converted into List with metadata (ratings, summary) > Vector Transformation > Stored in Redis > Retrival on demand

We can see all the reviews have been stored in redis database along with uniq key to access it.
Fetching a random review

Now, let’s say we want to find out the reviews which are related to some context. Let’s say we want to filter out the review which expresses that ‘the product was worth spending the money’. The Language model will give us those particular reviews which have the same expression. Using this technique we can have dynamic landing pages, which has a dynamic list of reviews or past customer feedback based on customers’ characteristics and preference.

Language Model answering our queries (this can be used in product description / QA section of product too)
Asking for the summary to the language model

In simple terms :

Let’s say the customer is interested in buying ‘CALIFORNIA | BROWN ERGONOMIC LEATHER WALLET’. If we know that the customer is high value and more likely to spend the money, we can upsell an additional product like “SILVER-TONE STEEL WALLET CHAIN” by providing him a summary of reviews of buyers who bought these 2 things together and expressing their opinion on it. This additional selling opportunity can be implemented on cart page or after checkout (as a post-purchase upsell)

post-purchase upsell example

Shopify has recently used this kind of work to summarise the app review:

https://apps.shopify.com/invoice-hero#adp-reviews

2. Using AI to do Vector Similarity Searches for better product recommendations and matching

  • With Redis vector database and vector embedding, it would revolutionize how you can showcase ‘Related Products’, ‘Bundles’, ‘Cross-sell’, and ‘Upsells”. By understanding the customer journey and previous data, we would have way better recommendations rather than existing ones based on product categories or tags.
  • For example, if you know that a customer is more likely to buy 1 high ticket product, then we could suggest him lesser-priced related products rather than recommending products of the same lineup
  • We could also give him discounted price or discount code based on his segmentation. More on this below.

3. AI-based RFM Segmentation to understand Customer Jourey and increasing Lifetime value:

This idea is based on Feast (https://github.com/feast-dev/feast), a feature store for machine learning, Langchain, GPT, Bigquery, and Google Cloud Platform. It’s based on my test Shopify store.(https://productsml.myshopify.com/) Product and Customer data has been trained from that particular Shopify store.

Based on the following data, we can build a system for smart recommendations, chatbot answering queries, and offers to customers based on their segmentation.

  • Customer Segments (RFM etc.)
  • Product Recommendations
  • Churn & Retention Data
  • Propensities (new product categories, loyalty, etc)
  • Price & Discount Sensitivities
  • Purchase Cadence
  • Browsing history, UTM data
  • CX data


RFM Segmentation is a simple and scalable way of segmenting a customer base:

  • Recency (R):
    Time since the last transaction
  • Frequency (F):
    Number of transactions
  • Monetary value (M):
    Total spent across transactions

Based on customer parameters, journey & segmentation, we can calculate the RFM score. based on the RFM score we can recommend products, discounts, and offers accordingly through Language Model.

RFM Scores for customers base uploaded from Shopify to BigQuery
Here we are instructing GPT to recommend a product based on their RFM score. We are considering if he has a high churn risk.

Here a particular customer is looking for some cool sneakers.

“Considering your RM score, it seems you haven’t shopped with us recently or frequently, but when you do, you tend to make significant purchases. To encourage you to shop with us again, I’d like to offer you a special 15% discount on these sneakers. Would you like to proceed with this offer?”

  • Of course, we are not going to show this sentence to the customer, we can formulate it in a way that only we get to access the evolution text and the customer gets the rest of it. but we get the idea that how Language Model can suggest the offer based on the customer’s RFM score. In this case, the customer hasn’t purchased in a long time, so he has been given a 15% discount.
https://clevertap.com/blog/automate-user-segmentation-with-rfm-analysis/
CleverTop has some nice segmentation examples based on RFM

We can instruct our language model with all these instructions and it will do the magic for us. We need to instruct him about various offers and discounts based on the customer’s segmentation and journey.

example: We can use Monetary Value (M) while recommending items to purchase. If the customer has a high monetary value, we can try to add additional cheap items to the order.

Following are the examples of language models that smartly suggest Products and Offers to 3 different customers based on their RFM scores and segmentation for the same query.

Customer 1 (Low Recency & Frequency) :

Chat Model is offering discount on total ! It’s giving incentive (which we told Language Model to do) on total.

Customer 2 (Moderate Recency & Frequency):

Chat Model using variation of ‘Buy X get Y’ offer. Offering incentive on second item to purchase.

Customer 3 (High Recency & Frequency):

Chat Model is telling customer is valued without telling any segment. It tried to go on selling 2nd item on discounted price, though not exactly X get Y.

Language model smartly replied and gave appropriate offers according to their RFM scores, Journey and Segmentation.

This can customer support/sales representatives to give good tailored suggestions while interacting with customers. (For email marketing too)

How can this be useful in this particular role of Senior Paid Search Specialist?

Apart from optimising ads and converting more leads, it’s important to understand customer journey and reason behind the conversion. Why did the ad set worked ? Usually it’s time consuming and requires lot of data pipeline building. But with help AI & data, it seems to possible now. Using various techniques mentioned above, we can improve customer interaction, recommandation and happiness. He will be able to choose the product he is looking for. Thus, end of the day we are not only making customer happy but making sure that he gets right product without confusion and thus more chances of him coming back to the site.

Moreover, Incorporating Contextual Language Modeling with Email marketing can significantly enhance campaigns’ effectiveness. Here’ how:

1. Personalized Product Recommendations: Utilize Contextual Language Modeling to analyze customer behavior and preferences. Craft personalized email content with product recommendations tailored to each recipient’s interests, browsing history, and purchase behavior. This approach boosts engagement and conversion rates.

2. Dynamic Content Generation: Implementing Contextual Language Modeling to dynamically generate email content based on real-time data. Create subject lines, product descriptions, and calls-to-action that resonate with individual customers, driving higher open rates and click-throughs.

3. Contextual Storytelling: Crafting compelling narratives that resonate with customers’ interests and preferences. Contextual Language Modeling can help identify common themes and interests among segments of audience, enabling us to tell stories that establish an emotional connection with recipients.

4. A/B Testing Enhancement: Enhance A/B testing by using Contextual Language Modeling to predict which variations are likely to resonate with specific segments.

6. Customer Lifecycle Engagement: Leverage Contextual Language Modeling to create automated email workflows that engage customers at various stages of their journey. From welcome emails to post-purchase follow-ups, CLMContextual Language Modeling can help deliver contextually relevant messages that drive customer loyalty.

7. Multilingual Communication: Since Trendhim serves customers globally, Contextual Language Modeling can assist in crafting email content in multiple languages while ensuring the messaging is culturally sensitive and contextually accurate.

Other opportunities :

  • Creative Generation for Paid & Social Media
  • Product Search Optimisation
  • AI based Email Automation (Still working on it)
  • Intelligent Tagging
  • Price Optimization
  • Market Research

Thanks for reading.

I can do basic conversation in Danish too. Though, I’m still learning. I am open to moving to Horsens.

Incorporating my diverse background into the team would present a valuable opportunity for embracing different viewpoints and approaches.

I’m looking forward to your feedback.