Unsupervised LLM Evaluations
Practitioners guide to judging outputs of large language models
<TLDR>
Evaluating AI-generated outputs is critical for building robust applications of large language models because it allows complex AI applications to be split into simple stages with built-in error control.
It is relatively straightforward to evaluate generative outputs in a supervised mode, where the “right answers” can be computed or hinted by human evaluators.
At the same time, in many practical LLM applications the supervised approach is too restrictive, and there is a need for evaluations capable of tackling open-ended questions. The simplest way to build an unsupervised evaluator is to ask an LLM to evaluate itself. However, the ability of generative models to detect errors in their own output is not well understood.
We demonstrate that the quality of self-evaluations can be improved with iterative self-reflection. Similar to the “Chain of Thought” technique, this method trades compute at inference for the robustness of the final result.
</TLDR>
Link to Google Colab notebook with examples:
. The same is true when testing an enterprise LLM app against historical cases handled by human agents, where the “ground truth” equates to the judgments of those agents.
Another opportunity to check the output against the “ground truth” comes when the LLM output can be formally verified on its own — such as computer code that can be compiled and tested. Despite the fact that a computer program can be written in many different ways, the correct code should pass the tests regardless of the chosen implementation path.
Cases where the generative output cannot be formally verified usually require adding a human into the loop. For example, until convergence (chart by the author)
The final result will be a fairly exhaustive list of recommendations on improving the chatbot:
Final recommendations:
["Improve the bot's ability to avoid repetitive greetings and restarts when the user's input is vague or repeated, creating a more fluid conversation flow.",
"Enhance the bot's active listening skills to acknowledge user needs and concerns before suggesting starting over, to better handle user dissatisfaction.",
"Include a function allowing users to ask follow-up questions for more details about the suggested plan, such as data overage charges and roaming fees.",
"Develop a mechanism for the bot to detect and correct minor typographical errors and currency symbol mismatches in user inputs.",
"Provide alternative suggestions that might not fit all criteria but offer significant savings or benefits in other areas based on the provided user data.",
"Implement a feedback system enabling users to rate the accuracy or helpfulness of the plan suggestion provided, allowing for iterative improvements.",
"Incorporate a bot training mechanism to ensure it can handle responses that are non-standard in format or include extraneous details not directly related to the plan.",
"Add the ability for the bot to suggest seeking human assistance when complex queries or dissatisfaction arise that the bot cannot resolve.",
"Enhance the bot's language processing capabilities to accurately interpret various phrasings and informal expressions from the user.",
"Increase the bot's capability for dynamic clarification requests, creating a smoother interaction flow.",
"Refine the bot's ability to verify user information effectively to reduce misunderstandings and user frustration.",
"Improve the bot's handling of unrealistic and inconsistent user inputs to guide the conversation back to relevant queries.",
"Integrate a process for flagging nonsensical data entries and guide the user toward providing accurate information.",
"Provide clearer explanations or breakdowns of the suggested plan's features, especially if different from the user's mentioned requirements.",
"Improve response to questions unrelated to starting new calculations to avoid redundant loops."]
Some technical notes on this example:
- For simplicity, we have combined the evaluation and generation into one prompt which relies on .
To further improve the performance, we can take advantage of the fact that most samples in a dataset do not generate new insights. This means we can produce the initial list of recommendations by iterating over a small subset of samples sequentially, and serve the rest of the dataset in parallel via ) to flag the “interesting” cases and shave 30–50% off the time (or expense) budgets based on your preferences.
Conclusion
LLMs can and should be used for unsupervised evaluations (including self-evaluations). The fine-print is that it requires a well-thought approach–which often resolves to an iterative way to improve and refine the judgements.
Here is a link to the sample implementation in Google Colab:
was originally published in Towards Data Science on Medium, where people are continuing the conversation by highlighting and responding to this story.
SOCIAL SHARE CARD GENERATOR