<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Xiaomeng Hu on Medium]]></title>
        <description><![CDATA[Stories by Xiaomeng Hu on Medium]]></description>
        <link>https://medium.com/@xiaomeng12?source=rss-1d0b0042a2df------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*AJIkF5mbkADOEzoOpvuGMQ.jpeg</url>
            <title>Stories by Xiaomeng Hu on Medium</title>
            <link>https://medium.com/@xiaomeng12?source=rss-1d0b0042a2df------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 14:15:12 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@xiaomeng12/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Beyond BM25 and dense embeddings: How we built smart and interpretable retrieval at Faire]]></title>
            <link>https://craft.faire.com/beyond-bm25-and-dense-embeddings-841a7b18ce27?source=rss-1d0b0042a2df------2</link>
            <guid isPermaLink="false">https://medium.com/p/841a7b18ce27</guid>
            <category><![CDATA[retrieval-system]]></category>
            <category><![CDATA[bm25]]></category>
            <category><![CDATA[semantic-search]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Xiaomeng Hu]]></dc:creator>
            <pubDate>Tue, 31 Mar 2026 14:46:44 GMT</pubDate>
            <atom:updated>2026-03-31T14:49:18.134Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Floating glossy chrome cubes and token-like shards are connected by thin black lines on a gradient background, suggesting sparse term expansion." src="https://cdn-images-1.medium.com/max/1024/1*Wbd1oN21mHaugrI8031Ztg.png" /></figure><h3><em>Abstract</em></h3><p><em>This blog post details how </em><a href="https://www.faire.com/"><em>Faire</em></a><em> implemented </em><strong><em>SPLADE</em></strong><em> (</em><strong><em>Sp</em></strong><em>arse </em><strong><em>L</em></strong><em>exical </em><strong><em>a</em></strong><em>n</em><strong><em>d E</em></strong><em>xpansion retrieval), a neural network-based search method that expands queries and documents with semantically related terms while maintaining sparse, interpretable embeddings compatible with existing search infrastructure.</em></p><p><em>In live experiments, the SPLADE-based retrieval system drove over 1% growth in total marketplace order value — a significant win at Faire’s scale — while preserving the latency and interpretability that engineers need to continuously improve the system.</em></p><h3>Introduction</h3><p>A retailer searches for “kids coat” but the most relevant product is listed as “children’s winter jacket”. Same intent, different words — and even modern retrieval systems can struggle to make this connection reliably.</p><p>At <a href="https://www.faire.com/">Faire</a>, search already combines multiple approaches — from exact-term matching to semantic retrieval and graph-based signals derived from engagement — but vocabulary mismatch remains a persistent challenge. This issue shows up constantly on large-scale marketplaces, where millions of products are described in inconsistent ways by hundreds of thousands of retailers. Bridging these linguistic gaps is a fundamental information retrieval challenge: how do we capture semantic meaning while balancing relevance, interpretability, and the latency and reliability required for large-scale search?</p><p>To tackle this, the Faire Search team adopted <strong>SPLADE</strong> (<strong>Sp</strong>arse <strong>L</strong>exical <strong>a</strong>n<strong>d E</strong>xpansion retrieval) [1], a neural retrieval method that expands both queries and documents with related terms to close the vocabulary gap. Unlike dense embeddings, SPLADE generates <strong>sparse embeddings</strong> — weighted sets of interpretable terms — that combine the semantic power of neural models with the efficiency of traditional inverted indexes.</p><h3>The challenge: lexical rigidity and opaque embeddings</h3><p>Prior to the introduction of SPLADE, search retrieval at Faire relied on a combination of sources. This ensemble included <strong>BM25</strong> for exact-term matching, dense embedding retrieval using <strong>K-Nearest Neighbors (KNN)</strong> for semantic similarity, and <strong>engagement-graph</strong> analysis to capture historical interactions between retailers and products.</p><p>Each of these components had inherent limitations. Traditional keyword-based retrieval struggled with vocabulary mismatch because it depends on exact token overlap. Many systems use <strong>BM25</strong>, which ranks documents higher when they contain the query terms, while down-weighting very common words and normalizing for document length. While this makes BM25 a strong baseline for exact-term matching, it cannot bridge semantic gaps between different words with the same meaning, such as “kids” and “children”.</p><figure><img alt="Conceptual diagram of the vocabulary mismatch problem: a user’s query and a relevant document use different terms for the same concept, challenging traditional search." src="https://cdn-images-1.medium.com/max/1024/1*RT-wlgEvHHOqdTql243DAw.png" /><figcaption>Search misses relevant items when terms don’t match.</figcaption></figure><p>Dense retrieval addresses this vocabulary mismatch by representing queries and documents as continuous vectors and retrieving nearest neighbors in that space. However, these models are fundamentally opaque, making it difficult to understand or debug why certain results are retrieved. Meanwhile, engagement-graph signals are inherently biased toward historical interactions and may fail to generalize to new or low-data queries.</p><h4><strong>Two key constraints guided our search for a new solution:</strong></h4><ul><li>First, interpretability was essential. We needed a retrieval approach that could capture semantic meaning — similar to dense embeddings — while staying interpretable and easy to reason about.</li><li>Second, the solution had to fit within a strict operational framework. Any new retrieval source needed to meet tight latency budgets and integrate with our existing Elasticsearch infrastructure. Dense vector search often requires specialized databases or hardware that can be difficult to manage at scale.</li></ul><p>These practical constraints ultimately led to the selection of SPLADE, which offers the semantic benefits of a neural approach while retaining the transparency and efficiency of a keyword-based system.</p><h3>Our approach: learned expansion without sacrificing lexical priors</h3><p>SPLADE was identified as a powerful alternative because it functions as a “learned lexical retriever.” It uses a transformer-based model to recognize the semantic connections between different words. This allows for automated term expansion, i.e. the process of adding relevant synonyms or related terms to a query or a document even if they were not in the original text. For example, a search for “car” might be expanded to include “vehicle” or “automobile”.</p><p>Rather than producing a dense vector, SPLADE generates a sparse vector the size of the model’s entire vocabulary. In these vectors, the vast majority of values are exactly zero. Only the words that the model deems highly relevant to the input text receive a non-zero weight. This sparse output is what allows SPLADE to be stored in a standard search index. Furthermore, the use of discrete tokens makes the system highly interpretable. Engineers can debug retrieval errors simply by looking at the list of expanded terms and their weights, making it easy to see exactly why a specific query matched a particular product.</p><figure><img alt="This image illustrates an example comparing SPLADE’s sparse, interpretable embedding representation with an opaque dense embedding." src="https://cdn-images-1.medium.com/max/1024/1*uoQW0bNRuMv1hvn1GHLLTQ.png" /><figcaption><em>Comparison of SPLADE and dense embedding models.</em></figcaption></figure><h3>SPLADE’s core mechanism: masked language modeling</h3><p>SPLADE’s core functionality builds on <strong>MLM</strong>, or Masked Language Modeling, the primary technique used to train <strong>BERT</strong> (Bidirectional Encoder Representations from Transformers). BERT is an open-source machine learning framework that analyzes text bidirectionally and uses both the left and right context of a word to understand its meaning.</p><p>In MLM, the model is trained to predict missing words in a sentence based on their surrounding context. For example, given the sentence “I’m taking my dog to the ____ for its annual shots,” the model can infer the word “vet” from clues like “dog” and “shots”. After training on millions of these examples, BERT learns rich relationships between words and concepts.</p><p>In the SPLADE architecture, this MLM head — which is natively designed to map abstract representations of words back to a real vocabulary — is repurposed. Instead of predicting just one masked word, the model processes every word in an input sequence. It then generates a probability distribution for the entire vocabulary for every word it sees. If a document contains the word “sneakers,” the MLM logic naturally assigns high weights to semantically similar terms like “shoes” or “athletic”.</p><figure><img alt="An illustration of the SPLADE architecture centered on the MLM component." src="https://cdn-images-1.medium.com/max/1024/1*RDh-PFscqqTtSFGy9FXc3g.png" /><figcaption><em>SPLADE’s model architecture.</em></figcaption></figure><p>To combine these token-level signals into a single representation, SPLADE assigns an importance score to each vocabulary word. It aggregates signals across all tokens, applies a ReLU activation (which zeroes out negative values) to filter out irrelevant terms and enforce sparsity, and uses logarithmic scaling to prevent repeated words from dominating the result.</p><p>The result is a sparse vector that captures semantic meaning while remaining interpretable and efficient for search, bridging the gap between traditional keyword matching and dense retrieval.</p><h3>Training for the wholesale ecosystem</h3><p>A significant challenge in machine learning is that models trained on general data, like Wikipedia, often fail to understand the specialized language of a retail platform. At Faire, we had to build a custom training pipeline specifically for the wholesale environment. This began with the use of a custom BERT model and tokenizer that had been pretrained on Faire’s own product metadata.</p><p>To align the SPLADE model with actual business goals, it was trained on an engagement graph containing a year of marketplace activity. This allowed the model to learn from real behavior. The signals were weighted based on their value to the marketplace:</p><ul><li><strong>Orders (highest weight):</strong> Direct evidence of a successful match between retailer and brand.</li><li><strong>Cart Adds (medium weight):</strong> A strong signal of purchase intent.</li><li><strong>Clicks (lowest weight):</strong> A signal of general interest or relevance.</li></ul><p>The model also used <strong>stopword removal,</strong> which zeros out common, low-value words like “the” or “a”. This reduced noise in the search results and ensured the model focused on the terms that actually define a product.</p><h3>When tokenization fails: lessons from ModernBERT</h3><p>Not every upgrade is successful, and one of the most instructive moments in this project came from trying a newer base model. We hypothesized that <strong>ModernBERT</strong> — a newer transformer with a larger context window and faster attention mechanisms — would improve performance.</p><p>Instead, it caused a significant drop in search quality. The culprit was ModernBERT’s <strong>Byte-Pair Encoding (BPE)</strong> tokenizer. BPE aggressively splits words into subword units. For example, while WordPiece keeps “candles” as one token, BPE breaks it into three fragments: [“c”, “and”, “les”]. For a search system that relies on matching meaningful terms, this was disastrous. The sparse vectors became filled with nonsensical subword dimensions. Because SPLADE is fundamentally a lexical retriever — it matches words — breaking those words into meaningless fragments destroyed its ability to find the right products.</p><p>This failure validated our earlier decision to stick with a domain-adapted WordPiece tokenizer. <strong>The lesson: in lexical retrieval, how a model tokenizes words matters more than the model’s raw capabilities.</strong></p><h3>Pooling strategy: the shift to max pooling</h3><p>In neural networks, <strong>pooling</strong> refers to combining multiple values into a single representative value. In SPLADE, pooling is used to aggregate token-level weights into a final search vector.</p><p>We experimented with several strategies, including mean pooling (taking the average) and sum pooling (adding them all up). However, <strong>max pooling</strong> proved to be the most effective strategy, which works by looking across all the input tokens and selecting only the highest activation score for each vocabulary word. This aligns with findings from the SPLADE v2 paper [2].</p><p>This method has two major benefits. First, it isolates the single strongest semantic signal for a concept, which helps ignore contextual noise. Second, max pooling naturally results in sparser vectors than other methods. Sparse vectors take up less space in a search index and are faster to retrieve, which was critical for maintaining the platform’s performance standards.</p><h3>The tripartite loss function and asymmetric sparsity control</h3><p>Training a model to be both semantically smart and operationally fast requires a balanced approach. The training objective used at Faire was a tripartite loss, meaning it had three distinct goals.</p><pre>Loss = Engagement Contrastive Loss<br>       + Product Sparsity Loss<br>       + Query Sparsity Loss</pre><p>The first goal was measured using <strong>InfoNCE</strong>, which is a type of contrastive loss. <strong>InfoNCE</strong> (Information Noise Contrastive Estimation) is a mathematical way to teach a model to identify a correct “positive” pair (like a query and the product a user bought) out of a group of “negative” pairs (the query and products that were not bought). It works by maximizing the agreement between the query and the correct product, while minimizing it for the incorrect ones.</p><p>The other two goals involved regularization losses, specifically <strong>L1 regularization</strong>. L1 regularization is a technique that penalizes the model for having too many non-zero weights, which encourages the model to be sparse and only select the most relevant features.</p><p>A key engineering breakthrough during this process was the use of <strong>asymmetric sparsity weighting.</strong> Search systems have two sides: the product documents (which are processed once and stored) and the user queries (which happen in real-time). We applied a much higher sparsity penalty to user queries than to product documents. This forced the model to keep query vectors small, which prevented the search engine from getting bogged down by too many terms. At the same time, product representations remain more expressive, increasing the chances that a compact query can still match relevant items.</p><h3>In-batch curriculum learning</h3><p>To further optimize the model, we implemented curriculum learning, where the model starts with easier examples and gradually moves to more difficult ones — much like a student progressing from basic to advanced problems. Using negative mining to define difficulty helps the model learn more nuanced distinctions and improve performance.</p><p>Early in the training process, the model compared its “positive” products against all other products in a batch. However, as training progressed, the system began to filter the batches to include only “hard negatives” — negative products with the highest logits. By the end of the training, the model was learning only from the top 100 hardest examples. This strategic shift significantly enhanced the model’s precision. While recall stayed the same, the curriculum learning successfully guided the model toward greater relevance.</p><figure><img alt="A three-stage diagram showing full batches being computed while gradient updates progressively focus on harder negatives, ending with the top 100 hardest negatives." src="https://cdn-images-1.medium.com/max/1024/1*oFji9yk83vEfRyV7G-v3rA.png" /><figcaption><em>In-Batch Curriculum Learning with Progressive Hard-Negative Filtering.</em></figcaption></figure><h3>Deep dive: avoiding query-time computation</h3><p>Deploying SPLADE into a live environment required solving several performance hurdles within Elasticsearch. Elasticsearch handles sparse vectors by calculating a dot product between the query and the document. Because this process is essentially a very long list of “OR” comparisons, keeping the vectors sparse was an absolute necessity for latency.</p><p>The most difficult challenge involved the Product Quality Score (PQS). The PQS is an internal metric that tells the system which products are historically popular or high-quality. Initially, the system would find the best matches using SPLADE and then adjust those scores using the PQS at the moment of the search. This rescoring step was extremely slow and blocked the project from being launched.</p><p>To save the project, we moved the computation to index time. Instead of waiting for a user to search, they combined the PQS and the SPLADE weights ahead of time during the ingestion phase. They multiplied the SPLADE embedding weights by the product quality score before saving them to the database:</p><pre>splade_embedding = (1 + PQS) * splade_embedding</pre><p>By doing this “index-time” math, we removed the need for any extra calculations during the search. When a user typed a query, the search engine automatically accounted for both the semantic meaning and the product’s quality in a single, fast operation.</p><h3>Evaluation methodology and metrics</h3><p>Computing recall across millions of queries is expensive and slows down iteration. To enable faster feedback, we built a lightweight evaluation dataset internally known as the <strong>Mini Eval</strong>. This dataset contained 20,000 real queries taken from historical logs. For each query, we mapped:</p><ul><li><strong>Positive Anchors</strong>: The top 30 products users actually bought or engaged with.</li><li><strong>Hard Negatives</strong>: 50 products that were often shown to users but never clicked.</li><li><strong>Easy Negatives</strong>: 100 random products from the catalog.</li></ul><p>The Mini Eval allowed us to get rapid feedback on new model versions. Only models that proved to be statistically better on this small set were allowed to proceed to full testing. Success was measured using three primary metrics:</p><ol><li><strong>Unique, High-Quality, Relevant Candidates</strong>: This was the most important metric. It looked specifically for products that were not found by any other search source, were of high quality, and were confirmed as relevant by independent models.</li><li><strong>Product Engagement Recall</strong>: This tracked how often the model successfully retrieved products that users eventually clicked, carted, or ordered.</li><li><strong>Relevance Score</strong>: This ensured that the expanded terms actually made sense and matched the user’s intent.</li></ol><h3>Results and impact</h3><p>SPLADE’s launch was a major success for the platform. In offline tests, the model increased the number of unique, high-quality, and relevant candidates for long-tail (rare) queries by over 30%. This proved that the expansion mechanism was doing exactly what it was designed to do: bridge the vocabulary gap where traditional systems failed.</p><p>In live A/B testing, the integration of SPLADE led to an immediate 4.27% increase in the value of orders coming from the search page. This initial improvement created a ripple effect across the entire platform, ultimately resulting in a 1.21% increase in total global marketplace order value. For a company handling billions of dollars in sales, a 1.21% increase is a massive financial and technical victory.</p><h3>Key learnings</h3><p>The deployment of SPLADE offered several important lessons for engineering teams working on search and machine learning.</p><ul><li><strong>First, index-time compute is almost always better for performance than query-time heuristics.</strong> By moving the calculation for product quality into the database itself, we were able to keep search times fast without losing any accuracy. This is a vital rule for any distributed system that needs to scale.</li><li><strong>Second, the architecture of how a model tokenizes words is more important than the scale of the model’s parameters.</strong> The failure of the ModernBERT upgrade showed that even a more advanced model can fail if it breaks words into fragments that don’t make sense for a lexical search engine.</li><li><strong>Finally, curriculum learning is a highly effective way to manage operational efficiency.</strong> By training the model on harder examples over time, we didn’t just make the search more accurate; those examples forced the model to create smaller, faster vectors that fit within its latency budget.</li></ul><h3>Looking ahead</h3><p>While our current SPLADE pipeline successfully mitigated the vocabulary mismatch, we are actively exploring future iterations to address its systemic limitations. One area of interest is reducing the bias toward historical data. Currently, the model learns from what people have bought in the past, which can lead it to suggest the same things over and over again. We plan to add new signals — like how users browse different categories — to help the model suggest more exploratory or new inventory.</p><p>Another exciting area is <strong>personalization</strong>. We are exploring ways to add retailer tokens to the model. For example, this would allow the system to expand a search for “decor” differently depending on who is searching. A luxury boutique might see results for high-end items, while a discount store might see more affordable options, all based on the same simple search term. This personalized expansion represents the next frontier in making search more intuitive and effective for every user on the platform.</p><p><em>Special thanks to our talented team of scientists, engineers, and leaders for their exceptional contributions and support</em>: <a href="https://www.linkedin.com/in/xiaomeng-hu-381a78170/">Xiaomeng Hu</a>, <a href="https://www.linkedin.com/in/deji-adejuyigbe-a0495869/">Deji Adejuyigbe</a>, <a href="https://www.linkedin.com/in/roman-shraga/">Roman Shraga</a>, and <a href="https://www.linkedin.com/in/jason-xu-a3450068/">Jason Xu</a>.</p><p><em>See past articles on our </em><a href="https://craft.faire.com/embedding-based-retrieval-our-journey-and-learnings-around-semantic-search-at-faire-2aa44f969994"><em>Embedding based Retrieval Journey,</em></a><em> </em><a href="https://craft.faire.com/graph-neural-networks-at-faire-386024e5a6d9"><em>Graph Neural Networks</em></a><em>, </em><a href="https://craft.faire.com/fine-tuning-llama3-to-measure-semantic-relevance-in-search-86a7b13c24ea"><em>Large Language Models (LLMs) tuning</em></a><em>, </em><a href="https://craft.faire.com/personalized-search-retrieval-at-faire-b210efb21133"><em>Personalized search retrieval at Faire</em></a><em> to learn more about how search works at Faire.</em></p><p><strong><em>Interested in the kinds of problems we tackle at Faire?</em></strong><em> We’re hiring engineers and applied scientists who want to deploy AI and machine learning in production to solve unique marketplace challenges and combine cutting-edge tech with real-world impact. Come </em><a href="https://www.faire.com/careers"><em>join us</em></a><em> in pushing the boundaries of what a marketplace can do with AI!</em></p><h3>References</h3><p>[1] T. Formal, B. Piwowarski, S. Clinchant, <a href="https://arxiv.org/abs/2107.05720">SPLADE: Sparse Lexical and Expansion Model for First Stage Ranking</a> (2021), SIGIR 21</p><p>[2] T. Formal, C. Lassance, B. Piwowarski, S. Clinchant, <a href="https://export.arxiv.org/abs/2109.10086">SPLADE v2: Sparse Lexical and Expansion Model for Information Retrieval</a> (2021)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=841a7b18ce27" width="1" height="1" alt=""><hr><p><a href="https://craft.faire.com/beyond-bm25-and-dense-embeddings-841a7b18ce27">Beyond BM25 and dense embeddings: How we built smart and interpretable retrieval at Faire</a> was originally published in <a href="https://craft.faire.com/">The Craft</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>