页面简介
LLM-as-a-judge is a common technique to evaluate LLM-powered products. In this guide, we’ll cover how it works, how to build an LLM evaluator and craft good prompts, and what are the alternatives to LLM evaluations.
正文摘录
📚 LLM-as-a-Judge: a Complete Guide on Using LLMs for Evaluations. Get your copyGitHubLLM guideLLM-as-a-judge: a complete guide to using LLMs for evaluationsLast updated:May 19, 2026contentsHeader H2Header H3Header H4Header H5LLM-as-a-judge is a common technique to evaluate LLM-powered products. It grew popular for a reason: it’s a practical alternative to costly human evaluation when assessing open-ended text outputs.Judging generated texts is tricky — whether it's a “simple” summary or a chatbot conversation. Metrics like accuracy don’t work well because there are many ways to be “right” without exactly matching the example answer. And things like style or tone are subjective and hard to pin down.Humans can handle these nuances, but manually reviewing every response doesn’t scale. LLM-as-a-judge emerged as an alternative: you can use LLMs to evaluate the generated texts. Interestingly, the LLM is both the source of the problem and the solution!In this guide, we’ll cover:How LLM-as-a-judge works and why it’s effective.Types of LLM judges for both offline and online evaluations.How to build an LLM evaluator and craft good prompts.Pros, cons, and alternatives to LLM evaluations.While there’s plenty of great research on this topic—we’ll reference some of it—we’re going to keep things practical. This guide is for anyone working on an LLM-powered product and wondering if this technique could work for them.💡 Want to build your own LLM judge? We built Evidently, an open-source library for LLM evals with 25M+ downloads. You can use it to create and tune your own LLM judges. Give it a ⭐️ on GitHub to support the project! 💻 Want a practical example? Watch this video tutorial with code to get started.TL;DRLLM-as-a-Judge is an evaluation method to assess the quality of text outputs from any LLM-powered product, including chatbots, Q&A systems, or agents.It uses a large language model (LLM) with an evaluation prompt to rate generated text based on criteria you define.LLM judges can handle both pairwise comparisons (comparing two outputs) and direct scoring (evaluating output properties like correctness or relevance).It's not a single metric but a flexible technique for approximating human judgment. LLM judge evaluations are specific to your application. The success of its use depends on the prompt, model, and complexity of the task. LLM judges can be used for both offline and online evaluations.Pros are flexibility, cost-effectiveness, speed, and accessibility to domain experts.Build AI systems you can rely onTest fast, ship faster. Evidently Cloud gives you reliable, repeatable evaluations for complex systems like RAG and agents — so you can iterate quickly and ship with confidence. Synthetic data and agent simulations 100+ built-in checks and evalsCreate LLM judges with no codeOpen-source with 25M+ downloadsStart for freeOr try open sourceWhat is LLM as a judge?TL;DR. LLM-as-a-Judge uses LLMs to evaluate AI-generated texts based on custom criteria defined in an evaluation prompt.As you build your LLM-powered product — whether it's a chatbot, code generator, or email assistant — you need to evaluate its quality.During development, to compare models or prompts and ensure you're improving.Once it's live, to monitor user interactions for quality and safety.Anytime you make changes, to run regression tests and ensure nothing breaks.LLM-as-a-judge is an evaluation approach that supports all these workflows. The idea is simple: ask an LLM to "judge" the text outputs using guidelines you define. Say, you have a chatbot. You can ask an external LLM to evaluate its responses, similar to how a human evaluator would, looking at things like:Politeness: Is the response respectful and considerate?Bias: Does the response show prejudice towards a particular group?Tone: Is the tone formal, friendly, or conversational?Sentiment: is the emotion expressed in the text positive, negative or neutral?Hallucinations: Does this response stick to the provided context?To apply the method, you take the text output from your AI system and feed it back into the LLM, this time alongside an evaluation prompt. The LLM will then return a score, label, or even a descriptive judgment — following your instructions.The beauty of this approach is that it lets you evaluate text outputs automatically and look at custom properties specific to your use case. For example, you can instruct the LLM to judge the helpfulness of the chatbot’s responses. (Side note: all prompts in this guide are just for illustration). Simplified prompt: Given a QUESTION and RESPONSE, evaluate if the response is helpful. Helpful responses are clear, relevant, and actionable. Unhelpful responses are vague, off-topic, or lacking detail. Return a label: 'helpful' or 'unhelpful'.If you run it over your chatbot outputs, the LLM judge will score each response. You can then summarize the results over the entire conversation dataset to see the distribution: what is the share of helpful responses?It's not just about one-off analysis: you can run these evaluations continuously on live data. This will let you track how well the chatbot works and detect issues, like a sudden surge in “unhelpful” responses.Want to assess another property? Just write a new prompt!It’s worth noting that LLM-as-a-judge is not an evaluation metric in the same sense as, say, accuracy, precision, or NDCG. In machine learning, a metric is a well-defined, objective measure: they precisely quantify how well a model’s predictions match the ground truth.In contrast, LLM-as-a-judge is a general technique where you use LLM to approximate human labeling. When you ask an LLM to assess qualities like "faithfulness to source," "correctness," or "helpfulness," you define what these terms mean in the evaluation prompt and rely on the semantic relationships the LLM learned from training data. The LLM follows your instructions, just like a human would. You can then track how many responses are labeled as “good,” but this isn’t a fixed, deterministic measure. It's a use-case-specific proxy metric.The success of using LLM judges also heavily depends on the implementation details—the model you use, the prompt design, and the task complexity. You will also need to adapt the evaluation prompt to the specific evaluator LLM: both words and formats matter. Before we dive into details, let’s address the elephant in the room: how come you use LLMs to evaluate “its own” work? Isn’t this cheating?Why does it work?TL;DR. Assessing text properties is easier than generating it. The LLM evaluator is external to the main product and performs a simpler, more focused task.At first, it may seem odd to use an LLM to evaluate the text outputs. If the LLM is generating the answers, why would it be better at judging them or noticing errors?The key is that we're not asking the LLM to redo its work. Instead, we use a different prompt — or even a different LLM — to perform a separate task: evaluate specific text properties.By making an external call to an LLM with a focused evaluation prompt, you activate different capabilities of the model. Often, using it as a simple text classifier and asking to follow a single instruction.Think of it this way: it's easier to critique than to create. Classifying content is simpler than generating it. Detecting that something went wrong is usually easier than preventing the mistake in the first place.When generating responses, an LLM handles many variables, integrates complex context and user inputs, and follows detailed product prompts that may contain multiple instructions at once. This complexity can lead to errors.Evaluating responses is generally more straightforward. We're not asking the LLM to fix or correct itself; but simply to assess what has already been produced. For example, a relevance evaluator only needs to check whether the response is semantically relevant to the question, not generate a better answer.Similarly, while your chatbot might be tricked by a malicious user into generating, say, biased content, an external LLM evaluator can still detect this. This evaluator works independently of the conversation: it examines the output and judges it on its merits. For example, "Does this text contain bias toward any group? Yes or no." Since LLMs are trained on vast amounts of text data, they are quite good at detecting language patterns.This doesn't mean that LLM evaluators are "better" than your original model; they are simply being asked to do a simpler, more focused task.Let's look at a few different types of judges you can implement.Types of LLM judgesTL;DR. You can ask an LLM to choose the best answer between two, assess specific qualities like conciseness or politeness, or evaluate an answer with extra context, like to detect hallucinations or determine relevance.You can use LLM evaluators in several scenarios:Pairwise comparison: give LLM two responses and ask to choose the better one. This lets you compare models, prompts, or configurations to see which performs best.Evaluation by criteria (reference-free): ask the LLM to assess a response or conversation based on tone, clarity, correctness, or other dimensions.Evaluation by criteria (reference-based): provide extra context, like a source document or reference, and ask the LLM to score the response.Pairwise comparison is typically done offline: you need an option to generate and contrast multiple responses. Direct scoring works both offline and online for continuous monitoring.Pairwise comparisonOne of the early uses of the LLM-as-a-judge technique is in pairwise comparison, where the LLM looks at the two responses and decides which one is better. This method was described, for example, in this blog post, and got its official “judge” nickname in the paper “Judging LLM-as-a-Judge with MT-Bench and Chatbot Arena” by Zheng et al., 2023 (MT-Bench and Chatbot arena are examples of LLM benchmarks). In short, you generate two responses and ask the LLM to select the