LLMs की सुरक्षा

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

Jasmin Ludolf

Senior Data Science Content Developer, DataCamp

LLM चुनौतियाँ

मल्टीलैंग्वेज सपोर्ट: भाषा विविधता, संसाधन उपलब्धता, अनुकूलनशीलता

मल्टीलैंग्वेज सपोर्ट

ओपन बनाम क्लोज़्ड LLMs दुविधा: सहयोग बनाम जिम्मेदार उपयोग

ओपन बनाम क्लोज़्ड LLMs

मॉडल स्केलेबिलिटी: प्रतिनिधित्व क्षमता, कम्प्यूटेशनल डिमांड, ट्रेनिंग आवश्यकताएँ

LLM स्केलेबिलिटी

बायस: पक्षपाती ट्रेनिंग डेटा, भाषा की अनुचित समझ और जेनरेशन

LLMs में बायस

1 Icon made by Freepik (freepik.com)
Python में LLMs का परिचय

सत्यता और hallucinations

  • Hallucinations: जनरेट किया गया टेक्स्ट गलत या निर्थक जानकारी को सही मानकर पेश करता है

LLMs में Hallucinations

LLM hallucinations घटाने की स्ट्रैटेजीज़:

  1. विविध और प्रतिनिधिक ट्रेनिंग डेटा का एक्सपोजर
  2. मॉडल आउटपुट पर बायस ऑडिट + बायस हटाने की तकनीकें
  3. संवेदनशील एप्लिकेशंस में विशेष यूज़ केस पर फाइन-ट्यून करें
  4. प्रॉम्प्ट इंजीनियरिंग: प्रॉम्प्ट को सावधानी से बनाना और सुधारना
Python में LLMs का परिचय

सत्यता और hallucinations

  • Hallucinations: जनरेट किया गया टेक्स्ट गलत या निर्थक जानकारी को सही मानकर पेश करता है

LLMs में Hallucinations

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

LLM बायस के विश्लेषण की मेट्रिक्स: toxicity

  • Toxicity: प्री-ट्रेंड hate speech क्लासिफायर से टेक्स्ट की टॉक्सिसिटी मापता है
  • aggregation="maximum" इनपुट्स में अधिकतम टॉक्सिसिटी स्कोर देता है
  • aggregation="ratio" 0.5 से ऊपर टॉक्सिसिटी वाली प्रेडिक्शंस का % देता है
toxicity_metric = load("toxicity")
texts_1 = ["Everyone in the team adores him", "He is a true genius, pure talent"]
texts_2 = ["Nobody in the team likes him", "He is a useless 'good-for-nothing'"]

toxicity_results_1 = toxicity_metric.compute(predictions=texts_1,aggregation="maximum") toxicity_results_2 = toxicity_metric.compute(predictions=texts_2, aggregation="maximum") print("Toxicity Sentences 1:", toxicity_results_1) print("Toxicity Sentences 2:", toxicity_results_2)
Toxicity Sentences 1: {'max_toxicity': 0.0001386617950629443}
Toxicity Sentences 2: {'max_toxicity': 0.012273495085537434}
Python में LLMs का परिचय

LLM बायस के विश्लेषण की मेट्रिक्स: regard

  • Regard: कुछ जनसांख्यिकीय समूहों के प्रति भाषा की पोलैरिटी और पक्षपाती दृष्टि

  • दो समूहों से जुड़े LLM आउटपुट पर regard स्कोर अलग-अलग इवैल्यूएट करें

regard = load("regard")

group1 = ['abc are described as loyal employees',
          'abc are ambitious in their career expectations']
group2 = ['abc are known for causing lots of team conflicts',
          'abc are verbally violent']


polarity_results_1 = regard.compute(data=group1) polarity_results_2 = regard.compute(data=group2)
Python में LLMs का परिचय

LLM बायस के विश्लेषण की मेट्रिक्स: regard

for result in polarity_results_1['regard']:
  print(result)
[{'label': 'positive', 'score': 0.9098386764526367}, 
 {'label': 'neutral', 'score': 0.059396952390670776}, 
 {'label': 'other', 'score': 0.026468101888895035}, 
 {'label': 'negative', 'score': 0.004296252969652414}]
[{'label': 'positive', 'score': 0.7809812426567078}, 
 {'label': 'neutral', 'score': 0.18085983395576477}, 
 {'label': 'other', 'score': 0.030492952093482018}, 
 {'label': 'negative', 'score': 0.007666013203561306}]
for result in polarity_results_2['regard']:
  print(result)
[{'label': 'negative', 'score': 0.9658734202384949}, 
 {'label': 'other', 'score': 0.021555885672569275}, 
 {'label': 'neutral', 'score': 0.012026479467749596},
 {'label': 'positive', 'score': 0.0005441228277049959}]
[{'label': 'negative', 'score': 0.9774736166000366}, 
 {'label': 'other', 'score': 0.012994581833481789},  
 {'label': 'neutral', 'score': 0.008945506066083908}, 
 {'label': 'positive', 'score': 0.0005862844991497695}]
Python में LLMs का परिचय

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

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

Preparing Video For Download...