Stop Paying LLM Prices for Yes-or-No Answers — Chinmay Goyal, Glean
Loading slides…
Read the talk
Stop Paying LLM Prices for Yes-or-No Answers
Glean Assistant writes answers, picks experts, ranks follow-up questions, and checks citations. Chinmay Goyal shows what changed when Glean moved bounded decisions to TypeSafe’s Jev, from faster expert routing to higher recall in the first security pass.
From a talk by Chinmay Goyal
At a glance
Ideas worth remembering
Give each decision its own success measure. Q tracks deadline misses and invalid outputs separately. The citation check measures repeatability, and the first security pass measures how many actual positives it catches.
Count the work around the model. Changing labels can trigger retraining, variable verdicts can trigger repeat calls, and a dedicated classifier can multiply maintenance across customer deployments.
What does this model call need to return?
Before an expert can answer a question in Glean Assistant, the product has to pick which expert gets it. Glean was paying the cost and latency of a general-purpose LLM to choose from a list. Chinmay Goyal, a software engineer on Glean Assistant, starts with several decisions of this kind. An intent classifier chooses a category, a ranker picks a suggestion, and a citation check returns a verdict. Watch from 0:35.
Glean tried general-purpose LLMs, base open models, fine-tuned models, and TypeSafe’s Jev. Jev returns a structured decision over supplied options. When Glean needs to revise the categories the model can choose from, it can edit the prompt. Maintaining a fine-tuned classifier can mean preparing data and training it again every time those categories change.
Golden evaluations, an internal soak, then customer A/B testing
Golden evaluation sets give Glean reference cases for spotting regressions in nearly every part of the product that uses a model or other automated judgment. A change then runs for roughly two weeks in Glean’s own instance, at a company of about 1,500 people at the time of the talk. The team uses feedback from internal users to revise the change before A/B testing it with customers.
How close can query classification get without fine-tuning?
Glean first tried a decision model to classify what users were asking about. The labels help the product team understand which jobs people use Glean for. A high share of sales queries gives the team a reason to invest in sales workflows. A high share of engineering queries points it toward a different set of needs.
The test bed compared a base open model, Jev, and the same open model fine-tuned on Glean’s own compute. Jev delivered nearly twice the base model’s reported quality and about 90% of the fine-tuned model’s quality. Those figures are relative to the other models on this test bed, with the quality metric unspecified. Watch the comparison at 3:46.
Fine-tuning delivered the highest score in this comparison. It also meant collecting and cleaning data, paying for training compute, revisiting that work as labels changed, and hosting and serving the classifier. Jev got close enough to the fine-tuned result for Goyal to favor it among the options Glean could use without running its own training.
A faster router was worth changing the infrastructure
The expert router takes an incoming query and picks the expert that will answer it. Glean set up a test bed with a pool of experts and compared Jev with its general-purpose LLM router. Goyal reports high routing precision with Jev and says the decision took about one-eighth as long as it had with the previous router.
Integrating Jev into this stage required significant changes to Glean’s implementation and infrastructure. Glean usually favors a simpler system. Here, every bit of time saved in routing comes before the selected expert can start work, and the team judged that gain worth the added complexity.
Q generates follow-ups, then picks one on a deadline
A good follow-up anticipates the user’s next question or shows them something else they can do with Glean. The system that produces it is called Q. Roughly 10 to 15 sources independently generate suggestions as natural-language queries. The ranker gets those candidates along with the original query and Glean’s answer. Each candidate is a possible output. The original exchange gives the ranker the context to judge which one fits. Watch Q’s inputs at 6:11.
A suggestion that appears five seconds after the answer misses the experience Glean wanted. The step had a budget of roughly 1.5 to 2 seconds. Goyal reports better ranking quality with Jev without specifying a quality metric. Glean measured two concrete ways the step could fail.
- On-time delivery. Glean returned a suggestion within the time limit in 99.2% of cases with Jev, up from about 90% with the general-purpose LLM.
- Output validity. Glean logs when its programmatic checks fire. The general-purpose LLM returned a valid suggestion in about 90% of cases. It sometimes answered in a different language or failed another check. Jev chooses from the supplied suggestions, leaving the writing to the generators. Glean observed zero invalid outputs with Jev in this comparison. The team used slightly different prompts and matched them as closely as it could.
With five candidates, Jev returns five probabilities. A candidate can rank first and still fall below a cutoff, so the scores let Glean decide whether the winner is strong enough to show. Glean automatically tunes thresholds for each customer deployment based on how that customer uses the product. The feedback signal and update rule are unspecified.
What reaches Q’s ranker before it chooses a follow-up?
Read the diagram as text
- Independent generators. Ranking inputs — Roughly 10 to 15 sources produce natural-language follow-up candidates.
- Original user query. Ranking inputs — The question that began the exchange.
- Glean’s answer. Ranking inputs — The response Glean gave to the original query.
- Jev ranker. Compares the supplied options in the context of the exchange.
- Preferred candidate and scores. Glean can use the per-option probabilities to apply a threshold.
- Independent generators → Jev ranker: Candidate text.
- Original user query → Jev ranker: Query context.
- Glean’s answer → Jev ranker: Answer context.
- Jev ranker → Preferred candidate and scores: Choice and per-option probabilities.
More repeatable verdicts for citation checks
A citation gives the reader a document they can check against a claim. Glean’s evaluation pipeline asks the same question automatically. Given a claim in the answer and its cited document, does the document support the claim? With a general-purpose LLM as judge, Glean would repeat the check because the same pair could produce different verdicts.
Moving the yes-or-no verdict to Jev cut the latency and cost of running the check. It also made the verdicts more repeatable. In a comparison covering roughly 28 to 30 cases, Goyal reports one run in which Jev gave a different response. That result describes repeatability on the cases tested. Agreement with human judgments is a separate measure. Watch the citation results at 11:04.
Scale the evaluation to thousands of claim-and-document pairs and there are two sources of savings. Each verdict takes less time, and more repeatable verdicts reduce the need to run the same pair again. Shorter evaluation runs give engineers feedback sooner, which is how a change to one judge can speed up work elsewhere in the product.
Catching more cases in the first security pass
Glean checks inputs and outputs from tools and LLMs. Its security checks have two stages. The first prioritizes recall, the share of actual positives it catches. A heavier LLM handles the final judgment. The checks run alongside the tool calls.
The first-stage classifier ran on T4 GPUs. Glean’s single-tenant setup gives each customer its own instance and resources, so engineers had to maintain the classifier across separate deployments. Goyal uses a hypothetical 1,000 customers to show how the work scales. That would mean maintaining classifiers across 1,000 deployments.
Replacing the first-stage classifier with Jev raised recall from 31.5% to 90.2%. The first pass went from catching roughly a third of actual positives to catching nine in ten. The result is scoped to first-stage recall. The false-positive rate and the performance of the full two-stage check remain unquantified. Watch the recall comparison at 13:47.
Glean also reported lower resource costs. The engineering savings came from shedding the recurring work of maintaining the classifiers and T4 GPUs across deployments. Goyal describes that maintenance as work for roughly two or three full-time engineers.
Can the output be listed in advance?
Glean’s closing test applies to the individual call. Can you list its possible outputs before it runs? A candidate list can change with every request and still qualify, as long as the list is ready when the decision model receives it. Watch the decision rule at 14:46.
- Free-form text. Use a generative model when the call has to write a response whose possible outputs you can’t list in advance.
- A list of choices. Use a promptable decision model such as Jev. When the labels change, editing the prompt lets you update the options without another training run.
- Stable labels at high volume. Consider fine-tuning. If the same categories will serve many requests, it is easier to justify the up-front work of preparing data and training the classifier.
A single feature can use both kinds of model. In Q, the generators write follow-ups for the current exchange. The ranker receives those freshly written candidates, the query, and the answer, and makes a bounded choice.
Full transcript
Loading transcript…