Master LLMs with our FREE course in collaboration with Activeloop & Intel Disruptor Initiative. Join now!

Publication

LLM-Powered Product Discovery: A Leap Beyond Hybrid Search
Latest   Machine Learning

LLM-Powered Product Discovery: A Leap Beyond Hybrid Search

Last Updated on August 1, 2023 by Editorial Team

Author(s): Maithri Vm

Originally published on Towards AI.

Photo by Markus Winkler on Unsplash

In this rapidly evolving era of cutting-edge technology, the world is immersed in the wave of LLM, churning novel ideas that revolutionize our daily lives. As the internet teems with a plethora of solution designs and niche possibilities, we find ourselves on the cusp of a transformative digital landscape.

This blog series embarks on an exploration of Product/Content discovery, striving not only to offer valuable perspectives but also to shed light on practical limitations within this realm. As emphasized throughout the series, context plays a pivotal role in this domain, and we have delved into the efficacy and mechanics of both semantic search and hybrid search systems.

Context is the King — The Art and Science of Content Discovery

— Exploring the power of Transformers, GPT, and Hybrid Search engines to revolutionise content discovery

medium.com

Hybrid Search — Amalgamation of Sparse and Dense vector representations for Active Content…

— Uniting meaning of data with metadata to leverage deeper context

medium.com

Additionally, the series has briefly touched upon the redefinition of Content discovery and Product search through the potent capabilities of LLM (Language Model-based Learning). In this particular post, our focus will be on LLM powered discovery, specifically targeting active search/explicit discovery to bridge the gap between hybrid search and LLM search paradigms.

By now, it should be evident that the true value of LLM lies in its remarkable capacity for generalization and its ability to apply knowledge in a broader worldly context, bringing us closer to achieving impressive outcomes via more natural interactions. Context continues to be a significant factor in the discovery process, encompassing not only the deep semantic micro-context of the content but also the vital aspect of developing an awareness of the evolving user context over time.

From Content to Knowledge Discovery and From Search Filters to Natural Language — Unleashing the…

If you have been following along my blog series starting from “Context is the king!” all the way to “From keywords to…

medium.com

As I delve deeper into the subject, I uncover several crucial contributions of LLM to the realm of discovery, particularly in the context of active search:

Knowledge-driven Content discovery using LLM — LLMs with the RAG (Retrieval Augmented Generation) pipeline possesses the capability to leverage the rich underlying knowledge present in the repository of documents efficiently. Through this, one can effectively surface relevant knowledge alongside the source documents. This revolutionary approach of Knowledge-led Content Discovery holds immense applicability in document-driven applications such as learning platforms like Coursera, Duo lingo and online content management systems like Medium, YouTube, and WordPress. Moreover, it extends its benefits to Enterprise apps like Sharepoint and Confluence, which host repositories of essential business documents.

An example scenario could be :
User: “Can I carry forward all my pending earned leaves to the next year?”
Bot: “Yes, you can carry forward upto 10 earned leaves across next year. Refer these documents for more details:”
Oranization_Leave_Policy_2023.pdf

By tapping into the inherent micro-semantic context within the content, this approach opens up new horizons for enhanced information retrieval and more insightful content discovery.

Metadata-driven Product /People discovery with LLM — Whether it is rich product attributes in an e-commerce platform or meaningful user profile attributes in a social media app, the abundance of metadata can significantly enhance contextual relevance within the broader spectrum offered by LLM. This convergence of entity attributes with content resembles the capabilities of a Hybrid search system, harnessing the combined power of semantic and literal textual contexts. Check my earlier blogposts that explore this aspect.

To effectively cater to hybrid search with the augmented semantic context in query and search filters, the use of Vector databases like Pinecone, Weaviate, or Solr becomes essential.

The integration of LLM can elevate the search experience to newer heights, capitalizing on the advantages it brings to the table. Here are a few such ideas that could potentially manifest:

