भाषा कार्यों के लिए मेट्रिक्स: ROUGE, METEOR, EM

Python में LLMs का परिचय

Jasmin Ludolf

Senior Data Science Content Developer, DataCamp

LLM कार्य और मेट्रिक्स

 

भाषा कार्यों के लिए मूल्यांकन मेट्रिक्स

Python में LLMs का परिचय

LLM कार्य और मेट्रिक्स

 

भाषा कार्यों के लिए मूल्यांकन मेट्रिक्स

Python में LLMs का परिचय

LLM कार्य और मेट्रिक्स

 

भाषा कार्यों के लिए मूल्यांकन मेट्रिक्स

Python में LLMs का परिचय

ROUGE

  • ROUGE: जनरेट किए गए सारांश और संदर्भ सारांशों की समानता
    • n-grams और ओवरलैप देखता है
    • predictions: LLM outputs
    • references: मानव-प्रदत्त सारांश

"the cat sat on the mat" और "the cat is on the mat" की तुलना

Python में LLMs का परिचय

ROUGE

rouge = evaluate.load("rouge")
predictions = ["""as we learn more about the frequency and size distribution of 
exoplanets, we are discovering that terrestrial planets are exceedingly common."""]
references = ["""The more we learn about the frequency and size distribution of 
exoplanets, the more confident we are that they are exceedingly common."""]

ROUGE स्कोर:

  • rouge1: unigram overlap
  • rouge2: bigram overlap
  • rougeL: लंबी ओवरलैपिंग उप-श्रृंखलाएँ
Python में LLMs का परिचय

ROUGE आउटपुट

ROUGE स्कोर:

  • rouge1: unigram overlap
  • rouge2: bigram overlap
  • rougeL: लंबी ओवरलैपिंग उप-श्रृंखलाएँ

 

  • स्कोर 0-1 के बीच: अधिक स्कोर मतलब अधिक समानता
results = rouge.compute(predictions=predictions,
                         references=references)

print(results)
{'rouge1': 0.7441860465116279, 
'rouge2': 0.4878048780487805, 
'rougeL': 0.6976744186046512, 
'rougeLsum': 0.6976744186046512}
Python में LLMs का परिचय

METEOR

  • METEOR: अधिक भाषाई फीचर जैसे शब्द-रूप, समान अर्थ, और शब्द क्रम
bleu = evaluate.load("bleu")
meteor = evaluate.load("meteor")


prediction = ["He thought it right and necessary to become a knight-errant, roaming the world in armor, seeking adventures and practicing the deeds he had read about in chivalric tales."] reference = ["He believed it was proper and essential to transform into a knight-errant, traveling the world in armor, pursuing adventures, and enacting the heroic deeds he had encountered in tales of chivalry."]
Python में LLMs का परिचय

METEOR

results_bleu = bleu.compute(predictions=pred, references=ref)
results_meteor = meteor.compute(predictions=pred, references=ref)
print("Bleu: ", results_bleu['bleu'])
print("Meteor: ", results_meteor['meteor'])
Bleu:  0.19088841781992524
Meteor:  0.5350702240481536
  • 0-1 स्कोर: अधिक बेहतर
Python में LLMs का परिचय

प्रश्न और उत्तर

 

भाषा कार्यों के लिए मूल्यांकन मेट्रिक्स

Python में LLMs का परिचय

Exact Match (EM)

  • Exact Match (EM): यदि LLM का आउटपुट संदर्भ उत्तर से पूरी तरह मेल खाए तो 1

 

  • आमतौर पर F1 स्कोर के साथ उपयोग होता है
from evaluate import load
em_metric = load("exact_match")

exact_match = evaluate.load("exact_match")
predictions = ["The cat sat on the mat.",
               "Theaters are great.", 
               "Like comparing oranges and apples."]
references = ["The cat sat on the mat?", 
              "Theaters are great.", 
              "Like comparing apples and oranges."]

results = exact_match.compute(
  references=references, predictions=predictions)
print(results)
{'exact_match': 0.3333333333333333}
Python में LLMs का परिचय

अभ्यास करते हैं!

Python में LLMs का परिचय

Preparing Video For Download...