Bird
0
0

You want to create a custom metric that scores AI answers higher if they contain more keywords from a reference list. Which approach fits best?

hard📝 Application Q15 of 15
LangChain - Evaluation and Testing
You want to create a custom metric that scores AI answers higher if they contain more keywords from a reference list. Which approach fits best?
ACalculate the difference in length between prediction and reference
BCheck if prediction exactly matches the reference string
CCount how many keywords appear in the prediction, divide by total keywords
DReturn a fixed score regardless of prediction content
Step-by-Step Solution
Solution:
  1. Step 1: Understand the goal of keyword-based scoring

    The metric should reward predictions containing more keywords from the reference list.
  2. Step 2: Identify the approach that measures keyword presence proportionally

    Counting keywords in prediction and dividing by total keywords gives a score reflecting keyword coverage.
  3. Final Answer:

    Count how many keywords appear in the prediction, divide by total keywords -> Option C
  4. Quick Check:

    Keyword coverage scoring = Count how many keywords appear in the prediction, divide by total keywords [OK]
Quick Trick: Score by keyword matches divided by total keywords [OK]
Common Mistakes:
MISTAKES
  • Using exact match instead of keyword count
  • Measuring length difference unrelated to keywords
  • Returning fixed scores ignoring content

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More LangChain Quizzes