Session 07 · Prompt Engineering · 2026

Few-Shot & Zero-Shot
Prompting
Few-Shot और
Zero-Shot प्रॉम्प्टिंग
Few-Shot ਅਤੇ
Zero-Shot ਪ੍ਰੋਮਪਟਿੰਗ

Generative AI & Prompt Engineering — TARAhut AI Labs

Teach AI by showing it examples. Master classification, extraction, and formatting with accuracy tracking. Go from inconsistent output to production-ready precision. "AI nu examples dikhao, te oh pattern samajh jaanda hai."

AI को उदाहरण दिखाकर सिखाएं। Classification, extraction और formatting में master बनें। "AI ko examples dikhao, wo pattern samajh jaata hai."

AI ਨੂੰ ਉਦਾਹਰਣਾਂ ਦਿਖਾ ਕੇ ਸਿਖਾਓ। Classification, extraction ਅਤੇ formatting ਵਿੱਚ ਮਾਹਰ ਬਣੋ। "AI ਨੂੰ examples ਦਿਖਾਓ, ਉਹ pattern ਸਮਝ ਜਾਂਦਾ ਹੈ।"

Section 01

Zero-Shot, One-Shot, Few-Shot

Zero-Shot, One-Shot, Few-Shot

Zero-Shot, One-Shot, Few-Shot

"Teach me without words." Show 3 positive movie reviews labelled POSITIVE, then show an unlabelled review. Everyone gets it instantly. AI works the same way — it learns patterns from examples in your prompt. "Examples dikhao, AI samajh jaanda hai."

📚

Session 6 Recap: CoT + ToT

Last session you learned chain-of-thought (linear reasoning) and tree-of-thought (branching exploration). CoT teaches AI HOW to think. Today, few-shot teaches AI WHAT PATTERN to follow. Together with CRISP, you now have a complete prompt engineering toolkit. "CoT = soch da tarika, Few-Shot = pattern da tarika."

🎯

Zero-Shot: No Examples

"Classify this email as spam or not spam." AI uses only its training knowledge. Works for simple tasks but fails on nuanced or ambiguous inputs. "Bina example de — AI guess karda hai."

✕ Inconsistent on Edge Cases
💡

Few-Shot: 3-5 Examples

"Example 1: 'Limited offer!' = Spam. Example 2: 'Your invoice' = Not Spam. Now classify..." AI follows the demonstrated pattern with precision. "Examples de naal — AI pattern follow karda hai."

✓ Consistent & Accurate

The Three Levels of Teaching AI

Level 0🚫

Zero-Shot

No examples given. "Classify this customer review as positive, negative, or neutral." AI relies entirely on its training. Good for obvious cases. Fails on sarcasm like "Oh great, another Monday" — zero-shot might call this positive. "Koi udaharan nahi — AI apne training te depend karda hai."

Level 1☝️

One-Shot

One example given. "Example: 'Absolutely love it!' = Positive. Now classify: 'Not bad, could be better.'" Slight improvement. One example helps set the format but doesn't cover edge cases. Better than zero, but limited.

Level 3-5📈

Few-Shot

3-5 diverse examples. Include clear positive, clear negative, sarcastic, mixed, and neutral examples. AI now handles ambiguity because it has seen the RANGE. "3-5 examples de naal AI 90%+ accuracy de sakda hai." This is the sweet spot for most tasks.

💡

What Makes Examples Effective?

Five rules for powerful few-shot examples: (1) Representative — cover the range of inputs. (2) Diverse — include edge cases, not just easy ones. (3) Consistent format — every example follows the exact same structure. (4) Correct — wrong examples teach wrong patterns. (5) Minimal but sufficient — usually 3-5 is enough; more than 7 rarely helps. "Sahi examples = sahi output."

"Mere paas real-world tasks ne jinnan te AI consistent output nahi denda." — That changes today. Few-shot prompting transforms AI from a guessing machine into a reliable classification and extraction engine. Consistency is the difference between a toy and a tool.

Warm-Up: Sarcasm Test

Copy this to ChatGPT or Claude WITHOUT any examples:

Next: Build your first classification system with few-shot examples.

TARAhut AI Labs · tarahutailabs.com · +91 92008-82008
✅ Section 1 complete! You're 17% through this session.
Section 02

