Embedding customized product recommendations in E-Commerce
The retail industry is undergoing a seismic shift as AI-driven tools like Retrieval-Augmented Generation (RAG) transform how businesses personalize customer experiences.
By blending real-time data retrieval with generative AI, RAG enables retailers to deliver hyper-relevant product recommendations that adapt to individual preferences, inventory changes, and market trends.
The Evolution of Product Recommendations: From Static Lists to AI-Driven Personalization
Traditional recommendation engines relied on collaborative filtering or rule-based algorithms, often producing generic suggestions like "customers also bought." While effective for basic cross-selling, these systems lacked contextual awareness and struggled with cold-start scenarios (new users or products). Modern RAG architectures overcome these limitations by integrating multi-modal data, leveraging semantic search, and reducing hallucinations.
RAG systems combine browsing history, purchase patterns, social media trends, and real-time inventory levels to view customer preferences and product availability comprehensively customer preferences and product availability. They use semantic search to understand user intent beyond keywords, mapping queries like "lightweight travel shoes" to breathable sneakers rather than formal footwear. By grounding responses in verified data sources, RAG minimizes inaccuracies and provides more reliable recommendations.
For instance, Walmart's Inventory-Aware RAG (InvAwr-RAG) has significantly improved ad relevancy. According to a recent study, this system increased ad relevancy by 68% by aligning user queries with live stock availability.
This enhancement improves customer experience, increases conversion rates, and minimizes wasted advertising spend. Below is an image capturing the essence of the paper, which you can read here.

This AI-powered assistant helps staff quickly locate items, answer product questions, and provide personalized recommendations based on a customer's purchase history and current inventory.
The image above provides a detailed overview of their RAG-based query rewriting system from start to finish. This system efficiently uses embeddings to align user queries with pertinent inventory items, considering product relevance and budget constraints in Step 1 to guarantee effective ad placements.
Step descriptions
How to replicate the effectiveness of the RAG
Step 1 - Query classifier: this utilizes an intelligent system that evaluates every user's search query. When a query shows poor performance (like low click-through rates), it is directed down a specific route to enhance its effectiveness. The focus is on optimizing resources and improving outcomes for challenging searches.
Step 2 - Dynamic retrieval of inventory items: they're on the ball, pulling the top N items from their database that match what the user's looking for. They use some fancy math (cosine similarity) to find the best matches while keeping an eye on the budget.

Step 3 - Preparation of query rewrite prompts: after identifying the relevant items, the next step involves creating prompts. These prompts integrate the original search with specific details about the items. The aim is to generate various alternatives for rewriting the query that comprehensively addresses all aspects without diverging from the main topic.
Step 4 - Rewrite query with LLM: they have an impressive AI model designed to help generate improved queries. This tool modifies the initial search to ensure it’s not only relevant but also aligns well with their inventory.
Step 5 - Get popular queries: they don't just rely on AI - they also look at what people are actually searching for. They grab popular searches from their logs that are similar to what the AI came up with, adding some real-world flavor to their suggestions.
Step 6 - Merge K queries and retrieval: here's where it all comes together. They mix the AI-rewritten queries with the popular ones from their logs. Then, they use these to find relevant ads. Their BERT model (it's a type of AI) checks each item to make sure it's really relevant before showing it.
It's a win-win: customers are happier, and the ads perform better.
This whole setup doesn't just show ads - it shows ads that people actually want to see, based on what they're searching for right now.
Their RAG system is like a bridge between what people are searching for and the products they might want to buy. By using clever algorithms and always focusing on what's relevant to the user, they're making the whole shopping experience smoother and more enjoyable.
Their cohesive integration allows the e-commerce platform to effortlessly meet a variety of customer needs. It operates efficiently, scales seamlessly, and ultimately enhances the online shopping and searching experience for all users.
Experiment and Results
The results for the InvAwr-RAG model, aimed at enhancing the effectiveness of Walmart’s sponsored search system.
Selection criteria for N items and K queries
Here's how they've fine-tuned our InvAwr-RAG model to work like a charmAdhering to these parameters ensures
An essential aspect of their methodology in the InvAwr-RAG model involves the selection of N=20 items and K=5 rewritten queries. These parameters were carefully determined based on both empirical evidence and operational efficiency, ensuring optimal performance and relevance.
Determining N=20 Items:
Their choice of N=20 items for retrieval from their vector database is grounded in the following considerations:
- Diversity and Coverage: Retrieving 20 items allows their system to balance diversity and specificity. These numbers are large enough to cover various aspects of user queries, yet manageable enough to maintain high relevance and avoid overwhelming users with options.
- User Experience: Based on user interaction data, they observed that presenting up to 20 items maximizes engagement without causing decision fatigue. Users are more likely to browse through and interact with a set of 20 well-curated product suggestions.
- Computational Efficiency: From a technical perspective, retrieving 20 items strikes an optimal balance between computational load and response time, ensuring their system remains responsive even under high traffic conditions.
Choosing K=5 Rewritten Queries:
Their decision to generate K=5 rewritten queries for each original query was based on several factors:
- Query Variation: Five rewritten queries provide sufficient variation to explore different linguistic formulations and product matches, increasing their chances of identifying phrasing that aligns with users’ intent.
- Precision and Focus: Limiting rewritten queries to five helps their system maintain focus and precision in suggestions, ensuring each query is highly targeted and likely to yield relevant results.
Adhering to these parameters ensures their system balances user needs with technical performance, delivering relevant recommendations efficiently and effectively.
Their research has demonstrated the effectiveness of the Inventory-Aware RAG-based Generative AI model (InvAwr-RAG) in addressing significant inefficiencies in sponsored search systems on e-commerce platforms like Walmart.
By dynamically rewriting queries to align with real-time inventory and ad campaigns, they have shown that the InvAwr-RAG model significantly reduces the occurrence of no-result queries and holds substantial potential to increase ad-related revenue.
Preliminary results from their system have shown promising outcomes. These findings highlight the potential of integrating advanced AI technologies to enhance the relevance and effectiveness of ad placements, thereby improving both user experience and advertiser ROI.
How can you implement this in your shop?
You can download them for free at the link below and start customizing them based on your needs.
Get Started in 3 Steps
- Sign Up to download it
- Search the article title or go to the end of the page
- Download the JSON file
- Upload into your N8N account
OR Book a free demo and ask me to customize it for your shop.
Why Wait? Every day without AI-driven search costs you sales—our clients gain 3x ROI within 90 days.