Define the task and success criteria
Anthropic recommends starting to evaluate an LLM-based application by defining success criteria clearly. The evaluation is then designed to measure performance against those criteria. The criteria need to be tied to the application's purpose and to user needs.
A criterion should state the behavior you want to achieve. Anthropic illustrates this distinction with the difference between a general expectation of good performance and stating the accuracy of sentiment classification. Task performance is one of the dimensions a rubric covers; most use cases need evaluation across several success criteria.
According to Anthropic, a measurable success criterion can use quantitative metrics or well-defined qualitative scales. Qualitative measurements that are applied consistently can also add value alongside quantitative ones. Language experts scoring translation quality against defined criteria is an example of an expert rubric.
Achievability of the targets is also among the properties Anthropic lists. Targets can be based on prior experiments, AI research, industry benchmarks, or expert knowledge. Success metrics should not rest on targets that are unrealistic given the models' capabilities.
Identify which aspects of the output to evaluate
Anthropic's list of criteria covers how well the model performs the given task and how it handles rare or difficult inputs. When measuring task performance, edge case behavior can also be a separate subject of evaluation. In the sentiment classification example, inputs that are hard to handle include statements containing sarcasm or multiple emotions.
The relevance of the response to the user's request is another criterion. Anthropic evaluates whether the output directly addresses the question or instruction. Presenting information in a logical, easy-to-follow way is also among the evaluation topics. These two criteria address, from separate angles, whether the response answers the request and how it is presented.
For tone and style, you can evaluate whether the model output matches expectations and whether the language used suits the target audience. In Anthropic's customer inquiry example, the target tones include empathy, patience, and professionalism. In the example, an LLM scores how closely the given response carries the target tone.
Handling of personal or sensitive information is a separate success criterion. Anthropic lists, among the evaluation topics, whether the model follows instructions not to use or share certain details. This criterion concerns not only whether the response answers the question but also which information is used within the response.
For context utilization, Anthropic looks at how effectively the model uses the context it is given and how it refers back to and builds on information provided earlier. In the multi-turn conversation example, an ordinal scale measures the degree to which the response uses the conversation context. A question that requires relying on information from an earlier turn is one of the edge cases in the example.
Semantic consistency of responses to similar inputs can also be a criterion. Anthropic addresses the similarity between responses when the same question is asked in different wordings. In its example, cosine similarity is used to measure the similarity between sentence embeddings of model outputs; even when the wording changes, the meaning of the responses is compared.
Define the scoring format for each criterion
Anthropic recommends detailed, clear rubrics for LLM-based grading. In the rule example it gives, the response is required to mention a specific company name in its first sentence. If the name does not appear in the first sentence, the response is automatically graded incorrect. The rule states both the behavior being sought and the result to assign when that behavior does not occur.
The format of the scoring result can also be defined explicitly. Anthropic gives the example of asking the grader LLM to output only correct or incorrect. Another format is to use a defined scale. Anthropic notes that evaluations made up only of qualitative statements are hard to review quickly and at scale.
When a scale is used, the property being measured is also stated. Anthropic's Likert scale example treats the coherence of a response on a scale running from nonsensical to completely logical. In the tone example, the ends of the scale express the target tone being entirely absent and fully present. In both cases, the score is tied to a specific property.