Classification Lab

Classification लैब

Classification ਲੈਬ

Build few-shot classifiers for sentiment analysis, email categorization, and lead scoring. Measure accuracy gains from zero-shot to few-shot in real time. "Har task te zero-shot vs few-shot da comparison karo."

🧪 Lab 1: Sentiment Classification (Zero-Shot)

First, test WITHOUT examples. Note the accuracy:

📋 Click to copy: Zero-shot sentiment classification — 10 Punjab restaurant reviews
Record your results. How many does AI get right without examples? Sarcasm and mixed reviews are where zero-shot typically struggles.

🧪 Lab 2: Sentiment Classification (Few-Shot)

NOW add 5 examples covering the full range, then classify the same 10 reviews:

📋 Click to copy: Few-shot sentiment classification — same 10 reviews with 5 examples
Compare: few-shot typically gets 9-10/10 right. The sarcasm example (#4 in the few-shot template) is the key that unlocks accuracy on reviews #2 and #8.

Email Categorization Challenge

🧪 Lab 3: Email Categorization (Few-Shot)

Classify business emails using few-shot examples:

📋 Click to copy: Few-shot email categorization — 8 emails for a Punjab IT company
🔥

Punjab Business Context Matters

Your few-shot examples should reflect local business context. An email mentioning "Ludhiana manufacturing unit" is clearly an inquiry, not spam. Context-aware examples improve accuracy because AI learns the DOMAIN, not just the category. "Local context = better classification."

You've built 3 classifiers. Compare zero-shot vs few-shot accuracy — the difference is the lesson.

Next: Extract structured data from messy text — the business goldmine.

TARAhut AI Labs · tarahutailabs.com · +91 92008-82008
💪 33% through! Now the high-value extraction skills.
Section 03

Extraction & Formatting

Extraction और Formatting

Extraction ਅਤੇ Formatting

Few-shot is not just for classification. It is incredibly powerful for extracting structured data from unstructured text and converting formats. These are skills businesses pay for. "Messy data nu clean data vich badlo — businesses ede layi paise dende ne."

⚙ Few-Shot Extraction Pipeline
📄
Raw Text
Unstructured input
📚
Few-Shot Examples
2-3 input-output pairs
⚙️
Pattern Match
AI learns the structure
📊
Structured Output
Clean, consistent data
Raw invoice text becomes structured JSON. Messy resumes become clean tables. Few-shot examples define the extraction pattern.

🧪 Lab 4: Invoice Data Extraction

Extract structured data from messy invoice text using few-shot examples:

📋 Click to copy: Few-shot invoice extraction — 2 Punjab business invoices

🧪 Lab 5: Resume Parsing

Extract candidate profiles from unstructured resume text:

📋 Click to copy: Few-shot resume parsing — 2 Punjab professionals

Format Conversion: Unstructured to Structured

Use Case📄

Meeting Notes → Action Items

Convert rambling meeting transcripts into structured action items with owners, deadlines, and priorities. A PA's dream tool. Few-shot examples ensure consistent output format every time.

Use Case💰

Bank Statements → Categories

Turn raw transaction descriptions into categorized expenses: "NEFT to Reliance Jio" becomes "Telecom/Internet, ₹999." Few-shot handles Punjabi business transaction patterns.

Use Case📊

Product Reviews → Insights

Extract Product Name, Rating, Key Praise, Key Complaint, and Recommendation from verbose reviews. Structured data that drives business decisions.

💡

Pro Tip: JSON Output for Developers

If you're building applications, ask for JSON output in your few-shot examples. Instead of table format, show one example as JSON: {"company": "Singh Manufacturing", "total": 708000}. AI will follow that structure for all subsequent extractions. This is how production AI pipelines work.

You can now extract structured data from any messy text. That is a marketable skill.

Next: Track and optimize your accuracy like a data scientist.

TARAhut AI Labs · tarahutailabs.com · +91 92008-82008
🔥 67% done! Now quantify your results.
Section 04

Accuracy Tracking

Accuracy ट्रैकिंग

Accuracy ਟ੍ਰੈਕਿੰਗ

Professional prompt engineers don't just "feel" that their prompts work. They MEASURE accuracy, find the optimal example count, and iterate. "Professional prompt engineer measure karda hai — sirf feel nahi karda."

📊 Accuracy Optimization Process
🚫
Zero-Shot
Baseline: ~60-70%
☝️
1 Example
Improvement: ~75%
📈
3 Examples
Strong: ~85-90%
🎯
5 Examples
Peak: ~90-95%
Sweet spot: 3-5 examples. Beyond 5, accuracy gains plateau but token costs increase. Test to find YOUR optimal count. "3-5 examples da sweet spot hai."
📊

How to Measure Accuracy

For each task: (1) Prepare 10 test inputs with known correct answers. (2) Run with 0, 1, 3, 5, and 7 examples. (3) Count correct answers at each level. (4) Calculate: Accuracy = Correct / Total x 100%. (5) Find the sweet spot where adding more examples stops helping. "Ground truth set banao, har level test karo, sweet spot labho."

Accuracy Challenge: Find Your Sweet Spot

Pick ONE classification task from your work (email sorting, lead scoring, support ticket categorization). Test with 1, 3, 5, and 7 examples on 10 test inputs.

Common Accuracy Killers

Killer 1🚫

Biased Examples

All examples are "easy" positive cases. When AI encounters sarcasm or mixed sentiment, it defaults to positive. Fix: Include at least one edge case and one ambiguous example. "Sirf easy examples deo ge ta hard cases te fail hoga."

Killer 2🔄

Inconsistent Format

Example 1 outputs "POSITIVE" while Example 2 outputs "Pos." and Example 3 outputs "This is positive." Fix: Use EXACTLY the same output format in every example. Consistency is non-negotiable.

Killer 3⚠️

Wrong Labels

An example labels "The food was terrible" as POSITIVE. AI learns from YOUR mistakes. Fix: Double-check every example label before using it. One wrong example poisons the entire set. "Galat udaharan galat sikhiya denda hai."

✅ Session 7 Mastery Checklist

Tap items to check them off → your progress score will appear here
You now quantify prompt performance like a professional. Data beats intuition.

Next: Quiz time! Prove your few-shot mastery.

TARAhut AI Labs · tarahutailabs.com · +91 92008-82008
🧠 Almost there! Quiz time — test your few-shot mastery.
Section 05

Test Your Understanding

8 questions picked randomly from a pool of 20. Advanced-level questions about few-shot prompting, classification, extraction, and accuracy optimization. "Har sawaal tuhadi samajh test karda hai."

Every question deepened your understanding of few-shot prompting.

Next: Your homework and Session 8 preview.

TARAhut AI Labs · tarahutailabs.com · +91 92008-82008
Section 06

Session 7 Complete!

सेशन 7 पूरा!

ਸੈਸ਼ਨ 7 ਮੁਕੰਮਲ!

"Tusi aaj few-shot prompting master kar liya — AI nu examples naal sikhana." Here's what you learned and what's next.

📚
Zero vs Few-Shot
No examples vs 3-5 examples
📊
Classification
Sentiment, email, lead scoring
📄
Extraction
Invoice, resume, review parsing
📈
Accuracy
Measure, optimize, iterate
🎓

What You Learned Today

✅ Difference between zero-shot, one-shot, and few-shot prompting
✅ How to build classifiers for sentiment, email, and lead scoring
✅ How to extract structured data from invoices and resumes
✅ The 5 rules for effective examples (representative, diverse, consistent, correct, minimal)
✅ How to measure and optimize accuracy (sweet spot: 3-5 examples)
✅ The 3 accuracy killers and how to avoid them

Homework Before Session 8

"Practice naal hi mastery aundi hai!"

🔮

Preview: Session 8 — System Prompts & Custom Instructions

"Kal assi AI personas banaange — system prompts naal. Same model, wildly different personality. Tusi 3 AI personas banaoge te stress test karoge. From individual prompts to permanent AI identities."

📱 Message TARAhut 🌐 Visit TARAhut
"Tusi aaj few-shot prompting master kar liya. Kal system prompts te custom instructions. Tusi AI tools nahi bana rahe — tusi AI expertise bana rahe ho." You're building skills that 99% of AI users don't have.
TARAhut AI Labs · tarahutailabs.com · +91 92008-82008
Session 8: System Prompts →