Ecommerce ops · Production

Swiggy improves hyperlocal food search relevance using two-stage small language model fine-tuning

The problem

Swiggy's search must handle highly complex Indian food queries spanning regional dish names, dietary preferences, preparation styles, and occasion-based intents across millions of items, which simple string matching cannot resolve.

First attempt

Generic string matching does not retrieve relevant items for complex food queries, and base pre-trained language models without domain adaptation produced inconsistent search results across hyperlocal spaces.

Workflow diagram · grounded in source
1
Customer search query submitted
trigger
“The ability to accurately understand and serve customer search queries is critical to Swiggy”
2
Unsupervised domain adaptation
ai_action
“We then used Transformers and Sequential Denoising AutoEncoder (TSDAE) approach for unsupervised fine-tuning. TSDAE approach introduces noise to input sequences by deleting and swapping the tokens within the sentences. These noise induce…”
3
Supervised query-item fine-tuning
ai_action
“we curated more than 300,000 Query-Item relevant pairs which act as anchor-positive pairs to further pass into stage two”
4
Embedding similarity retrieval
ai_action
“this model is used to retrieve the top items among all the serviceable items in a particular area for a given query based on embedding similarity”
5
Incremental training feedback loop
feedback_loop
“We also ingested an offline incremental training pipeline where the complex customer queries and the existing results can be curated and corrected over a period of time. This is further passed into the stage two fine-tuning for continuou…”
Reported outcome

The two-stage fine-tuned all-mpnet-base-v2 model outperformed all baseline variants in overall MAP and Precision@5; the system includes an incremental training pipeline and is currently in experimental phase with a small cohort.

Reported metrics
Stage 1 training documents996,000
Stage 2 query-item training pairs curatedmore than 300,000
Query embedding generation latency constraintup to 100 milliseconds
Precision@1 improvementsignificantly improving
Reported stack
all-mpnet-base-v2all-MiniLM-L6-v2TSDAEBM25
Source
https://bytes.swiggy.com/improving-search-relevance-in-hyperlocal-food-delivery-using-small-language-models-ecda2acc24e6
Read source ↗

Frequently asked questions

What did this team achieve with this AI workflow?

The two-stage fine-tuned all-mpnet-base-v2 model outperformed all baseline variants in overall MAP and Precision@5; the system includes an incremental training pipeline and is currently in experimental phase with a sm…

What tools did this team use?

all-mpnet-base-v2, all-MiniLM-L6-v2, TSDAE, BM25.

What results were reported?

Stage 1 training documents: 996,000; Stage 2 query-item training pairs curated: more than 300,000; Query embedding generation latency constraint: up to 100 milliseconds; Precision@1 improvement: significantly improving (source-reported, not independently verified).

What failed first in this deployment?

Generic string matching does not retrieve relevant items for complex food queries, and base pre-trained language models without domain adaptation produced inconsistent search results across hyperlocal spaces.

How is this ecommerce ops AI workflow structured?

Customer search query submitted → Unsupervised domain adaptation → Supervised query-item fine-tuning → Embedding similarity retrieval → Incremental training feedback loop.