Stop Paying LLM Prices for Yes-or-No Answers — Chinmay Goyal, Glean
Read full transcript 14 segments
-
[music] >> Hi everyone. My name is Chinmay and I am a software engineer at Clean. I work on the product engineering side of Clean Assistant. Today I'm going to give a talk on how Clean uses Jev. The title of the talk is Beyond Generation. Fast and structured AI decisions with Jev at Clean. If you look at it, most AI product steps are bounded decisions and not generation problems. So to give a couple of examples, user query intent classification, a ranker picking a suggestion out of n options, checking whether a citation is valid or not, routing to the correct model or expert, so on so forth. Till now we have been paying the full LLM cost and latency to get an answer to all these bounded problems.
-
Jev at Clean fills the gap between general LLMs and fine-tuned classifiers. Classification itself isn't a new problem. Like people have been trying to solve it since forever. We can have multiple ways to solve it. Some of the things that we have tried out include using a general purpose LLM, using an open model, something like LLaMA, fine-tuning that open model, or using Jev. Now all these approaches and all these different ways have their pros and cons. With a general purpose LLM, we incur a lot of cost and latency, while with something like Jev, we get no generated text output. Another advantage that we have been seeing with Jev is that as the taxonomy of the decision space changes, we don't have to fine-tune these models again and again. We can just change our prompt a bit and boom, it works out of the box. Now I'll walk you through how we have integrated Gen or these classification uh how we have used Jev at Glean to solve these classification problem statements.
-
I'll go into some of these problems in great detail. Before we go into these individual problems, I wanted to touch upon how we evaluate these changes. Like we have a huge customer base having millions of users, so we don't want any of the change that we make to regress our product. We have a multi-phase approach, a rollout approach to any change that we are making. This includes having a golden eval set for almost every possible thing. Like any place where we have generative AI, any place where we have any form of intelligence involved, we have a golden eval set for that space. We soak all of these changes for a significant amount of time for our internal use case. Like we have around 1500 people at Glean right now. We soak all of these changes within our Glean instance for like couple of weeks. We get active feedback. We have a very active feedback loop from our internal users. We work upon that and then we go for an AB testing with our customers.
-
The first problem that we tried out with a decision decision model was query classification. Query classification is when we want to know the nature of user queries. This helps us realize what kind of what kind of jobs are people using Glean for? What kind of Say for example, if people are using more for sales like queries, we focus more on that. If we people are using more for engineering type use cases, we focus more on that. We tried out three different approaches over here and this is data from our test bed. We used an open source Llama model. Then we tried out Jev and then we fine-tuned the Llama model on our own compute resources. Jev is the best no training option in our opinion. It nearly doubles the output quality of a base Llama model and is 90 is able to perform at a 90% quality in comparison to a fine tuned model a fine tuned Llama. With Jev we don't have to go through the very tedious process of data collection, data cleaning, incurring the cost for compute like training the model, fine tuning the model again and again as the taxonomy changes and at the same time we don't have to worry about hosting the model or incurring the inference cost.
-
The next problem we went to is expert routing. This is a pretty common problem statement in the industry right now like hey when the user query comes in what expert do we route it to like how do we ensure that the user user the response to the user is of the best possible quality. Glean receives the way we have been solving this is Glean receives the user query and then decides what's the best expert to answer the query. Till now we have been using a general purpose LLM to route to the correct expert. We set up a test bed for Jev we set up a test bed with N experts and in our experiments found a significantly high precision when using Jev and that too at an almost 8x reduction in latency. We had to change our implementation or our infrastructure significantly to integrate Jev into this specific stage of our product but the reduction in latency justifies that inherent complexity in the system. We at Glean have been trying to build systems in the most in the simplest possible manners. This is one of the rare pieces where we believe complexity is worth it.
-
Next I'll walk you through the ranker problem statement that I talked about. When we receive a user query we also want to generate the best follow up suggestions for the user like this helps us in getting discoverability for our product. This helps us in ensuring that the user has the best possible experience. We also want to recommend or say preempt what the next user query might be. Again, a pretty common problem statement that the entire industry has been trying to solve for. Internally, we call this system Q like Q as in the literal Q. The way this works, we have like 10 or 15 different sources or 10 or 15 different ways, uh 10 or different 15 different sources that are generating suggestions independently of each other. Once those suggestion these suggestions are generated by natural language LLMs and it's like a proper natural language query. Once these suggestions are in, we have a ranking step. So the ranker takes in all these suggestions, takes in the the first user query, takes in the output that Clean gave, and then all these suggestions in that context.
-
The ranker is then asked to decide like, hey, you have these suggestions, what do you think is the best one? A pretty interesting bottleneck that we had over here is we want the response to be snappy. I cannot we cannot have a state where we give the textual response to the user and then wait 5 seconds for generating the follow-up suggestion. We have to be snappy. That's why we have time limits on these suggestions. So right now this step had a time limit of 1 1.5 to 2 seconds. Jeff, no doubt gave us a better quality than better quality and far better latency than what we had with a general purpose LLM, but two things stood out over there. First we were able to give a suggestion within our time bounds in 99.2% cases. With the general purpose LLM, this was almost 90%. So this ensures that we have user engagement and far more user queries now. The second thing is at Clean, whenever we use these LLMs, we have guard rails. Guard rails in the sense that here LLM might not be good at generating a response or LLM might be making some specific kind of mistakes. So we have checks and balances for all those possible mistakes that we see. We keep a log of like we keep a log of all these checks that are incurred at any point of time.
-
With a general purpose LLM, we were able to generate a valid suggestion in almost 90% of the use 90% of the cases. We still had some places where LLM was either generating a generating a response in a different language. The output did not meet certain other criteria that we had that we had written programmatically. With Jev, we found zero cases to be there when the output was invalid. Now a natural question is like, hey, but you would have used a different prompt. Yes, the prompt was somewhat different, but we tried to mimic the prompt in the two cases to the largest extent possible so that we don't have a divergence. Like again, we at Glean want to keep the system as simple as possible. Another benefit we see with using a decision model is how we can control the thresholds because in this ranker problem statement, we are getting specific probabilities of each output. We are not restricted to a binary yes or no response. We get like, hey, these were the five options and these are the probabilities of these five options.
-
With this, we are able to fine-tune the thresholds based on the deployment. We have put in self-learning systems which based on the user based on the customer deployment and the nature of usage that the specific customer has fine-tunes the thresholds by itself. This ensures that the experience in each and every customer out there is the best possible based on how they use Glean, not a general purpose solution that fits all. Okay, this is an interesting one. Now moving on from how we have been making the lives or the experience of our end users better, we also tried using Jev and some of the some some other parts of our development pipeline. One of them was how we use LLM as judges. Like all of us have been using LLM as judges for quite some time now. There's an input, there's an output, and we use an LLM to judge how the quality of the output is. Now naturally, whenever we use LLM as a judge, we repeat the experiment multiple times because to account for the variability in the response.
-
At Glean, we used Jeff for a very specific part of our evaluation pipeline. Glean responses are like any other AI product out there has like citations. This is how people trust that Glean Glean's answer was correct and it it is grounded in the correct document. Now these site we hold these citations to a very high bar and we have a specific part in our evaluation pipeline where we check whether the cited document really supports the claim made in the answer or not. This again seems to be a pretty simple yes or no question like hey whether the claim is supported or not. With Jeff, no doubt we had a far better latency and cost like visible in the slide over here. The interesting thing we noticed over here is how consistent and reproducible Jeff results were in comparison to something like say Luna. In the 28 or 30 use cases that we had, like only one run had like a difference in response.
-
Apart from that, everything was consistent. What this ensure this this ensures two things for us as engineers or us as developers at Glean. We are not only improving the quality of our product or we are not only improving Glean in a linear fashion anymore. Any improvement of this extent in the development pipeline leads to an exponential increase in how we can improve the product. So if I'm if I as a developer am able to ship things like 5x faster, like this is a significant reduction in latency. Like if I run this experiment across thousands and thousands of entries, this is a lot of time. And again, I don't have to run the same input-output pair multiple times because the result from Jeff are quite consistent. So if I'm able to increase my own productivity by like 5x or 6x, I can ship 6x times the features to our customers and this happens across like 500 engineers or 300 engineers at Clean. So the impact of a a good decision model is no longer linear, it is exponential on how we can improve the product.
-
Okay. Now moving on from product and LLM as judges, there's a pretty import this this this is a pretty important part of how we use our customer data. Like security is something that all our customers expect from us. So for example, we have checks and balances on all the inputs and outputs coming from a tool, all the inputs and outputs from an LLM. Till now we at Glean have like a multi phase approach. There is like there are two phases to this. The first one is like recall heavy phase and the second one is the final heavy loaded LLM. All these calls are made in parallel to like the actual tool input output calls. Till now we used to host a virtue classifier using T4 GPUs across all our customers. So Glean is a single tenant solution like we don't use or share resources across customers. Every customer gets gets its own deployment, gets its own instance and gets all the resources. So assuming we have thousand customers out there, we had to maintain like virtue classifiers across all these thousand customers, which becomes a pretty difficult problem statement in itself which takes up a lot of time from Glean engineers.
-
So looking at the results over here, the overall recall of the first phase where we used to have a virtue classifier, we replaced that with Jev, went from 31.5% to 90.2%. At the same time, we are seeing a significant reduction in cost. Now this cost is only the resource cost mentioned over here, but we are also saving cost on the engineering resources over here. We don't have to invest like two or three engineers who are full-time maintaining those virtue classifiers or T4 GPUs across customers. The the improvement or the savings that we have are far more than 50%. This slide concludes all the results I have talked about till now. Jev at Glean has been able to influence the product experience of the users, has been able to uh impact how we as developers have been working at Glean and most importantly it also has a very good positive impact on the security that we provide to our customers.
-
A simple rule that we have been using is can the out in conclusion a simple rule that we have been using at Glean is can the output be listed in advance? If no then it's a free form generate generative text problem statement. Go back to something that can generate free form text. If yes then use Jev. Are labels stable and volume high? If this is the case where the labels are stable which is rarely the case anymore uh we can also fine tune a model but if the labels change which in my opinion is quite frequent these days then again use something like Jev. Obviously if you need dynamic text we can like feel free to try out more hybrid approaches like Jev along with free form text LLMs. This ends my presentation. So thank you everyone for listening. I have added a blog like a link to the blog post where we have posted the exact same results in great detail. Feel free to catch me on the outside if you have more questions. Thank you.
Summary
This talk explores how Glean utilizes a specialized decision-making tool called Jev to handle bounded AI product tasks like query classification, expert routing, and response ranking instead of relying on costly general-purpose LLMs. Key subjects covered include comparing Jev against open-source models like LLaMA, fine-tuning approaches, and rigorous multi-phase evaluation processes involving golden eval sets and internal user feedback loops. The practical takeaway is that Jev eliminates text generation overhead, significantly reduces latency, and avoids the need for continuous model retraining when taxonomies change, making it a highly efficient solution for structured AI decisions.