Distill the LLM, Don't Serve It: Search & Personalization at DoorDash — Raghav Saboo, DoorDash
AI Engineer · 22 min · 169 sentences · from YouTube's caption track
Each timecode opens YouTube at the start of that sentence. Line anchors (#s42) are the cue ids in the WebVTT, and every line carries its start and end seconds. All transcripts has every talk, and the whole corpus as one file.
- 00:12Thank you everyone for coming to this talk and Devanch for organizing this.
- 00:17Uh I'm Ragav.
- 00:18I'm a staff uh machine learning engineer at Door Dash.
- 00:21I work on search and personalization and uh today I'm going to talk about uh the ways that we're integrating LLMs for you know our marketplace discovery uh specifically in four pieces and
- 00:35um how these primitives are kind of uh uh working towards our integration of LLMs into traditional uh Rexus as well.
- 00:45So I'll start off uh today uh with a simple claim.
- 00:49Uh the claim is that to build effective discovery in this case for a marketplace like Door Dash the real bottleneck is semantic understanding.
- 01:01So that is knowing what you know actually what items mean uh for users given some context and what a shopper actually intends to do on you know an app like Door Dash.
- 01:17And historically we have treated these uh as engagement optimization problems.
- 01:23Um however LLMs give us a genuinely new lever to extend this.
- 01:30So this talk is about uh you know the four primitives that have allowed us to start leveraging LLMs for problems at Door Dash.
- 01:41As you may know Door Dash is now grown uh well beyond restaurants.
- 01:46So we're in grocery, retail, pets, gifting and more.
- 01:50And our goal is to capture every shoppable moment.
- 01:55Uh and we know that across these verticals, the users frequently have very broad shopping missions, right?
- 02:03So for example, a consumer may say when they come to our app is, you know, I just adopted a puppy.
- 02:10What do I need to get started this week?
- 02:13And this consumer start may start on like searching for puppy food because they just adopted the puppy.
- 02:20That one query could unfold into further query reformulations.
- 02:25Um they land on collections for you know other shopping needs, complimentary items such as crates, leashes, uh training pads all the way to checkout.
- 02:38And this could happen over multiple sessions, mult multiple days, right?
- 02:43And capturing that whole arc is pretty hard because it spans multiple models.
- 02:48Um, and this is where the four primitives I will cover come in.
- 02:55Specifically, supervision, catalog semantics, semantic personalization, and steerable content generation.
- 03:03As we heard previously as well, it's a system of shared representations that help us map this customer's journey uh with the use of LLMs.
- 03:14Now, with supervision, the question we're asking or looking to address is how do we teach our retrieval and ranking systems what good means for different tasks?
- 03:25And here's a simple example, right?
- 03:27A shopper searches for gluten-free pasta.
- 03:30And if we only rank from engagement, very popular regular spaghettes might show up and because it sells well, you know, it may continue to show up.
- 03:40Even gluten-free white bread might be retrieved and, you know, show up because it overlaps with gluten-free.
- 03:46But neither of these are clearly the right answer.
- 03:50What we actually want is graded relevance.
- 03:53A true, you know, gluten-free pasta should be a high relevance item.
- 03:58Chickpea pasta might be a reasonable substitute and regular spaghetti while it's popular it fails the constraint that the user has.
- 04:07Now to solve this there are obviously two sources of truth.
- 04:10We could look at human annotation but that's expensive slow and becomes quickly stale because our catalog changes quite rapidly.
- 04:22Second is behavioral signals.
- 04:23They're abundant but obviously as I mentioned biased by exposure, position, price, promotions and you know previous model choices.
- 04:33So the missing signal is a scalable reasoning signal.
- 04:37This is where LLMs are very useful as they offer a way to produce that supervision for such tasks.
- 04:44So in our case, you know, the PIP pipeline starts with human ground truths.
- 04:50uh we build a high quality seed set of example query item pairs and on a three three uh level relevant scale 012.
- 05:00We audit the suspicious cases.
- 05:02For example, if a human label says you know that an item is irrelevant but that item performs very well on add to cart or conversions, we send that case to a stronger LLM
- 05:14uh to re-evaluate with more granular prompts.
- 05:17We also reconcile with other models.
- 05:20You know, for example, our query to taxonomy or category models.
- 05:24And if a query, you know, query maps to a set of valid categories and the items belong to those valid categories, we may adjust the label accordingly.
- 05:33And through this process, we're able to achieve a pretty high precision golden data set that we then fine-tune a lightweight LLM, let's say, for example, a GPD 40 mini
- 05:45on top of it.
- 05:46And that's when it, you know, really pays off.
- 05:50We are able to use that fine-tuned labeler offline across, you know, our full catalog to generate uh full graded query item pairs.
- 05:59And those labels become one shared target for both retrieval and ranking systems.
- 06:04This pattern has been pretty important for us over the past uh few years.
- 06:10um use you know expensive reasoning once offline then distill it into models that can you know be served cheaply and quickly.
- 06:22Now let's take retrieval first.
- 06:24The challenge is you know standard embeddings um at e-commerce scale quickly collapse the relevance uh distinction.
- 06:32items that are merely related sit close to items that actually match and the model uh may know two items are related but not be able to separate uh exact matches, substitutes,
- 06:44compliments.
- 06:46So our fix is a two-stage contrastive method um trained on uh the same graded labels.
- 06:52Stage one, which we call mining, does a global geometry shaping.
- 06:57We use two tower encoders uh with multi-level supervised contrastive loss.
- 07:02Um after that we use that base model to mine harder negatives and uh these are items that the model confuses hard negatives that are ranked too high or strong positives ranked too low.
- 07:17And the second stage after that is where we really put the model through curriculum training.
- 07:24uh use those hard negatives, relabel them and our uh you know relevance of the retrieval layer improves sharply after that.
- 07:33So after stage one we see overlaps between you know relevant and uh moderately relevant but after stage two there is a significant difference and this has been one of like our biggest
- 07:45uh levers in retrieval improvement uh across the board.
- 07:50um you know we've improved NDCG of relevance by 2.3%.
- 07:54And uh that's also been true with our downstream business metrics and we did the same with uh uh exercise with our ranking models as well distilling LM reason labels
- 08:07into our rankers.
- 08:08However, combining this with uh business and engagement objectives.
- 08:15Here we add a new tower uh in this case an ordinal uh relevance tower on top of the LLM graded labels and uh this prediction sits right alongside existing engagement towers
- 08:29uh click add to cart and conversion and since they share the same uh bottom layers the semantic fit and relevance fit gets distilled in the same backward pass and
- 08:40uh our model is able to predict uh you know probability of relevance across the different levels and we are able to blend uh through a value function on on top of this
- 08:52that allows us to uh fine-tune between engagement and relevance for different surfaces.
- 08:59Now these two examples are part of a larger theme of our work across similar projects uh where it seems right.
- 09:07We're not replacing the retrieval and ranking system with an LLM, but rather distilling the uh reasoning and understanding into some production ranking architecture.
- 09:17And this allows us to kind of quickly test and also scalably improve our models uh with LLMs while keeping uh you know the business and system objectives uh of these surfaces in mind.
- 09:31So once we have supervision, the next question is how do we represent a very large and constantly changing catalog uh in a way that every model be it language models or
- 09:43uh you know traditional retrieval and ranking models uh that they can understand and at you know Door Dash's scale uh you can imagine we're kind of surfacing items across stores across
- 09:54internationally actually uh now and you know that's easily a few billion items at the store item level and for these items you obviously have unique skew ids but it says nothing semantically.
- 10:08So we also have a human curated taxonomy that helps us classify and categorize these items into meaningful spaces.
- 10:15But often this is too coarse and too rigid.
- 10:19So for example something like hot sauces may just have like sauces hot sauces in the taxonomy uh but it doesn't tell you anything about the relationship between hoof or franks or tobasco.
- 10:33So that's where we've also adapted uh or adopted um semantic ids.
- 10:39Uh it's been introduced previously already.
- 10:41It's a backbone for a lot of our uh work uh now.
- 10:47And uh what it does is it gives us a you know a short hierarchical code that's analogous to our taxonomy but uh the ability to control the fine grain nature of it.
- 11:00And the result of this learn taxonomy is that each item gets this hierarchical code and the prefix captures broad neighborhoods and you know the later tokens capture finer distinctions.
- 11:15So for example in the map over on on the slide you'll see hot sauces and the structure emerging from the data with zero labels.
- 11:24each one share the same first and second prefix in this uh ID sequence but then split by specialtity.
- 11:32So now you've got Mexican, Caribbean, Korean hot sauces uh being split up.
- 11:38And the important property is that this code that's learned is you know comparable by as I said by prefix but also usable by all of our downstream models and that unlocks a few things for us.
- 11:53So the first is cross-category comparisons or relationships.
- 11:57You know chips, salsa, guacamole may live in different taxonomy branches but a shared semantic ID neighborhood can uh indicate that they belong together and maybe a shopping mission.
- 12:08Second cold start problems.
- 12:10uh oftentimes we get new catalog items added by stores and with techniques like engram and bite parent coding of these tokens we're able to scalably add these to our models as sparse ID features
- 12:24third tail coverage so sparse items uh and uh inherit a lot of signal from semantically related items and uh you know we don't have to wait for the volume or exposure
- 12:38uh to you um for to consumers for these items.
- 12:42And then lastly, nice to have is the fact that we can actually also do a reverse audit.
- 12:48So we can audit our catalog and how well our human labels agree with the semantically learned labels.
- 12:56So a couple of examples of where we're using it today uh just to get give some real metrics.
- 13:02Um it has been one of our biggest improvements to our ranker.
- 13:06Um in in this case it's actually improved our uh ranker by uh improving MRR between four to 5% and that's translated to pretty big conversion uh wins as well.
- 13:18The second one that I'm particularly fond of is query reformulation.
- 13:23So again going back to the hot sauce example, Sriracha can lead to garlic chili garlic sauce or sambell Ole and because these queries map onto like our catalog grounded
- 13:36semantic neighborhood uh that results in much more relevant queries that we're suggesting to users.
- 13:44Um ultimately if these are queries that we don't have inventory for on Door Dash, they're meaningless.
- 13:51And with the addition of semantic ids in this query graph, we were actually able to see pretty massive um MR gains as well uh for for this piece of work.
- 14:03So for now we've talked about you know item mapping and relevance and the next question is consumer context.
- 14:10What does the system know about the shopper and can that knowledge be reused across models again?
- 14:17And this is where uh our third primitive comes in memory.
- 14:22So memory in the agent context is pretty well understood now.
- 14:26Um we apply the same concepts to uh our recommendation systems.
- 14:33So user embeddings are clearly very useful.
- 14:36uh we have many representations of our consumers but they don't necessarily get to uh why a consumer may have certain intents um and why they might have certain preferences.
- 14:50Additionally, LLMs cannot uh readily use these uh embeddings.
- 14:54You could tokenize and like uh train these models to learn it.
- 14:58But oftentimes having some explicit LM native counterpart is very useful and that's what we found.
- 15:05So the idea of memory is to represent uh the consumer in multiple forms semantic in you know inspectable and reusable and uh the way we think about memory is uh in three time scales.
- 15:22So long-term memory captures durable preferences from orders, searches, browsing, support interactions.
- 15:31Real-time context captures uh agentic inter interactions um oh sorry in session interactions so cart state active searches and then we have stated preferences which come from agentic interactions so something like ask door dash for example
- 15:49where consumers are able to explicitly state their constraints and preferences as well and the way we represent consumers in uh in uh this long-term memory is through uh memory blocks.
- 16:02And these are structured in a way that allows uh us to add new dimensions of the user, you know, from dietary preferences to dining preferences to uh substitute pre uh preferences
- 16:14um as we learn more about the consumer and that is uh decoupled from like the downstream system that u that doesn't need to reinterpret uh this for their own use cases.
- 16:27So each consumer's memory is multi materialized in multiple forms.
- 16:31So first is text that's human readable.
- 16:34It's uh captures the consumer in a compact way.
- 16:37Second is are latent vectors embeddings of those memory blocks that can be fed into retrieval and ranking systems.
- 16:45And third are graph and tree or hierarchical approaches.
- 16:49So uh you know type relationships between consumers and brands taxonomies and memory uh revealed um preferences and these are assembled into you know composite memory objects that both ML models and LLM use downstream.
- 17:07So an example is you know this context graph uh where we connect consumers with extracted memory concepts and a graph needs fits neatly into shopping journeys because you know oftent times
- 17:21uh consumer item interactions are sparse and multihop.
- 17:25And in this case these context graphs are able to link consumers across memory concepts that we previously did not have uh relationships for.
- 17:35And it's particularly helpful uh at fine grain taxonomy levels.
- 17:40In our case, we're seeing uh for retrieval uh uh using uh graph uh based embeddings outperforming our uh existing taxonomy based embeddings.
- 17:54And today this memory framework shows up in three places.
- 17:58The first is personalized collections.
- 18:00I'll talk about that a bit later.
- 18:02Uh second is agentic personalization.
- 18:04So ask door dash for example uses this to personalize its sessions uh for you.
- 18:10And third in uh retrieval and ranking models as I said we encode these memory blocks and feed them as features in in downstream models as well.
- 18:22So the fourth primitive is steerable content generation.
- 18:25We heard quite a bit about it in the previous talk and this slide is my take on how we're p piecing all these uh primitives together.
- 18:35So all of these inputs, semantic ids, memory blocks um and graded relevance or um LLM supervision feed into multiple models you know be it LLMs or small language models or
- 18:50um uh you know traditional models and from these inputs we can generate different output shapes you know ranked semantic ID lists, carousel titles, subcopies and these show up across different surfaces today on Gord Dash
- 19:04and A direct example of this is uh our um personalized collections on store pages.
- 19:11So historically collections on store pages uh on Door Dash have been a fixed library or attribute-based um and we've been able to kind of expand that through uh consumer level
- 19:26collection generation.
- 19:28And today this is an offline uh LLM process where we take in consumer memory semantic ids and syni syn synthesize uh collections um all the way from title subtitle to the actual items.
- 19:42And the important part is that control and steerability.
- 19:45We're able to react to occasions and moments um and build those collections as needed uh for different consumers at serving time.
- 19:57uh because this is all batch and uh generated offline through LLMs, we are able to still use our uh existing retrieval and ranking stack for item hydration, collection ranking, etc.
- 20:11And you know this is for example what a shopper actually sees, right?
- 20:14For a shopper with plant-based affinity, the system can generate plant-based pantry rows.
- 20:19For cat-only households, it can generate cat dry food rows.
- 20:23And if a session indicates that you know a person is going through pantry restocking it can bias towards pantry staples.
- 20:30And our early tests show that you know consumers are feeling the benefits of these tailored experiences.
- 20:37Uh an example is uh within our pets vertical we've been able to drive uh close to 1% uh order rate increases and 6% in uh active users.
- 20:48So to conclude uh there are three takeaways I would love for you to take away from this talk and how LLM fit into search and recommendations.
- 20:58First discovery is a semantic understanding problem.
- 21:02It's not only about engagement.
- 21:04LMS give us a way to reason about item meaning and shopper intent.
- 21:09Uh in in Door Dash's case for example.
- 21:12Second uh distill LM reasoning into primitives.
- 21:16capture you know reasoning uh offline as labels, semantic ids, memory and then let smaller and faster models serve it.
- 21:26The online LLM call is often not the product architecture you need.
- 21:31Third, shared representations create many use cases.
- 21:35Uh once you have these primitives, they can power, you know, retrieval, ranking, content generation, etc. So last but not least, thank you and thank you to all the collaborators at Door Dash who have helped ship a lot of these things as well.