Evaluating the prompt

  • Release version: Xanadu
  • Updated August 1, 2024
  • 2 minutes to read
  • Summarize
    Summarized using AI
    This content was generated using new OpenAI-powered functionality. Results are provided on an as is basis and are not guaranteed to be accurate or complete.

    Summary of Evaluating the prompt

    Evaluating prompts is a continuous process that occurs during and after prompt development to ensure their effectiveness. This evaluation involves testing model-generated responses on sizable batches of data outside of the Now Assist Skill Kit environment to avoid biases and ensure reliable results.

    Show full answer Show less

    Prompt Development Evaluation

    During development, ongoing and improvised evaluation helps refine the prompt based on observed outputs. It is important to evaluate on larger data batches rather than a few examples to avoid reacting to random noise and to consider statistical significance when assessing performance changes.

    Final Performance Evaluation

    Before deploying a skill, test the prompt on an isolated batch of representative “test” data that was not used during development. This prevents prompt overfitting, where the prompt becomes overspecialized to development examples, which can lead to inflated performance estimates.

    Evaluation Metrics

    Choosing appropriate evaluation metrics depends on the use case and the nature of the generated output:

    • Classification-based assessment: Suitable for short, well-defined answers (e.g., true/false, multiple-choice). Metrics like precision, recall, and F1 score can be calculated directly from labeled data.
    • Assessment of longer generations: For more complex outputs with multiple valid answers, human evaluators score the text on several dimensions including:
    • Faithfulness: Accuracy of the generated content relative to the prompt context, avoiding hallucinations.
    • Correctness: Whether the response correctly follows the skill instructions.
    • Helpfulness: The degree to which the output aids the intended task, considering user needs.
    • Fluency: Grammar, coherence, and typographical correctness.

    Scoring on a graded scale (e.g., 1-5) is recommended over binary yes/no judgments for these qualitative aspects.

    Evaluating the prompt is an ongoing process that occurs during and after prompt development and completion.

    Prompt evaluation overview

    To determine the effectiveness of your prompt, you should evaluate batches of test data. You should copy the model-generated responses and perform evaluations outside of Now Assist Skill Kit.

    During prompt development

    Ongoing, improvised evaluation should take place alongside the development of the prompt. This ongoing evaluation enables you to adapt the prompt based on observed model outputs. It may be tempting to test a change to a prompt against just one or two examples, however, to avoid reacting to noise, you should look at larger batches, and consider the statistical significance of the performance differences that you observed.

    Chart that shows a comparison of prompt performance.

    Final performance evaluation

    Before you deploy a skill, you should test the prompt on a representative batch of data that was isolated from the development process, that is, “test” data. You want to use isolated test data because of a phenomenon known as prompt overfitting. Iteratively editing a prompt based on the model outputs generated on the same data that is used for testing can lead to significant over-estimates of performance. This result is because the prompt can become overspecialized to the specific examples used in development. Even though the effect is typically less dramatic than what occurs when fitting machine learn model parameters to a test dataset, it’s rooted in the same underlying principles, and should be avoided.

    Evaluation metrics

    Selecting the right metrics for evaluation is an important consideration. The following list provides a few approaches, each of which may be more or less appropriate depending on the use case.

    • Classification-based assessment of short generations

      This approach requires labeled records, and it works best when the labels are short, well-defined “right answers,” for example, true or false, multiple-choice, or category selection. In these cases, the model outputs can usually be parsed and formatted, then metrics like precision, recall, F1 scores, and so on can be directly calculated.

    • Assessment of longer generations

      Many of the most interesting generative AI use cases require longer model generations, and there are many possible “right answers.” In these cases, the output can be scored (by human evaluators) along several different axes, for example:

      • Faithfulness

        Is the generated text faithful to the context provided in the skill prompt? (The opposite of faithfulness is hallucination, which is to say that the model injects out-of-context information.)

      • Correctness

        Is the generated text correct relative to the skill instruction?

      • Helpfulness

        Is the generated text helpful relative to the task that the skill wants to accomplish? (Helpfulness is subjective but it’s important to try to measure. Doing so properly requires a solid understanding of the needs of the people who will ultimately be using the skill.)

      • Fluency

        Is the generated text grammatically correct? Does it have any typos, issues with coherency, and so on?

      Note:
      It’s useful to score these properties on a scale, like 1-5, rather than with yes or no.