LLM से शानदार उत्तर पाना किस्मत नहीं – एक कौशल है। model एक next-word predictor है, लेकिन यह एक दर्पण भी है – अस्पष्ट prompt अंदर, अस्पष्ट उत्तर बाहर। यहाँ बताया गया है कि आप हर बार वास्तव में जो चाहते हैं वह कैसे पाएँ।
1. विशिष्ट बनें, विनम्र नहीं
आपको “please” या “could you” कहने की ज़रूरत नहीं है। model की कोई भावना नहीं है। उसे चाहिए विस्तार। तुलना करें:
❌ "Explain how DNS works." ✅ "Explain how DNS works. Assume I know what IP addresses are but nothing about nameservers or TTLs. Use plain English and keep it under 4 paragraphs."
दूसरा prompt उत्तर को सीमित करता है – फ़ॉर्मेट, श्रोता, लंबाई। model तीनों पर खरा उतरेगा क्योंकि उसे ऐसा करने को कहा गया था।
2. इसे एक भूमिका दें
model को किसी persona में डालते ही आउटपुट की गुणवत्ता तुरंत बदल जाती है:
"You are a senior Python developer reviewing a junior's code. Look at the function below and point out any bugs, style issues, or performance problems."
यह भूमिका model को बताती है कि अपने training data के किस “हिस्से” से प्रेरणा लेनी है। “Senior developer” सामान्य बातचीत वाले पैटर्न से नहीं, बल्कि code-review पैटर्न से खींचता है।
3. उदाहरण दें (few-shot prompting)
सबसे विश्वसनीय तकनीकों में से एक है model को ठीक वही दिखाना जो आप चाहते हैं:
"Convert these sentences into a formal tone: Informal: 'Hey, can you fix this bug?' Formal: 'Please address the identified issue at your earliest convenience.' Informal: 'This code is slow.' Formal:"
model पैटर्न देखता है और उसे आगे जारी रखता है। आपने प्रभावी रूप से उत्तर का पहला आधा हिस्सा स्वयं लिख दिया है।
4. Chain-of-thought – इसे step-by-step सोचने को कहें
तर्क-भारी कार्यों के लिए, पाँच शब्द जोड़ें जो सटीकता को नाटकीय रूप से बढ़ाते हैं:
"Think step by step before answering."
यह model को अपनी reasoning खुले में करने के लिए मजबूर करता है, जिससे त्रुटियाँ कम होती हैं। यह गणित, तर्क और योजना वाले प्रश्नों के लिए विशेष रूप से प्रभावी है।
यह क्यों काम करता है – model की “reasoning” उसके generate किए गए tokens में होती है। यदि आप इसे मध्यवर्ती चरण लिखने को कहते हैं, तो वे चरण अंतिम उत्तर के लिए context बन जाते हैं – और next-token prediction बेहतर जानकारी के साथ होती है।
5. इसे तोड़ें
जटिल अनुरोधों को चरणों में बाँटने पर बेहतर परिणाम मिलते हैं। एक विशाल prompt के बजाय, एक छोटी बातचीत करें:
You: "I want to write a blog post about Docker. Give me 5 topic ideas." Model: [lists ideas] You: "I like idea #3. Write an outline for it." Model: [outline] You: "Now write the introduction based on that outline."
हर चरण का आउटपुट अगले चरण में जाता है, और हर चरण पर model के पास एक केंद्रित कार्य होता है। परिणाम “Docker के बारे में पूरा ब्लॉग पोस्ट लिखो” वाले एकल prompt से कहीं बेहतर होता है।
6. बताएँ कि क्या नहीं करना है
नकारात्मक सीमाएँ सकारात्मक सीमाओं जितनी ही महत्वपूर्ण हैं:
"Explain REST APIs to a beginner. Do not use any jargon. Do not mention HTTP methods unless you define them first. Keep it under 200 words."
model सक्रिय रूप से उन चीज़ों से बचेगा जिन्हें आपने सूचीबद्ध किया है, जो अक्सर केवल ट्रैक पर बने रहने की उम्मीद करने से अधिक प्रभावी होता है।
7. दोहराएँ और सुधारें
शायद ही पहला आउटपुट बिल्कुल सटीक होता है। बातचीत को सहयोग की तरह मानें:
- “Make it shorter.” – model संक्षिप्त कर देगा।
- “Rewrite this in a more casual tone.” – शैली बदल देता है।
- “Add a concrete example.” – खाली जगहें भर देता है।
- “What did I miss?” – model अक्सर खामियाँ पहचान लेगा।
हर पुनरावृत्ति आपको बेहतर परिणाम देती है, और आपको कभी भी शून्य से शुरू करने की ज़रूरत नहीं पड़ती।
त्वरित संदर्भ
Technique When to use ───────────────────────────────────────────────── Be specific Always. Give format, length, audience. Role prompt Code reviews, domain-specific advice. Examples When output format is unusual. Chain of thought Math, logic, planning, analysis. Break it down Complex or multi-step requests. Negative constraints When the model goes off-track. Iterate Always. The first answer is the rough draft.
सबसे अच्छे prompter परफेक्ट prompt नहीं लिखते – वे प्रभावी prompt लिखते हैं और फिर सुधारते हैं। ऊपर दिए गए किसी भी पैटर्न से शुरू करें, देखें क्या मिलता है, और वहीं से tweak करें।