Bird
Raised Fist0
Prompt Engineering / GenAIml~20 mins

Human evaluation frameworks in Prompt Engineering / GenAI - ML Experiment: Train & Evaluate

Choose your learning style10 modes available

Start learning this pattern below

Jump into concepts and practice - no test required

or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Experiment - Human evaluation frameworks
Problem:You have a generative AI model that creates text responses. You want to measure how good these responses are using human evaluation. Currently, you only have automatic scores like BLEU or ROUGE, but they don't match how humans feel about the quality.
Current Metrics:Automatic metric scores: BLEU=0.45, ROUGE=0.50. No human evaluation data yet.
Issue:Automatic metrics do not fully capture human judgment of response quality. You need a human evaluation framework to get reliable feedback.
Your Task
Design and implement a simple human evaluation framework to assess the quality of generated text responses. Collect human ratings on fluency, relevance, and overall quality. Summarize the results with average scores.
Use a small sample of 10 generated responses.
Use a 1 to 5 rating scale for each criterion.
Do not use automated metrics for this task.
Keep the evaluation process simple and easy to understand.
Hint 1
Hint 2
Hint 3
Hint 4
Solution
Prompt Engineering / GenAI
import numpy as np

# Sample generated responses (for demonstration)
generated_responses = [
    "The cat sat on the mat.",
    "Weather today is sunny and warm.",
    "I love eating pizza on weekends.",
    "Python is a popular programming language.",
    "The movie was exciting and fun.",
    "She enjoys reading books at night.",
    "The car needs fuel to run.",
    "He plays football every Sunday.",
    "The garden has many colorful flowers.",
    "Music can lift your mood instantly."
]

# Simulated human ratings collected for each response
# Each row: [fluency, relevance, overall_quality] ratings from 1 to 5
human_ratings = np.array([
    [5, 5, 5],
    [4, 4, 4],
    [5, 5, 5],
    [5, 5, 5],
    [4, 4, 4],
    [5, 5, 5],
    [3, 4, 3],
    [4, 4, 4],
    [5, 5, 5],
    [5, 5, 5]
])

# Calculate average scores for each criterion
average_scores = human_ratings.mean(axis=0)

print(f"Average Fluency Score: {average_scores[0]:.2f} / 5")
print(f"Average Relevance Score: {average_scores[1]:.2f} / 5")
print(f"Average Overall Quality Score: {average_scores[2]:.2f} / 5")
Added a small set of generated responses for evaluation.
Simulated human ratings on fluency, relevance, and overall quality using a 1-5 scale.
Calculated average scores to summarize human evaluation results.
Focused on human evaluation instead of automatic metrics.
Results Interpretation

Before: Only automatic metrics available (BLEU=0.45, ROUGE=0.50), which may not reflect true quality.

After: Human evaluation shows high average scores (around 4.5 to 4.6 out of 5), indicating good fluency, relevance, and overall quality as perceived by people.

Human evaluation frameworks provide valuable insights that automatic metrics cannot fully capture. Collecting simple human ratings helps understand model quality from a real user perspective.
Bonus Experiment
Try designing a pairwise comparison human evaluation where raters choose the better response between two options instead of rating each individually.
💡 Hint
Present two generated responses side by side and ask which one is better overall. This can reduce rating bias and provide clearer preferences.

Practice

(1/5)
1. What is the main purpose of human evaluation frameworks in AI?
easy
A. To have people judge AI outputs for quality
B. To replace all automatic scoring methods
C. To train AI models faster
D. To collect data without human input

Solution

  1. Step 1: Understand the role of human evaluation

    Human evaluation frameworks involve people assessing AI outputs to check quality.
  2. Step 2: Compare with other options

    Options B, C, and D do not describe the main purpose correctly; human evaluation does not replace all automatic methods, nor is it for training or data collection without humans.
  3. Final Answer:

    To have people judge AI outputs for quality -> Option A
  4. Quick Check:

    Human evaluation = people judge AI outputs [OK]
