Hướng dẫn phản hồi phi cấu trúc

Làm việc với Llama 3

Imtihan Ahmed

Machine Learning Engineer

Kiểm soát đầu ra mô hình

  • ✅ Tham số
  • ✅ Vai trò

Cách tinh chỉnh mô hình

Làm việc với Llama 3

Kiểm soát đầu ra mô hình

  • ✅ Tham số
  • ✅ Vai trò

Cách tinh chỉnh mô hình - tinh chỉnh nhắc lệnh

Làm việc với Llama 3

Kiểm soát đầu ra mô hình

  • ✅ Tham số
  • ✅ Vai trò

Cách tinh chỉnh mô hình - zero-shot/few-shot prompting

Làm việc với Llama 3

Kiểm soát đầu ra mô hình

  • ✅ Tham số
  • ✅ Vai trò

Cách tinh chỉnh mô hình - dùng stop words

Làm việc với Llama 3

Tinh chỉnh nhắc lệnh

  • Ví dụ: tóm tắt
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) # Nhắc lệnh cụ thể hiệu quả hơn 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...
Làm việc với Llama 3

Thành phần của nhắc lệnh hiệu quả

Thành phần của nhắc lệnh hiệu quả

Làm việc với Llama 3

Thành phần của nhắc lệnh hiệu quả

Thành phần của nhắc lệnh hiệu quả - Độ chính xác

Làm việc với Llama 3

Thành phần của nhắc lệnh hiệu quả

Thành phần của nhắc lệnh hiệu quả - Mơ hồ

Làm việc với Llama 3

Thành phần của nhắc lệnh hiệu quả

Thành phần của nhắc lệnh hiệu quả - Từ khóa

Làm việc với Llama 3

Thành phần của nhắc lệnh hiệu quả

Thành phần của nhắc lệnh hiệu quả - Động từ hành động

Làm việc với Llama 3

Thành phần của nhắc lệnh hiệu quả

Thành phần của nhắc lệnh hiệu quả - Ví dụ

Làm việc với Llama 3

Zero-shot prompting

  • Zero-shot prompting: một chỉ dẫn duy nhất
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...
Làm việc với Llama 3

Tinh chỉnh zero-shot prompts

  • Cần phân biệt nhiệm vụ, đầu ra mong đợi, ngữ cảnh bổ sung
  • Zero-shot prompting với nhãn
text = """
       INSTRUCTION: Write concisely and in 2-3 sentences that cover only key points.
       QUESTION: Summarize recent mergers in the airline industry.
       ANSWER:
       """
Làm việc với Llama 3

Few-shot prompting

  • Few-shot prompting: dùng nhiều ví dụ

Nhắc lệnh

Làm việc với Llama 3

Few-shot prompting

  • Few-shot prompting: dùng nhiều ví dụ

Nhắc lệnh nổi bật 'aircraft model'

Làm việc với Llama 3

Few-shot prompting

  • Few-shot prompting: dùng nhiều ví dụ

Nhắc lệnh nổi bật 'passenger capacity'

Làm việc với Llama 3

Few-shot prompting

  • Few-shot prompting: dùng nhiều ví dụ

Nhắc lệnh nổi bật 'fuel consumption'

Làm việc với Llama 3

Few-shot prompting

$$

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
Làm việc với Llama 3

Dùng stop words

  • Cần insight ngắn gọn
  • Dùng stop để kết thúc phản hồi tại điểm cụ thể
  • Ví dụ: ứng dụng hỏi–đáp
text = "Which airlines operate direct flights from London to Singapore?"


output = llm(text, stop=["Q:"]) # Dừng phản hồi tại "Q:"
print(output['choices'][0]['text'])
You can fly direct from London to Singapore with Singapore Airlines and 
British Airways.
Làm việc với Llama 3

¡Vamos a practicar!

Làm việc với Llama 3

Preparing Video For Download...