Retrieval Augmented Spelling Correction for E -Commerce Applications (2024)

Abstract: The rapid introduction of new brand names into everyday language poses a unique challenge for e-commerce spelling correction services, which must distinguish genuine misspellings from novel brand names that use unconventional spelling. We seek to address this challenge via Retrieval Augmented Generation (RAG). On this approach, product names are retrieved from a catalog and incorporated into the context used by a large language model (LLM) that has been fine-tuned to do contextual spelling correction. Through quantitative evaluation and qualitative error analyses, we find improvements in spelling correction utilizing the RAG framework beyond a stand-alone LLM. We also demonstrate the value of additional finetuning of the LLM to incorporate retrieved context.

## introduction new brand names are continuously introduced, and many of them use unconventional spelling to create specific associations while still ensuring that the brand is unique and memorable. prominent examples include "playgro" vs. "playground", "biotanicals" vs. "botanicals", and "hygeeni" vs. "hygiene". such cases pose a significant challenge for e-commerce spelling correction services, which are prone to over-correcting such terms, especially completely novel ones. in this paper, we seek to address this challenge by leveraging retrieval augmented generation (rag). on this approach, the user's query is passed to a retrieval module that seeks to find relevant items from a product catalog. the retrieved items are then incorporated into a prompt to a large language model (llm) that predicts a correct spelling for the user's query. we report on a wide range of experiments with different retrieval models and llms. we find that the rag-based approach consistently leads to large performance improvements with only minor latency increases. in addition, we explore methods for fine-tuning the llm to make better use of retrieved contexts, and we find that this leads to very substantial improvements, with the largest gains coming from queries that contain brand names. ## related work retrieval augmentation retrieval has proven highly effective across a wide range of knowledge intensive tasks. early works such as drqa @xcite and dense passage retrieval (dpr; @xcite ) laid important groundwork by integrating retrieval with neural models to enhance question-answering accuracy and facilitate knowledge access. realm @xcite introduced unsupervised retrieval for language model pre-training, and @xcite combined retrieval with generation to tackle knowledge intensive tasks. retro @xcite scaled these ideas by accessing a vast database of tokens for contextual relevance across large datasets. @xcite weakly supervise the colbert neural retrieval model to improve performance on open-domain question answering. overall, these approaches seem to help systems provide up-todate knowledge and reduce hallucinations @xcite . despite these advances, the specific challenges of contextual spelling correction in ecommerce settings, particularly for dynamically evolving brand names, remain underexplored. retrieval augmented fine-tuning retrieval augmented fine-tuning (raft) adapts models by fine-tuning them for specific tasks like question answering, with a strong focus on handling irrelevant documents to boost accuracy @xcite . similarly, atlas @xcite demonstrates the effectiveness of retrieval-augmented models for few-shot learning by integrating retrieved content during both pre-training and fine-tuning phases. while other models like rpt @xcite and replug @xcite also combine retrieval with generative capabilities, they either focus on black-box integration or training from scratch without fine-tuning on external context. our approach, akin to raft, fine-tunes the llm with task-specific data, distinguishing between relevant and irrelevant contexts, especially for complex non-standard brand names. this underscores the value of targeted retrieval in specialized tasks like e-commerce spelling correction. ## approach we now present our approach to spelling correction, which leverages retrieval augmented generation (rag) and optionally includes a phase of fine-tuning the llm to make better use of context. ## conclusion in this paper, we introduced a fine-tuned retrieval augmented generation (rag) framework tailored for e-commerce spelling correction, specifically addressing the complexities posed by brand names and other non-standard lexicons. we showed that this approach is highly effective even with a frozen retriever and frozen large language model ( in addition, we showed that fine-tuning the llm with retrieved context leads to even larger gains ( for long-term directions, we propose exploring mechanisms that enable llms to assess and selectively integrate context based on relevance and quality. such advancements could pave the way for smarter, more context-aware llms that distinguish valuable insights from noise, ultimately enhancing their adaptability in real-world applications. additionally, evaluating models with context on emerging entities could provide a more dynamic measure of rag's effectiveness as new content enters the dataset. these lines of inquiry contribute insights into optimizing llms within rag frameworks, driving advancements in the broader field of adaptive language models and their application in context-sensitive domains.