Yapılandırılmamış yanıtları yönlendirme

Llama 3 ile Çalışmak

Imtihan Ahmed

Machine Learning Engineer

Model çıktısını kontrol etme

  • ✅ Parametreler
  • ✅ Roller

Model çıktısını nasıl iyileştiririz

Llama 3 ile Çalışmak

Model çıktısını kontrol etme

  • ✅ Parametreler
  • ✅ Roller

Modeli nasıl iyileştiririz - istemleri iyileştirme

Llama 3 ile Çalışmak

Model çıktısını kontrol etme

  • ✅ Parametreler
  • ✅ Roller

Modeli nasıl iyileştiririz - sıfır/az örnekli istem

Llama 3 ile Çalışmak

Model çıktısını kontrol etme

  • ✅ Parametreler
  • ✅ Roller

Modeli nasıl iyileştiririz - stop sözcükleri kullanın

Llama 3 ile Çalışmak

İstemleri iyileştirme

  • Örnek: özetleme
text_choice1 = "Summarize key trends in the aviation industry from the last year, 
                focusing on fuel efficiency innovations."

text_choice2 = "Tell me about the aviation industry."
output = llm(text_choice1) # Daha spesifik istem daha etkilidir print(output['choices'][0]['text'])
The aviation industry has made significant strides in fuel efficiency innovations 
over the last year, driven by the need to reduce greenhouse gas emissions and 
operating costs. Sustainable Aviation Fuels (SAFs) have emerged as a key trend...
Llama 3 ile Çalışmak

Etkili istemin bileşenleri

Etkili istemin bileşenleri

Llama 3 ile Çalışmak

Etkili istemin bileşenleri

Etkili istemin bileşenleri - Kesinlik

Llama 3 ile Çalışmak

Etkili istemin bileşenleri

Etkili istemin bileşenleri - Belirsizlik

Llama 3 ile Çalışmak

Etkili istemin bileşenleri

Etkili istemin bileşenleri - Anahtar kelimeler

Llama 3 ile Çalışmak

Etkili istemin bileşenleri

Etkili istemin bileşenleri - Eylem sözcükleri

Llama 3 ile Çalışmak

Etkili istemin bileşenleri

Etkili istemin bileşenleri - Örnekler

Llama 3 ile Çalışmak

Sıfır örnekli istem (Zero-shot)

  • Sıfır örnekli (zero-shot) istem: tek bir talimat
text = "Summarize recent mergers in the airline industry."

output = llm(text) print(output['choices'][0]['text'])
Recent mergers in the airline industry include Alaska Air Group's acquisition of 
Hawaiian Airlines in 2024, with both airlines continuing to operate as separate 
brands. In 2022, Delta Air Lines purchased 20% of LATAM Airlines Group...
Llama 3 ile Çalışmak

Sıfır örnekli istemleri iyileştirme

  • Görev, beklenen çıktı, ek bağlamı ayırt edin
  • Etiketlerle sıfır örnekli istem
text = """
       INSTRUCTION: Write concisely and in 2-3 sentences that cover only key points.
       QUESTION: Summarize recent mergers in the airline industry.
       ANSWER:
       """
Llama 3 ile Çalışmak

Az örnekli istem

  • Az örnekli (few-shot) istem: birden çok örnek kullanın

İstem

Llama 3 ile Çalışmak

Az örnekli istem

  • Az örnekli (few-shot) istem: birden çok örnek kullanın

'aircraft model' vurgulu istem

Llama 3 ile Çalışmak

Az örnekli istem

  • Az örnekli (few-shot) istem: birden çok örnek kullanın

'passenger capacity' vurgulu istem

Llama 3 ile Çalışmak

Az örnekli istem

  • Az örnekli (few-shot) istem: birden çok örnek kullanın

'fuel consumption' vurgulu istem

Llama 3 ile Çalışmak

Az örnekli istem

$$

output = llm(f"Continue the entries: {text}") 

print(output['choices'][0]['text'])
Aircraft Model: Airbus A350-900
Passenger Capacity: 350
Fuel Consumption: 2.39 liters per seat per 100 km
Llama 3 ile Çalışmak

Stop sözcükleri kullanma

  • Özlü içgörüler gerekli
  • Yanıtı belirli bir noktada bitirmek için stop sözcükleri kullanın
  • Örnek: soru-yanıt uygulaması
text = "Which airlines operate direct flights from London to Singapore?"


output = llm(text, stop=["Q:"]) # Yanıtları "Q:" ifadesinde durdurun
print(output['choices'][0]['text'])
You can fly direct from London to Singapore with Singapore Airlines and 
British Airways.
Llama 3 ile Çalışmak

Ayo berlatih!

Llama 3 ile Çalışmak

Preparing Video For Download...