Zero-shot, Few-shot, Chain-of-Thought

লেসন ৭ / ৪৬

🎯 Zero-shot Prompting

কোনো example না দিয়ে সরাসরি instruction।

"Sentiment classify করো (positive/negative/neutral):
Review: This product changed my life!
Sentiment:"

Model training থেকেই এই task জানে, তাই example লাগে না।

📋 Few-shot Prompting ⭐

২-৫টা example দিলে model pattern ধরে নেয় — in-context learning।

"Translate English to Bengali:

Input: How are you?
Output: তুমি কেমন আছ?

Input: What time is it?
Output: এখন কয়টা বাজে?

Input: Where is the station?
Output: ?"

Few-shot কখন দরকার?

  • Specific format দরকার
  • Domain-specific jargon
  • Edge case handle
  • Particular tone match
  • Custom label-এ classification

Few-shot Best Practice

  • Diverse example দিন (edge case সহ)
  • সবসময় একই structure
  • ৩-৫টা sweet spot, ১০+ diminishing return
  • Example order matter (last example weight বেশি)

🧠 Chain-of-Thought (CoT) ⭐⭐

Model-কে step-by-step reasoning দেখাতে বললে accuracy বাড়ে — বিশেষ করে math, logic-এ।

❌ Direct:
"Roger-এর ৫টা ball। ২টা can কিনল প্রতিটা can-এ ৩টা ball।
মোট কত ball?"
→ "11" (মাঝে মাঝে ভুল)

✅ CoT:
"Step by step ভাবো:
 Roger-এর ছিল ৫টা ball।
 ২টা can × ৩টা ball = ৬টা নতুন।
 ৫ + ৬ = ১১টা।
 Answer: 11"

CoT Trigger Phrase

  • "Let's think step by step"
  • "First identify... Then..."
  • "Walk through your reasoning before answering"
  • "Show your work"
  • "চলো ধাপে ধাপে চিন্তা করি"

🎲 Self-Consistency

একই prompt কয়েকবার চালান (temperature 0.7), majority vote নিন → better accuracy।

একই prompt ৫ বার run:
  উত্তর: [42, 42, 41, 42, 43]
  Majority: 42 ✅

🌳 Tree of Thoughts

Multiple reasoning path explore, backtrack করে best path বেছে নেয়। Complex problem-এ কাজে আসে।

🔄 ReAct Pattern ⭐

Reasoning + Acting — tool use agent-এর foundation।

Thought: আমাকে সর্বশেষ AI news খুঁজতে হবে।
Action: search("latest AI news 2025")
Observation: [search results]
Thought: প্রথম result-এ GPT-5 launch-এর কথা...
Action: read_url(url1)
Observation: [page content]
Thought: আমার যথেষ্ট তথ্য হয়েছে।
Final Answer: ...

🧩 Reasoning Model (o1, DeepSeek R1)

এদের built-in extended thinking আছে — explicit CoT লাগে না, model নিজেই internally reason করে। ধীর কিন্তু accurate।

Reasoning Model কখন?

  • Math, physics problem
  • Complex code refactor
  • Strategy planning
  • Multi-step proof
  • Algorithm design

Standard Model কখন?

  • Casual chat
  • Simple lookup
  • Quick draft
  • Cost-sensitive (reasoning ১০x দামি)
  • Creative writing

🔀 Hybrid Approach

Step 1: o1 — high-level plan
Step 2: GPT-4o-mini — piece by piece execute (cheap, fast)
Step 3: o1 — final review
// বুদ্ধিমান + সাশ্রয়ী

📊 Technique Comparison

TechniqueUse CaseCost
Zero-shotSimple, known task💰
Few-shotFormat/tone match💰💰
CoTReasoning, math💰💰
Self-consistencyAccuracy critical💰💰💰
ReActTool use agent💰💰💰
Reasoning modelComplex problem💰💰💰💰