Imagine a super-smart parrot that finishes your sentences using every book it ever heard. If you mumble, it finishes with any random ending. If you say clearly, "Pretend you're a math teacher, show me each step, and answer at the end," the parrot copies that careful style and gets it right. Prompt engineering is just learning to ask the parrot in the way that makes it copy the smart voice — with clear instructions, a couple of examples, and space to "think out loud."
What does a prompt fundamentally change about the model's output?
The conditional probability distribution P(answer∣prompt) over next tokens — it steers which learned region is sampled.
Why does Chain-of-Thought improve hard reasoning?
Transformers do fixed compute per token; emitting reasoning tokens spreads computation across many tokens, giving more effective serial compute (a scratchpad).
Zero-shot vs few-shot?
Zero-shot = no examples in the prompt; few-shot = k≥1 input→output examples enabling in-context learning without weight updates.
What is in-context learning?
The model inferring a task's pattern from examples/instructions in the prompt at inference time, with no parameter updates.
Why use delimiters like <doc>...</doc>?
To separate instructions from data, reducing ambiguity and blocking prompt-injection attacks.
Why explicitly allow "I don't know"?
The default most-probable continuation to a question is an answer, so the model hallucinates; permission to abstain raises the probability of honest refusal.
Steel-man: why isn't "longer prompt = better"?
Filler dilutes attention and models under-attend to mid-context tokens ("lost in the middle"); high signal-to-noise beats length.
When should you NOT use CoT?
On trivial lookup/classification tasks — it adds cost, latency, and can inject over-thinking errors.
One requirement for good few-shot examples?
They must be both correctly formatted AND correctly labeled, and ideally diverse.
Dekho, LLM koi "samajhne wala insaan" nahi hai — woh basically ek super-powerful next-word predictor hai. Aap jo bhi text doge (prompt), model uska sabse probable continuation generate karta hai. Iska matlab: aapka prompt hi decide karta hai ki model apni learned knowledge ke kaunse region se answer nikaalega. Isiliye clear, specific instruction dena zaroori hai — vague prompt doge toh model confuse hoke random ya galat direction pakad leta hai.
Best practices simple hain but powerful. Pehla: specific bano — task, format, length, audience sab likho. Doosra: role do ("you are an expert doctor") taaki high-quality wala style aaye. Teesra: few-shot examples do — 2-3 input→output pairs, model unse pattern seekh leta hai (yeh in-context learning kehlaata hai, bina training ke). Chautha aur sabse important reasoning tasks ke liye: Chain-of-Thought — "step by step socho" bolna. Kyunki transformer har token pe fixed compute karta hai, reasoning tokens likhwa ke aap use ek scratchpad de dete ho, aur difficult problems accurate ho jaate hain.
Kuch galतiyan avoid karo: "zyada lamba prompt matlab better" — galat hai, faltu text attention ko dilute karta hai. "CoT hamesha use karo" — nahi, simple lookup tasks pe woh sirf cost aur error badhaata hai. Aur "model samajh jayega main kya chahta hoon" — bilkul nahi, woh intention nahi predict karta, tokens predict karta hai, toh sab kuch explicitly likho.
Ek aur pro tip: user ke data ko delimiters (<doc>...</doc>) mein wrap karo taaki instruction aur data mix na ho — yeh prompt injection attacks bhi rokta hai. Aur model ko "I don't know" bolne ki permission zaroor do, warna woh jhooth (hallucination) bana ke bhi answer de dega. Prompting empirical cheez hai — forecast karo, run karo, verify karo, refine karo. Bas yahi loop maste ka aata hai.