비구조적 응답 유도

Llama 3 다루기

Imtihan Ahmed

Machine Learning Engineer

모델 출력 제어

  • ✅ 매개변수
  • ✅ 역할

모델을 정교화하는 방법

Llama 3 다루기

모델 출력 제어

  • ✅ 매개변수
  • ✅ 역할

모델을 정교화하는 방법 - 프롬프트 개선

Llama 3 다루기

모델 출력 제어

  • ✅ 매개변수
  • ✅ 역할

모델을 정교화하는 방법 - 제로샷/퓨샷 프롬프트

Llama 3 다루기

모델 출력 제어

  • ✅ 매개변수
  • ✅ 역할

모델을 정교화하는 방법 - 중지어 사용

Llama 3 다루기

프롬프트 개선

  • 예: 요약
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) # 더 구체적일수록 효과적임 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 다루기

효과적인 프롬프트의 구성 요소

효과적인 프롬프트의 구성 요소

Llama 3 다루기

효과적인 프롬프트의 구성 요소

효과적인 프롬프트의 구성 요소 - 정밀성

Llama 3 다루기

효과적인 프롬프트의 구성 요소

효과적인 프롬프트의 구성 요소 - 모호성

Llama 3 다루기

효과적인 프롬프트의 구성 요소

효과적인 프롬프트의 구성 요소 - 키워드

Llama 3 다루기

효과적인 프롬프트의 구성 요소

효과적인 프롬프트의 구성 요소 - 동사

Llama 3 다루기

효과적인 프롬프트의 구성 요소

효과적인 프롬프트의 구성 요소 - 예시

Llama 3 다루기

제로샷 프롬프트

  • 제로샷 프롬프트: 단일 지시
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 다루기

제로샷 프롬프트 개선

  • 작업, 예상 출력, 추가 문맥을 구분해야 함
  • 라벨을 사용한 제로샷 프롬프트
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 다루기

퓨샷 프롬프트

  • 퓨샷 프롬프트: 여러 예시 사용

프롬프트

Llama 3 다루기

퓨샷 프롬프트

  • 퓨샷 프롬프트: 여러 예시 사용

‘aircraft model’ 강조 표시된 프롬프트

Llama 3 다루기

퓨샷 프롬프트

  • 퓨샷 프롬프트: 여러 예시 사용

‘passenger capacity’ 강조 표시된 프롬프트

Llama 3 다루기

퓨샷 프롬프트

  • 퓨샷 프롬프트: 여러 예시 사용

‘fuel consumption’ 강조 표시된 프롬프트

Llama 3 다루기

퓨샷 프롬프트

$$

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 다루기

중지어 사용

  • 간결한 인사이트 필요
  • 특정 지점에서 응답을 끝내려면 stop 사용
  • 예: 질의응답 애플리케이션
text = "Which airlines operate direct flights from London to Singapore?"


output = llm(text, stop=["Q:"]) # "Q:"에서 응답 중지
print(output['choices'][0]['text'])
You can fly direct from London to Singapore with Singapore Airlines and 
British Airways.
Llama 3 다루기

Ayo berlatih!

Llama 3 다루기

Preparing Video For Download...