logo
Menu

Amazon Product Review Analysis with Generative AI

Using LangChain's MapReduce chain for batch processing of natural language

Kaizad Wadia
Amazon Employee
Published Dec 7, 2023
In today's highly competitive ecommerce landscape, monitoring online customer sentiment and product reviews is more critical than ever for product vendors to stand out. Negative feedback on sites like Amazon can be detrimental, while positive reviews help generate more sales. But with so many customer comments scattered across the web, how can businesses make sense of what customers really think?
That's where the new Product Review Analyzer app comes in. Purpose-built for parsing Amazon reviews, this intelligent tool utilizes large language models (LLMs) and the power of AI abstractions like LangChain to analyze customer sentiment around products on ecommerce sites. The idea is that product vendors can periodically receive emails about their product's performance in the marketplace, including but not limited to the analysis of the customer feedback. This feedback helps vendors continuously make improvements on their products, to make end users more satisfied while also providing a way to have their concerns heard.
Architecture Diagram
Application Architecture

Application Functionality

Conventionally, the MapReduce Chain is used simply to generate summaries of documents, by summarizing sections of the large document and then generating a summary of the smaller summaries. The main constraint here is the limit of the context window of the large language model. For the purposes of demonstration, this uses the Claude V2 large language model although it supports a range of language models included on Amazon Bedrock. This model already has a relatively large context window of 100,000 tokens, making it very suited to a wide range of use cases. However, by using MapReduce operations in a number of use cases, this can be scaled indefinitely.
The data was obtained using an open dataset of Amazon reviews from the University of California, San Diego. This application was tested using a subset of product reviews loaded from the Electronics category.
The first aspect of the mapreduce chain are the prompt templates used in the map and reduce operations. Prompt templates are prompts that are fed into the LLM, but with certain placeholders that are replaced during formatting of the prompt. In the map operation, the following prompt template is used:
In the above prompt template, the {reviews} placeholder is replaced during the format of the prompt with the actual reviews of the product. On the other hand, in the reduce chain, when there are many strengths, weaknesses and improvements generated and they need to be consolidated, the following prompt template is used:
In the above template, {product_description} is replaced with the description of the product, so that the language model is aware of the products capabilities when generating the final output. The {feedback} placeholder is replaced with the intermediate pieces of feedback generated by the map prompt above. The output of this is then considered the final result.
The app employs the highly scalable MapReduce Chain. First, it maps Amazon reviews into three buckets using the Map Chain - strengths, weaknesses, and potential improvements. After mapping a large volume of reviews into these categories, it then reduces this information by aggregating the most frequent and important feedback within each bucket.
The end result? A summary of the most prevalent positive feedback alongside the top complaints and suggested improvements based directly on customer input. Businesses gain clear, data-backed insights from real user reviews - not just aggregated ratings or cherry-picked comments.

Key Benefits and Features

The Product Review Analyzer provides valuable benefits to businesses selling products on Amazon. By intelligently analyzing customer reviews, it identifies the key strengths and weaknesses of a product based on real customer feedback.
A key feature is the summarization of the most common compliments and complaints. This high-level insight saves businesses time and enables them to quickly understand what aspects of the product resonate positively with customers and what areas need improvement.
Another important feature is the specific product feature-level analysis. The app looks at what particular features or attributes reviewers frequently mention, highlighting both positives and negatives. This granular analysis shows businesses exactly which product features have an outsized impact on the customer experience.
Additional capabilities like suggesting potential improvements based on review analysis and leveraging AI for efficient natural language processing further improve the utility of the Product Review Analyzer. Businesses get clear, data-backed recommendations on how to iterate on the product to address customer feedback.
By consolidating and analyzing review content, the app transforms overwhelming amounts of unstructured text data into clear strengths, weaknesses, and improvement opportunities. This actionable output based on real customer experiences enables businesses to enhance product-market fit, boost customer satisfaction, and ultimately drive more sales.

Potential Improvements

Some more key optimizations can be implemented to further improve the application and make it more production-ready, rather than a proof-of-concept.
First of all, not all product reviews need to be selected to generate the result. Instead, what can be done is some data analysis beforehand on how helpful people consider each review, to only select the reviews that customers find beneficial. This way, the focus is on reviews that are proven to resonate with the end users of the products.
Secondly, the large Claude V2 model can be switched for a smaller, more focused model that is more aware of the context in which it acts. This way, cost is reduced while performance is improved.
In addition, instead of having a language model perform the "aggregattion" (ie. reduction) of the feedback, this can be done using other statistical techniques, as language models can have their biases and this process can be prone to error. Instead, it is possible to make the language model characterize the feedback from the user reviews and have the aggregation done by another method, and have the language model infer the results of this method to send to the vendor. This will make the review analysis process more robust.
Moreover, the chunk size of reviews that is fed to the model at every map iteration can be dynamically computed to optimize for the amount that results in the best performance for the number of API calls made to Bedrock. This will result in a better performance of the application.
Finally, the architecture can be altered to the one for the purpose of the application. While this was made with a user interface for demonstration purposes, it is more worthwhile that it interfaces with users through emails so it periodically gives updates on how their product is doing. This could be a part of a larger workflow showing an analysis of a vendor's product and how it fares in the marketplace.

Use Cases

This feature delivers value across ecommerce businesses. For example, consumer electronics companies can analyze reviews on the latest product models and rapidly address concerns. Similarly, consumer goods companies, like athleticwear brands, can track reviews around new apparel items and continuously improve fabric quality and fit. The applications span any vertical with Amazon products - the possibilities to employ AI for competitive advantage are vast.

Conclusion

In conclusion, the Product Review Analyzer is an invaluable tool for any business selling products on Amazon. By leveraging AI and natural language processing, it digests customer sentiment from product reviews to surface key strengths and areas needing improvement. The app transforms overwhelming amounts of text data into digestible insights that enable data-driven product decisions.
By shining a spotlight on crucial customer inputs, the Product Review Analyzer provides businesses with the intelligence they need to emphasize product strengths, address weaknesses, and iterate to improve customer satisfaction. The result is improved product-market fit, happier customers, and ultimately increased sales and revenue. For any consumer business selling on Amazon, this app provides tremendous value through unlocking insights from customer reviews.

Any opinions in this post are those of the individual author and may not reflect the opinions of AWS.

2 Comments