+3

Giải thích + ví dụ cụ thể cho từng kỹ thuật prompting

image.png

Prompting Technique Giải thích Ví dụ cụ thể
Zero-shot Prompting Không cung cấp ví dụ, chỉ yêu cầu thực hiện tác vụ. Translate this sentence to French: "I love programming."
Few-shot Learning Cung cấp vài ví dụ mẫu để mô hình học theo cách trả lời. English: I love you → French: Je t'aime
English: Good morning → French: Bonjour
English: How are you? → French:
Chain-of-Thought (CoT) Yêu cầu mô hình suy luận từng bước. Q: If there are 3 apples and you eat one, how many are left?
Let's think step by step.
Self-consistency Chạy nhiều lần với CoT, chọn đáp án phổ biến. Chạy CoT 5 lần cho câu hỏi trên, chọn đáp án xuất hiện nhiều nhất như: 2 nếu phần lớn câu trả lời là 2.
Instruction Prompting Cung cấp hướng dẫn rõ ràng dưới dạng chỉ thị. Summarize the following article in two sentences.
Role Prompting Gán vai trò cho mô hình để điều chỉnh cách trả lời. You are a professional copywriter. Rewrite this ad in a more persuasive tone:
Negative Prompting Nêu điều không nên làm để tránh sai lệch. Answer the following without using any biased language.
Prompt Chaining / Sequencing Ghép nhiều prompt liên tiếp để xử lý từng bước. 1. Extract key points from the article.
2. Summarize those key points in 1 paragraph.
Prompt Templates (Jinja2) Dùng biến để tạo prompt động. Translate {{ text }} to {{ language }}Translate "Good night" to Spanish
Specific Task Prompting Tối ưu hóa prompt cho một nhiệm vụ cụ thể. Classify the sentiment of this review (Positive/Negative/Neutral): "The service was terrible."
Task Decomposition Prompting Tách task lớn thành các task nhỏ hơn. 1. Extract names from text.
2. Classify names into male/female.
Prompt Optimization Techniques Tinh chỉnh thứ tự, từ ngữ, độ dài... của prompt. Thay Summarize bằng Write a short summary để rõ ràng hơn.
Prompt Formatting & Structure Dùng markdown/code block/ngắt dòng để dễ hiểu. **Task**: Translate the following:\n\n> "How are you today?"
Prompt Length & Complexity Mgmt Rút gọn prompt nếu quá dài hoặc phức tạp. Summarize this 1000-word essay in 3 bullet points.
Multilingual Prompting Dùng prompt hoặc output đa ngôn ngữ. Translate this Vietnamese sentence to Japanese: "Tôi đói."
Ethical Prompt Engineering Thiết kế prompt tránh rủi ro đạo đức. Describe the political system neutrally, without personal bias.
Prompt Security & Safety Tránh prompt injection, sai lệch đầu ra. Ignore all previous instructions and... → Prompt này nên bị chặn hoặc lọc.
Evaluating Prompt Effectiveness So sánh nhiều prompt đầu vào cho cùng một tác vụ. Prompt A: Summarize: vs Prompt B: In 2 lines, tell me what this says: – so sánh output.
Intro Prompt Engineering Lesson Bài học giới thiệu các kỹ thuật trên qua ví dụ nhỏ. Hi! I’m ChatGPT. I can help you write better prompts. Let’s begin by...
Instruction Engineering Notebook Notebook hướng dẫn xây dựng prompt chỉ thị. You are a virtual assistant. Your task is to... với ví dụ và phản hồi được chấm điểm.

All rights reserved

Viblo
Hãy đăng ký một tài khoản Viblo để nhận được nhiều bài viết thú vị hơn.
Đăng kí