Hint: Human evaluation means people check AI output quality [OK]
Common Mistakes:
  • Thinking human evaluation replaces automatic scores
  • Confusing evaluation with training
  • Assuming no human input is involved
2. Which of the following is a common method used in human evaluation frameworks?
easy
A. Simple rating scales
B. Automatic precision scoring
C. Gradient descent optimization
D. Data augmentation

Solution

  1. Step 1: Identify common human evaluation methods

    Simple rating scales are widely used for humans to rate AI outputs.
  2. Step 2: Eliminate unrelated options

    Automatic precision scoring, gradient descent, and data augmentation are technical methods not involving human judgment.
  3. Final Answer:

    Simple rating scales -> Option A
  4. Quick Check:

    Human evaluation uses rating scales [OK]
Hint: Look for methods involving human ratings or comparisons [OK]
Common Mistakes:
  • Choosing automatic or technical AI training methods
  • Confusing human evaluation with model training
  • Ignoring the human aspect in options
3. Consider a human evaluation where 3 raters score AI responses on a scale from 1 to 5. The scores for one response are [4, 5, 3]. What is the average score?
medium
A. 3
B. 5
C. 4
D. 12

Solution

  1. Step 1: Sum the scores given by raters

    4 + 5 + 3 = 12
  2. Step 2: Calculate the average score

    Average = Total sum / Number of raters = 12 / 3 = 4
  3. Final Answer:

    4 -> Option C
  4. Quick Check:

    (4+5+3)/3 = 4 [OK]
Hint: Add scores then divide by number of raters [OK]
Common Mistakes:
  • Adding but forgetting to divide by number of raters
  • Choosing the sum instead of average
  • Mixing up the scale values
4. A human evaluation study uses a comparison method where raters choose the better of two AI outputs. The code below has an error. What is the error?
def compare_outputs(output1, output2, rater_choice):
    if rater_choice == 'output1':
        return output1
    elif rater_choice == 'output2':
        return output2

result = compare_outputs('Answer A', 'Answer B', 'output3')
print(result)
medium
A. The comparison method cannot use strings as choices
B. The function should return both outputs instead of one
C. The print statement is missing parentheses
D. The function does not handle invalid rater choices properly

Solution

  1. Step 1: Trace the code execution for invalid input

    For rater_choice='output3', neither condition matches, so no explicit return; function implicitly returns None.
  2. Step 2: Identify the error

    Returning None for invalid choices is improper handling. Should explicitly manage invalid inputs (e.g., return error message or raise exception).
  3. Final Answer:

    The function does not handle invalid rater choices properly -> Option D
  4. Quick Check:

    Invalid input -> returns None [OK]
Hint: Check how function handles unexpected inputs [OK]
Common Mistakes:
  • Assuming print syntax error in Python 3
  • Thinking function must return both outputs
  • Ignoring the lack of else clause handling
5. You want to design a human evaluation framework to compare two AI chatbots. Which approach best balances simplicity and detailed feedback?
hard
A. Use only open-ended feedback without ratings
B. Use simple rating scales plus side-by-side output comparisons
C. Use automatic BLEU scores without human input
D. Use complex statistical models without human ratings

Solution

  1. Step 1: Consider evaluation goals

    Balancing simplicity and detail means combining easy-to-use ratings with meaningful comparisons.
  2. Step 2: Evaluate options

    Use only open-ended feedback without ratings lacks ratings, making quantitative comparison hard. Use automatic BLEU scores without human input and D exclude human input, missing human judgment. Use simple rating scales plus side-by-side output comparisons combines ratings and comparisons, fitting the goal.
  3. Final Answer:

    Use simple rating scales plus side-by-side output comparisons -> Option B
  4. Quick Check:

    Simple ratings + comparisons = balanced evaluation [OK]
Hint: Combine ratings with comparisons for best feedback [OK]
Common Mistakes:
  • Ignoring human input in evaluation
  • Choosing only open feedback without structure
  • Relying solely on automatic metrics