Summary audio
Spoken summary — press play to read along: the line being spoken stays near the top.
Study notes
Prompt Evaluation Workflow: Grading Systems
**I. Purpose of a Grader**
- A grader takes model output and provides an objective signal (e. g. , a number or true/false value).
- The most common signal is a score between 1 and 10 (10 = high quality, 1 = low quality).
**II. Types of Graders**
- Code-based Grader:
- Feeds model output into custom, authored code.
- Allows for programmatic checks (e. g. , output length, presence of specific words, JSON/code syntax validation, readability score).
- Requirement: Must return a usable signal.
- Model-based Grader:
- Feeds the original model output into an additional model API request.
- Offers high flexibility for evaluation (e. g. , general quality, instruction following, completeness).
- Requirement: Must return an objective signal (usually a score between 1 and 10).
- Human-based Grading:
- A person manually evaluates the model outputs.
- Highly flexible for any metric, but very time-consuming and tedious.
**III. Defining Evaluation Criteria**
- Evaluation criteria must be defined upfront.
- Example Criteria:
- Format: Output must be Python, JSON, or regular expression, with no additional explanation.
- Syntax: The generated code must have valid syntax (no typos).
- Task Following: The model must clearly address the user's task with generally accurate code and no major logic mistakes.
**IV. Mapping Criteria to Graders**
- Code Grader: Best for format and syntax checks (e. g. , ensuring the output is valid JSON or Python).
- Model Grader: Best for general response quality and task fulfillment due to its flexibility.
**V. Implementing a Model Grader**
- Prompt Design: The grading prompt must be detailed and set a clear role for the grader.
- Improving Score Quality: To get more concrete scores, the prompt should ask the model for:
- A score.
- A list of strengths.
- A list of weaknesses.
- Reasoning behind the score.
- Structured Output: Use techniques like pre-filled assistant messages and stop sequences to ensure the model returns a clean, parsable JSON object.
**VI. Final Evaluation Workflow**
- Process: Run Model → Get Output → Run Grader → Get Score/Reasoning.
- Objective Metric: Aggregate all individual scores to calculate an average score, providing a final, objective metric for prompt performance.
Takeaways
- A grader provides an objective signal (e. g. , a score between 1 and 10) to evaluate model output.
- Grader types include Code-based (programmatic checks like syntax), Model-based (using an additional LLM for quality), and Human-based (manual evaluation).
- Code Graders are ideal for format and syntax validation, while Model Graders are best suited for general response quality and task fulfillment.
- Implementing a Model Grader requires detailed prompt design, asking the model for structured output such as a score, strengths, weaknesses, and reasoning.
- The final evaluation workflow involves running the model, applying the grader, and aggregating individual scores to establish a final objective metric.
Flashcards 8 cards
Question
click to reveal · ←/→
Answer
click to flip back
Knowledge check 6 questions