← Library

concepts · youtube · 11 min

Evaluating Enterprise Retrieval and Agent Search at Glean

Hamel Husain · Nov 19, 2026

How to Evaluate Agent Retrieval

Channel: Hamel Husain
Published: 2026-11-12
URL: https://www.youtube.com/watch?v=hzWv-apa4k4

Join the next AI Evals cohort: https://maven.com/parlance-labs/evals?promoCode=yt-2026

Get the free AI evals guide: https://bit.ly/evals-guide

Manav Agrawal and Lauren Shrack from Glean's search quality team walk through how they evaluate retrieval for enterprise search and their AI assistant. They cover building eval sets from real usage and synthetic data, retrieval and citation metrics, LLM judges, and how a ranking change moves from offline evals to a live A/B test.

Transcript

Welcome everybody. I'm really excited about this guest talk from these folks at Glean. If you don't know, Glean is basically the goat in enterprise when it comes to retrieval. They have pretty much dominated the space and were one of the first people to focus on retrieval in the enterprise. I've always wondered how they do evals. So go ahead and kick it off to Manav and Lauren.

Thank you very much Hamel for giving us the opportunity to present what we do here at Glean. What we are going to be presenting is work of a lot of great engineers at Glean and years of iteration and experimentation. I'm Manav. I work in search quality. I've been at Glean for one and a half years.

Yeah, I'm Lauren. I'm also an engineer on Glean search quality team. I've been here about a year and yeah, super excited to be giving this talk.

We'll be going over how we collect data, eval new work, ranking changes, and launch progress. So just to give people context about what Glean is about, here's how search works. You can find all your documents across different data sources and then in chat, you can ask any questions about a particular topic in your enterprise. You can create docs, you can create slides, and this is the interface for the chat. It goes through your corpus, finds the documents, looks at different data sources, and then cites the answers. This is just to give an idea of what we're trying to evaluate because it's very important to really understand the product and the data we're working with. Glean started off as enterprise search and now we're doing assistant. We're trying to do co-work and help do work for you.

The Agenda

The agenda for today's talk covers how we build eval sets, how we run evals, how we make sure we can launch a change end to end, and what we monitor after launching.

One question that we generally ask, and that new joiners wonder, is why we're not using more open source retrieval benchmarks. I wanted to highlight some of the problems we have. We can't just import a lot of open source retrieval benchmarks for several reasons.

Number one: large indexes. We have customers with billions of documents that are diverse across tens of 20 data sources and we have almost 275 plus app connectors. It's really hard to get a good open source retrieval benchmark that has diverse enough and private data.

Number two: our search is very permissioned. You're going to see only whatever you have access to. Making sure our search is correctly permissioned is crucial, but a lot of retrieval benchmarks have documents with access to everyone and you don't know which document has access to which person.

