ChatGPT Ecommerce System
This solution guide presents a novel approach that leverages Large Language Models, such as ChatGPT, to address the limitations found in traditional recommendation methods. Traditional methods are typically task-specific and therefore require corresponding data to train distinct models for various applications. These methods often lack generalization capabilities and underperform in cold start situations. To overcome these challenges, we propose and implement an ecommerce recommender system based on ChatGPT. This system is specifically designed for recommendation systems in scenarios with limited task-specific data, for example, cold start problem that often associates with new users. The "cold start problem" is a term commonly used in the context of recommendation systems, machine learning, and data-driven applications to describe the difficulty of making accurate recommendations or decisions when there is very little data on users or items.
Additionally, using ChatGPT to do ecommerce product feature summarization, as well as product reviews generation is also included in this solution notebook, to demonstrate how to build an ecommerce ecosystem using ChatGPT.
Features
Use cases cover three areas:
1. Recommendation based on user-item interaction history.
Pointwise Recommender Systems predict how relevant each item is to a user by scoring each one individually, like a regression problem.
Pairwise Recommender Systems compare two items at a time to see which one a user might prefer, focusing on learning rankings through item comparisons.
Listwise Recommender Systems consider all items together, aiming to order the entire list to align with a user's preferences, from most to least relevant.
2 Summarize product features, these summarizations can be used in email campaigns.
3 Product review generation. Generation high level product reviews from lot of users' reviews.
System Architecture
This diagram illustrates the e-commerce system outlined in the document. Upon initiation of a request or conversation, the router determines which of the three feature branches is best suited to handle the incoming request. For the recommendation branch, there are three approaches available, each contingent upon the type of information storage data utilized. The choice of approach and the corresponding data available influence the prompts employed. Ultimately, GPT is deployed to generate responses, thereby fulfilling the request.
Biases on LLM Ranking and How to Address Them
Position Bias
One of the challenges faced by LLMs is the order of candidates affects the ranking results of LLMs. While traditional ranking methods are not usually affected by the order of retrieved candidates, LLMs are known to be sensitive to the order of examples in NLP prompts. Specifically, it has been observed that the ranking performance drops significantly when the ground-truth items appear at the last few positions.
This phenomenon is known as Position Bias, which can be mitigated through the use of bootstrapping. This involves randomly assigning candidate items to different positions and repeating the ranking task several times.
Popularity Bias
Another form of bias that affects LLM ranking is Popularity Bias. Similar to conventional recommender systems, LLMs tend to prioritize more popular items and rank them higher. To reduce Popularity Bias, LLMs can be designed to focus more on historical interactions rather than relying on popularity. It has been observed that the more historical interactions available, the less the output is influenced by popularity.
Reference: [2305.08845] Large Language Models are Zero-Shot Rankers for Recommender Systems (arxiv.org)
3 types of GPT Recommender
- Pointwise Recommender Systems:
- These systems evaluate each item individually to predict its relevance to a user. The approach treats the recommendation task as a regression problem, where the goal is to predict a score or probability indicating how likely a user is to be interested in each item.
- Pairwise Recommender Systems:
- Pairwise systems focus on comparing pairs of items to determine which one is more preferable or relevant to the user. This method is about learning preferences and rankings by comparing items in pairs, rather than scoring them independently.
- Listwise Recommender Systems:
- Listwise Recommender Systems go beyond individual or pairwise item evaluation by considering the entire list of items as a collective entity. The goal is to optimize the ordering of this list to best match the user’s preferences, ranking items from most to least relevant.
Data for GPT recommender
Prompt design for 3 types of GPT Recommender
- Pointwise
- Pairwise
- Listwise
Evaluation for 3 types of GPT Recommender
Evaluating three types of GPT Recommender systems—Pointwise, Pairwise, and Listwise—plays a crucial role in optimizing the performance and relevance of recommendations in various contexts. Each approach has its unique methodology for evaluating the ranking and recommending items.
## pointwise recommender metrics: regression metrics
MSE, MAE
## pair wise recommender metrics: classification metrics
Precision, Recall
## list wise recommender metrics: Ranking metrics
NDCG
Summarize product features
Use ChatGPT to summarize the main features of a product into a short, easy-to-read summary of 1-2 paragraphs. It involves looking through a lot of detailed information on several pages and boiling it down to just the most important points, giving you a quick and clear picture of what the product is all about.
Data for Product feature summarization
str_product_specs = """
Front view of Surface Laptop 5 in Sage with a sage green blossom on the Windows 11 start screen.
Sleek, thin, light
13.5” PixelSense™ touchscreen for ultra-portable productivity, or larger 15” for split-screen multitasking.
Sleek and super-light weight laptop starting at 2.80 lbs (1,272 g) with an exceptionally comfortable keyboard.
Warm, sophisticated Alcantara® or edgy, cool metal, and bold colors including new Sage.Footnote1
Front view of Surface Laptop 5 in platinum with a green blossom on the Windows 11 start screen.
Blazing fast
Snappy multitasking with powerful 12th Gen Intel® Core™ i5/i7 processors built on the Intel® Evo™ platform.
Lightning-fast Thunderbolt™ 4 connects a 4K monitor, charges your laptop, and delivers faster data transfer for large video files.
Reliable all-day battery.Footnote2
Surface Laptop 5 shown from the back with the lid slightly closed.
Elevated experiences
Look and sound your best on calls with Studio Mics and enhanced camera experiences, powered by Windows 11.
Cinematic entertainment. Ultra-vivid colors with Dolby Vision IQ™3 and sound that moves all around you with Dolby Atmos®.Footnote4
Side view of Laptop 5 with the screen closed.
Built-in security for work and play
Peace of mind from the moment you sign in, with Windows Hello and built-in Windows 11 security.
Get productive and jump start your creative ideas with Microsoft 365 and video editing with ClipChamp.
Secured OneDrive cloud storage for your Microsoft 365 files.
Play together on Windows PCs with Xbox Game Pass Ultimate.Footnote7
Tech specs
Processor
Surface Laptop 5 13.5”:
12th Gen Intel® Core™ i5-1235U processor
12th Gen Intel® Core™ i7-1255U processor
Built on the Intel® Evo™ platform
Surface Laptop 5 15”:
12th Gen Intel® Core™ i7-1255U processor
Built on the Intel® Evo™ platform
Graphics
Intel® Iris® Xe Graphics
Memory and StorageFootnote8
Surface Laptop 5 13.5”
8GB, 16GB LPDDR5x RAM
RemovableFootnote9 solid-state drive (SSD) options: 256GB, 512GB
Surface Laptop 5 15”
8GB, 16GB, or 32GB LPDDR5x RAM
RemovableFootnote9 solid-state drive (SSD) options: 256GB, 512GB, or 1TB
Display
Surface Laptop 5 13.5”:
Screen: 13.5” PixelSense™ Display
Resolution: 2256 x 1504 (201 PPI)
Aspect ratio: 3:2
Contrast ratio 1300:1
Color profile: sRGB, and Vivid
Individually color-calibrated display
Dolby Vision IQ™Footnote3 support
Touch: 10-point multi-touch
Gorilla® Glass 3 display on laptop with Alcantara® palm rest
Gorilla® Glass 5 display on laptop with metal palm rest
Surface Laptop 5 15”:
Screen: 15” PixelSense™ Display
Resolution: 2496 x 1664 (201 PPI)
Aspect ratio: 3:2
Contrast ratio 1300:1
Color profile: sRGB, and Vivid
Individually color-calibrated display
Dolby Vision IQ™Footnote3. support
Touch: 10-point multi-touch
Gorilla® Glass 5
BatteryFootnote2
Surface Laptop 5 13.5”:
Up to 18 hours of typical device usage
Surface Laptop 5 15”:
Up to 17 hours of typical device usage
Size and Weight
Surface Laptop 5 13.5”:
Length: 12.1” (308 mm)
Width: 8.8” (223 mm)
Height: .57” (14.5 mm)
Weight: Fabric: 2.80 lbs (1,272 g)
Metal: 2.86 lbs (1,297 g)
Surface Laptop 5 15”:
Length: 13.4” (340 mm)
Width: 9.6” (244 mm)
Height: .58” (14.7 mm)
Weight: 3.44 lbs (1,545 g)
Security
Firmware TPM 2.0 is a security processor that is designed to give you peace of mind.
Windows Hello face sign-in
Video/Cameras
Windows Hello Face Authentication camera
720p HD front facing camera
Audio
Omnisonic® Speakers with Dolby® Atmos™Footnote4
Mics
Dual far-field Studio microphones
Connections
1 x USB-C® with USB 4.0/Thunderbolt™ 4
1 x USB-A 3.1
3.5mm headphone jack
1 x Surface Connect port
Network and connectivity
Wi-Fi 6: 802.11ax compatible
Bluetooth® Wireless 5.1 technology
Pen and accessories compatibility
Designed for Surface Pen*
Compatible with Microsoft Pen Protocol (MPP)
Software
Windows 11 Home
Preloaded Microsoft 365 Apps5
Microsoft 365 Family 30-day trial6
Xbox Game Pass Ultimate 30-day trialFootnote7
Accessibility
Compatible with Surface Adaptive Kit
Compatible with Microsoft Adaptive Accessories
Include Windows Accessibility Feature – Learn More Accessibility Features | Microsoft Accessibility
Discover more Microsoft Accessible Devices & Products - Accessible Devices & Products for PC & Gaming | Assistive Tech Accessories - Microsoft Store
SustainabilityFootnote12
Meets ENERGY STAR® requirements
Registered EPEAT® Gold in the US and Canada11
Sustainable Products & Solutions | Microsoft CSR
Exterior
Casing: Aluminum
Power and Volume buttons on keyboard
Surface Laptop 5 13.5” colors:
Platinum with Alcantara® material palm rest
Matte Black with metal palm rest
Sage with metal palm rest
Sandstone with metal palm rest
Surface Laptop 5 15” colors:1
Platinum with metal palm rest
Matte Black with metal palm rest
Sensors
Ambient light sensor
What’s in the box
Surface Laptop 5 13.5” and 15”:
Power Supply
Quick Start Guide
Safety and warranty documents
Keyboard Compatibility
Activation: Moving keys
Backlight
Layout: English, full row of function keys (F1 – F12)
Windows key and dedicated buttons for media controls, screen brightness
WarrantyFootnote10
1-year limited hardware warranty
"""
Prompt Design for summarizing product features
response_sample = openai.ChatCompletion.create(
engine='gpt-35-turbo-0613', # The deployment name you chose when you deployed the GPT-35-Turbo or GPT-4 model.
messages=[
{"role": "system", "content": "Assistant summarize product features."},
{"role": "user", "content": f"""
Here are the full product specs: {str_product_specs}
Based on this history, please summary the product features highlight into a few sentences.
"""},
]
)
str_chatgpt_summary = response_sample['choices'][0]['message']['content']
print(str_chatgpt_summary)
Evaluation for product summarization
Regarding product summarization, we adopt a comprehensive scoring system encompassing n-gram Bilingual Evaluation Understudy (BLEU-n), n-gram Recall-Oriented Understudy for Gisting Evaluation (ROUGE-n), and Large Language Models (LLM) evaluation.
from nltk.translate.bleu_score import sentence_bleu
hypothesis = str_chatgpt_summary
reference_summary = """Front view of Surface Laptop 5 in Sage with a sage green blossom on the Windows 11 start screen.
Sleek, thin, light
13.5” PixelSense™ touchscreen for ultra-portable productivity, or larger 15” for split-screen multitasking.
Sleek and super-light weight laptop starting at 2.80 lbs (1,272 g) with an exceptionally comfortable keyboard.
Warm, sophisticated Alcantara® or edgy, cool metal, and bold colors including new Sage.Footnote1
Front view of Surface Laptop 5 in platinum with a green blossom on the Windows 11 start screen.
Blazing fast
Snappy multitasking with powerful 12th Gen Intel® Core™ i5/i7 processors built on the Intel® Evo™ platform.
Lightning-fast Thunderbolt™ 4 connects a 4K monitor, charges your laptop, and delivers faster data transfer for large video files.
Reliable all-day battery.Footnote2
Surface Laptop 5 shown from the back with the lid slightly closed.
Elevated experiences
Look and sound your best on calls with Studio Mics and enhanced camera experiences, powered by Windows 11.
Cinematic entertainment. Ultra-vivid colors with Dolby Vision IQ™3 and sound that moves all around you with Dolby Atmos®.Footnote4
Side view of Laptop 5 with the screen closed.
Built-in security for work and play
Peace of mind from the moment you sign in, with Windows Hello and built-in Windows 11 security.
Get productive and jump start your creative ideas with Microsoft 365 and video editing with ClipChamp.
Secured OneDrive cloud storage for your Microsoft 365 files.
Play together on Windows PCs with Xbox Game Pass Ultimate.Footnote7"""
Product review generation
Use GPT to create product reviews by compiling and synthesizing insights from numerous user reviews.
Data for Product review
Prompt design for product review generation
Here, a straightforward system and user prompt are demonstrated to guide GPT in creating an overarching review from several individual user reviews.
response_sample = openai.ChatCompletion.create(
engine='gpt-35-turbo-0613', # The deployment name you chose when you deployed the GPT-35-Turbo or GPT-4 model.
messages=[
{"role": "system", "content": "Assistant summarize product reviews."},
{"role": "user", "content": f"""
Here are the product reviews from several users: {str_concatenated_reviews_sample}
Based on this history, please summary the product reviews into 1 to 2 sentences.
"""},
]
)
str_chatgpt_summary = response_sample['choices'][0]['message']['content']
print(str_chatgpt_summary)
Evaluation for product review generation:
Engineering Implementation
Engineering Execution is beyond the scope of this work. Some implementation ideas are listed here in case a full product is intended to be built.
- Utilization of Semantic Kernel: Our system is designed to seamlessly navigate between three distinct branches, ensuring smooth operations and effective data management.
- Integration with Database: We leverage the robust and scalable Azure storage for our data management needs, facilitating efficient data handling and retrieval.
Conclusion
In conclusion, the ChatGPT Ecommerce System offers an innovative solution that surpasses the limitations of traditional recommendation methods. It specifically caters to scenarios with limited task-specific data, offering robust solutions for cold start problems associated with new users. Key features include recommendation based on user-item interaction history, product reviews generation, and product feature summarization for email campaigns. It also addresses inherent biases, including Position Bias and Popularity Bias, which can impact Large Language Models' ranking. Various data sources and evaluation metrics are leveraged to ensure a comprehensive and accurate ecommerce recommendation system. All in all, this system presents an advanced, user-centric approach to ecommerce, enhancing user experience and efficiency in the rapidly evolving digital marketplace.
References
- [2304.10149] Is ChatGPT a Good Recommender? A Preliminary Study (arxiv.org)
GPT-4 for SEO: Revolutionizing Search Optimization with Multimodal AI (searchvolume.io) - archersama/awesome-recommend-system-pretraining-papers: Paper List for Recommend-system PreTrained Models (github.com)
- GitHub - rainym00d/LLM4RS: the official implementation of the paper “Uncovering ChatGPT's Capabilities in Recommender Systems”
- [2305.08845] Large Language Models are Zero-Shot Rankers for Recommender Systems (arxiv.org)
- ChatGPT-based Recommender Systems - Sumit's Diary (reachsumit.com)