a. Improved semantic representation with LLM: GPT models offer superior contextual understanding compared to BERT. While GPT models, including OpenAI’s GPT-3, are based on transformer architecture and predict the next word in a sequence, BERT focuses on fixed-length word or sentence representations without context. This difference makes GPT models more coherent and contextually appropriate in generating text, considering the entire preceding context for predictions.

b. Extensive product metadata enriched by LLM: LLMs demonstrate an exceptional capability to generate comprehensive and natural language product descriptions, encompassing all relevant metadata. For example :

Sample description in the search index for a kitchen product:
Introducing the ToastMaster 3000 — an efficient and sleek toaster with advanced toasting technology, wide slots, and a powerful 1200-watt heating element. Available in Classic Stainless Steel, perfect kitchen appliance with easy maintenance. Upgrade your breakfast routine today!

This approach proves highly advantageous for mapping user queries, especially those that are ambiguous or expressed in plain English, without specific acceptable values for filtering. By adopting this approach and eliminating cumbersome advanced search filters, the search experience becomes seamless and user-friendly. Users can effortlessly find precisely what they are looking for, even in complex and uncertain search scenarios. The use of natural language representation empowers smooth user interaction, making product discovery a breeze and enhancing overall user satisfaction.

c. Query expansion with LLM: Indeed, LLMs can play a pivotal role in generating descriptive strings that expand upon a user’s query. When the objective is content discovery, LLMs can go a step further by mining the inherent user interests, topics, or concept ideas. These mined insights can then be concatenated to the user’s original query, leading to a more comprehensive and extensive search coverage.

The user’s original query could go like:
easy to clean, high capacity small toaster
LLM-enhanced query could look like this:
A small toaster that requires minimal maintenance while offering a high toasting capacity for efficient and convenient breakfast preparation.

By incorporating these additional elements, LLMs facilitate a wider exploration of relevant content, ensuring that users are presented with a diverse array of results that align closely with their preferences and interests. This approach significantly enhances the content discovery process, providing users with a more personalized and enriching search experience.

Reranking the search results with LLM— Indeed, there are active projects where LLMs can be employed to generate relevance rankings for surfaced candidate results. Leveraging the LLM’s powerful ability to holistically generalize user queries against candidate descriptions and reason their relevance, these projects aim to enhance the accuracy and precision of search results. By utilizing the knowledge captured by LLMs, the ranking process becomes more informed and contextually aware, resulting in a more refined list of relevant results tailored to match the user’s intent.

Fully Natural Interface enabled discovery with LLMs— This can be seen as a bold leap towards transcending the frictions caused by traditional search boxes, filters, and pagination controls. Embracing a natural language interface, the “Talk to your data” approach, empowered by LLMs, takes center stage. Leveraging LLMs’ incredible generative capabilities, the search agent generates queries to interact with databases and retrieves the most relevant results, matching user queries and context provided during the conversation. Say farewell to the constraints of conventional search interfaces, and welcome a new era of intuitive and conversational exploration!

Example CUI-based discovery could like this:
User: I am looking for toaster for my kitchen
Bot generated query: product_category : kitchen appliance & product_type: toaster
<retrieved results shown to user>
User: show me only smallest size
Bot generated query: product_category : kitchen appliance & product_type: toaster & slot_size:2
<retrieved matching results shown to user>
User: hope these come with low wattage?
Bot generated query: product_category : kitchen appliance & product_type: toaster & slot_size:2 & current_capacity: 800 watts
<retrieved matching results shown to user>

Note: Observe the user’s query context is building through the interaction!

Implementation details for LLM-powered product discovery in Conversational User interface (CUI):

Talk to the data in natural language:

Regardless of whether the data is stored in a vector database or any other structured database, LLMs have the remarkable capability to generate queries for it based on natural language context. The key advantage of this approach is the ability to incrementally expand the query context during a conversation. By employing simple prompt engineering with few-shot examples, high-quality queries can be generated, which can automatically retrieve relevant results from the database.