Number three: we build a lot of signals from these documents—lots of visits, lots of authors (who's authoring which doc), how fresh a doc is. A lot of these signals get lost in open source benchmarks.

Therefore, we need to create our own eval sets and benchmarks that can accurately measure and reflect what we do here at Glean.

Building Eval Sets

We primarily build two types of eval sets. We build some from historical usage data and some from synthetic data based on a document corpus.

Eval Sets from Historical Usage Data

These are built from real use of Glean search and Glean assistant by our internal users here at Glean. For info seeking, we build a few types of these eval sets:

  • Search eval sets for evaluating document retrieval
  • Context selection eval sets for evaluating selecting specific relevant snippets within documents
  • Full end-to-end chat eval sets

Search eval sets: These map the search query to a document. If you're making a search query for, say, Manav's Waldo launch document, you want that launch document to be at the top of your search result page. We're able to mine these from both Glean Search (where a user types a search query and clicks on a document, and we assume that document is the canonical one we should retrieve at the top) and from Glean Assistant. As we've moved into the LLM world, it's important to also mine these from how Assistant is using the search tool. When Assistant makes a query to the search tool, we map that against whatever document it finally cites in the response to the user.

Context selection eval sets: An important part of Glean Search is not just retrieving the most important documents for a question, but also doing context selection within those documents. When we return context to the LLM, we show specifically the snippets within the document that we think will be relevant to answering the question, as opposed to showing the entire content or no content. We keep track of what specific snippet within a document was cited by the Assistant in a response and use that to build an eval set between the query and the canonical snippet.

Full end-to-end chat eval sets: We build these based on just the user's original query. We don't have a concept of a canonical here because we don't really know whether the historical chat response was actually correct. Instead, this is an input-only eval set of all the things people have asked Glean Assistant.

Example: Mining Data from a Chat Session

Here's an example of how we'd mine all this data given a chat session. A user asked: "When did Manav and Kunal launch GPT-4 for Waldo 2?" The Assistant does searches, finds the document, and responds citing both the document it used to answer the question as well as the snippet within that document.

From this, we would:

  • For our search eval set, take the search query that was issued to Glean search and map it to the canonical document that was cited in the response.
  • For the context selection eval set, do the same except now map to the actual snippet within that document that was needed.
  • For the chat eval set, just take whatever the input user query was.

Infrastructure for Eval Sets

We log and have all the Glean traces. Once we have production traces, we have pipelines that are essentially map-produce jobs. Their job is to go through the traces, filter and tag the traces we want to run evals on, making sure we're de-duplicating and removing any experimental or debug traffic. Once we have a representative sample of the traffic, we get the actual entries which Lauren mentioned earlier. Then we can build upon our chat eval sets, search eval sets, and context eval sets. These pipelines run periodically, making sure we have access to fresher eval sets for our engineers to really evaluate their ranking changes or chat changes.

One of the other things we really want to make sure is that we have the ability for our quality and research teams to make their own custom info-seeking eval sets. A lot of times we'll have a change that's a very specific feature change. For example, an engineer might be working on adding an operator filter. This is basically when you search, you can do "app:slack" or "app:whatever"—anything you want to search over. Chat also has the ability to trigger these operators. Let's say you want to build a slice out of these main queries and see how our ranking is currently doing on these sets. You can essentially go through our data, filter by operators (this is basically all logged in SQL), and once you have all of those entries, you can add it to our tool and get those sessions out of it. Then you can run evals on that specific eval set. This helps us build custom feature eval sets, which is very important when you're working on ranking changes because a lot of times you might not be affecting the entire traffic and you want to scope down to a specific feature.

Synthetic Eval Sets

The other type of eval sets we build are synthetic eval sets, which Lauren mentioned earlier. These eval sets are based on a document corpus and generally have a canonical answer. What we really do is identify some of the important documents based on the Glean signals we have. We have a lot of signals such as when the document was added to the corpus, how fresh it is, and how many people are visiting the document. Once we have that document, we can use an array of LLMs to generate question-answer pairs. Based on that, we can create the chat, search, and context selection eval sets.

This is the general process: once we mind top docs, we sort of clean it, filter it, and figure out what passages are relevant. Then we chunk the passages—split each document into different passages. Then we ask an LLM (using some of our historical queries so the LLM writes queries that make sense and are well-aligned to the user distribution): how can we create queries that reflect what someone would ask about a document or how an LLM would ask about a document? Once we have those question-answer pairs, we do another quality filtering to see if these are acceptable questions and answers. Then we create that eval set.

Here's an example. We have a snippet of a document and we decide it's our canonical document. Let's say a query that the LLM comes up with is "Who launched Waldo 2?" We know that the canonical answer is authors Manav and Kunal. LLMs have become a lot better at creating great question-answer pairs from documents, and this also becomes the canonical snippet for our snippet and context selection eval sets.

Running Evals

Our eval running process has an eval orchestrator that runs an eval set in a batch. It loads an eval set from storage that we produced with the pipeline I just talked about. Then it runs all of the queries in the eval set through basically our production search and chat runners and then takes those responses and computes metrics from those results.

Guardrails and Reproducibility

First, there are a few things we need to do within our search and chat runners to be able to run these eval queries. We have some guardrails:

Rate limiting: If we're running a large batch of eval queries—like 1,000 searches—through our internal production system, we want to avoid overloading our system. So we put all our eval entries in a queue and rate limit them as we run them through.

Forks within execution: We keep eval queries from contaminating our regular production data. We have logging sinks where we try to keep regular production queries separate and don't want eval queries to contaminate those sinks. We also have specific logging and metrics that we might run specifically for eval queries—logging information about why documents were ranked the way they were or debug information.

Reproducibility: If your eval set was built a week or two weeks ago and maybe the documents have changed in that time, we want to be able to reproduce the historical behavior as closely as possible. So we'll pass the original timestamp that the query was executed, and then we have some back-end search logic to basically try to mimic the state that the index was in at that time just to keep things reproducible.

Metrics for Search Eval Sets

For our search eval sets, the goal is document retrieval. Obviously, the important goal is that our canonical document or in some cases multiple canonical documents for one query should all be concentrated at the top of the search results. In our base arm, we might see that the canonical document is ranking at the second position, and in the test arm it's ranking at the top, which is an improvement.

We have a few different metrics that we compute:

Recall at K: Generally, our search tool typically retrieves 8 to 16 results. What we really care about is recall at either 8 or 16 to make sure it's actually in that top batch of results.

Position: We also want it to be as close to the top of those results as possible. There's a more continuous signal to optimize on, and typically we allocate more snippets for context selection to things that rank high. So we want to make sure our canonicals are concentrated as close to the top as possible.

CR at K: Finally, we measure what we call CR at K. This basically measures how much the overall ranking changes within the top K positions.

Metrics for Context Selection

Our goal with context selection is given a document, we want to retrieve information from that document that is useful to answer the question without totally overwhelming token budgets. The two metrics that matter here are:

Snippet recall: What percentage of the canonical snippets are retrieved? We want to make sure all of those snippets are retrieved while minimizing the size of the result. For example, on one side we're retrieving the whole document, which means we get the canonical snippet, but the tool output is really large, and so...

(capture appears truncated)