Additionally, incorporating historical conversation as a memory to the prompt allows for the synthesis of comprehensive queries, encompassing all query context augmented by the user’s query and expressed filters to fine-tune the result set. This flexible and dynamic query generation process facilitates a more intuitive and conversational interaction with the data, unlocking a new level of contextual understanding and relevance.

Let us look at the detailed steps involved with implementation:

  1. Data Preprocessing: Generate comprehensive product summary in natural text, which encompasses all the metadata. Using LLM for this step is also imperative, given its proven dominance.
  2. Generating semantic embeddings powered by the GPT model. Generating dense vector representation for the product data (description) as well as the auto-generated summary (as seen in step#1). Choice of OpenAI embedding endpoint (text-embedding-ada-002) or using Sentence transformer (all-MiniLM-L6-v2) by Huggingface are favorite options amongst developers.
  3. Indexing the generated semantic embeddings (from earlier step) in vector db of choice like Pinecone, ChromaDb, Apache Solr etc. This must also consider metadata for ex : product category, genre, locality, ratings, etc associated with the document vector.
  4. Building query synthesiser which accepts natural language input from the user that produces the vector store queries as guided by the prompt (containing schema as well as few shot template as examples) as well as contextual memory. Additionally, one can also append topics extracted from the user’s query to infer her intent.
  5. Query Re-evaluation : The generated queries can be re-validated for possible errors, as well run through auto-correction by having another LLMs task dedicated for this step.
  6. Retrieve the results from the vector database, matching the queries generated and pre-validated by LLM.
  7. Present the results to the user while also adding the user’s further inputs and feedback to the conversation memory.

And the cycle through steps 4 to 7 as the interaction progress.

Retaining user inputs, including queries, filters, and feedback, within the memory is of utmost importance to extend the context of the user’s session. As user interacts with the search results and refine his queries, the valuable long-range context stored in memory enables tailoring responses to evolving requirements more effectively.

Indeed, while the concept may appear straightforward, I can assure you that hands-on experience with this approach involves a significant learning curve. Despite the impressive and promising results, my personal experience has uncovered certain challenges and imperfections. Let me share my observations, detailing the pros and cons of this approach to provide a more comprehensive understanding of its practicality and potential pitfalls.

Advantages of LLM-powered conversation search:

  1. The primary offering of LLM-powered search lies in its exceptional ability to deeply understand the user’s intent through inherent context. This understanding goes beyond merely interpreting the user’s descriptive requirements; it extends to efficiently interlacing these requirements with diverse product contexts, spanning unstructured, semi-structured, and structured data. The versatility and contextual prowess of LLMs make them an indispensable tool for unlocking the true potential of data exploration and enriching the user search experience.
  2. User interaction is completely in a natural format, which eliminates the hassle of dealing with menus, filters and paginated scrolling. The user’s expectation /query context builds over time across multiple turns of conversation and feedback provided by the user in the CUI. That way user does not have to enter keywords & filter repeatedly (which often leads to frustrations); rather the LLM search agent can do the heavy lifting of developing contextual understanding over ongoing interactions.
  3. LLM powered search exhibits flexibility to adapt to evolving search requirements —either due to the product schema updates or due to the changes related to UX. CUI allows for a seamless and dynamic discovery process and more importantly, the responsibility of updates primarily lies with the LLM model employed by the search agent.

And are there any caveats with this approach?

  1. Scalability and Prompt maintenance overhead: Exposing schema as part of the prompt can lead to token leakage due to the limited context length handled by LLMs.
  2. Maintenance overhead: Continuous updates to the prompts to keep them in sync with evolving schema is another unavoidable chore. To mitigate these issues, alternative strategies for handling schema and prompt management may be explored, ensuring a more seamless and robust LLM-powered search experience.
  3. Query quality with complex schema: The quality of generated query is most efficient when the data is spread across only a limited number of tables /collections. While it is easy to convert schema to denormalise the structure and have all elements part of single /fewer number of tables or collections, ongoing updates to vector databases in still not performance efficient. Continuous maintenance of transactional data elements (like price, availability, etc) is still going to be ineffective in vector databases.
  4. Query inaccuracies: Despite explicit instructions in the prompt and elaborate samples in a few shot templates, however, LLM-produced queries are still not devoid of errors. As erroneous queries lead to unfavorable outcomes upon database interaction, it is highly important to re-check the LLM-generated queries. Re-evaluating with CoT (chain of thought) prompting and auto-correcting the generated queries with another round LLM call is an alternate approach that can be considered. SelfQueryRetriever from Langchain is one such method that employs this approach.
  5. Increased latency: LLMs are large and complex language models, and their extensive computations require significant processing time, leading to increased latency. Owing to model size, token limitations, and resource constraints can often lead to increased delays in retrieving the obvious results.
  6. Risks to data privacy: It is imperative to evaluate the choice of LLM services with data security concerns in mind. While using off-the-shelf LLM services seems most reliable, the potential risk of sensitive information exposure and data breaches become a growing concern. Hosting open-source LLMs in a Virtual Private Cloud (VPC) can be an effective measure to meet the data privacy and security requirements.
  7. Increased cost: Whether opting for LLMs as a paid service or hosting customized LLMs on their own infrastructure, it’s crucial to acknowledge their resource-intensive nature, which directly impacts costs.

Due to these challenges, I have been consistently adjusting the solution design to create a text-to-database interface that comes close to perfection. Indeed, this is an opportune moment to unleash creativity and explore the vast possibilities of LLM.

There is one such idea that I have evaluated, which eliminates the need for maintaining categorical metadata and risks the outcomes to quality of queries generated by LLM —

Converting the entire product attributes set into comprehensive natural language descriptions, specifically for search purposes, and treating search queries as purely unstructured document retrieval is a compelling option to consider. This approach can simplify the search process and offer more intuitive interactions for users, leading to enhanced discoverability and user satisfaction. Another alternative, albeit challenging, is to develop independent LLM fine-tuned models for each contextual signal.

The above approach not only removes the dependency on queries to retrieve product data, it also offers a better generalization of these very categorical attributes in a worldly context with the power of LLM. A possible approach for this mechanism (as I have also quoted in my earlier post) could employ an LLM-generated product summary in the search database. And this may look like this:

Introducing our collection of enchanting blue party skirts designed specifically for 13-year-olds. Crafted with care and attention to detail, these skirts are the epitome of youthful style and sophistication. The vibrant blue hue adds a touch of vibrancy to any ensemble, making it ideal for special occasions, celebrations, or simply dressing up for a fun day out. With their comfortable fit and flattering silhouette, these skirts will make your young fashionista feel confident and ready to shine. Let her showcase her unique sense of style with these charming blue party skirts.

End user querying ‘sea blue teen skirts for birthday’ can fetch not only the above product but also all the relevant items matching similar intent!

In the midst of this thrilling Generative AI revolution, striking a balance between creativity and a pragmatic gain-to-pain ratio evaluation becomes paramount. By adopting a well-balanced approach, businesses can harness the vast potential of LLMs and make informed decisions that pave the way for successful and cost-effective solutions.

As I immerse in the myriad aspects of product discovery, I explore and generate innovative ideas for harnessing the capabilities of LLM; I eagerly look forward to having your perspectives or counterarguments, as it enriches our understanding and fosters a more comprehensive exploration of this exciting field! Stay tuned and subscribe for more captivating ideas and approaches in my upcoming posts!

Join thousands of data leaders on the AI newsletter. Join over 80,000 subscribers and keep up to date with the latest developments in AI. From research to projects and ideas. If you are building an AI startup, an AI-related product, or a service, we invite you to consider becoming a sponsor.

Published via Towards AI

Feedback ↓