Vibe का जाल
आपने एक agent बनाया। आपने उससे 30 मिनट बात की। वह स्मार्ट लगा। आपने उसे ship कर दिया।
तीन दिन बाद एक user रिपोर्ट करता है कि उसने एक बुनियादी सवाल का आत्मविश्वास के साथ गलत जवाब दिया। आप फिर से test करते हैं — अब ठीक काम करता है। आप कंधे उचकाते हैं। शायद model का दिन खराब था।
यही vibe का जाल है: अनौपचारिक छापों को अपना quality signal बनाना। यह hobby scale पर काम करता है। जैसे ही आपके पास real users, real पैसा, या real जोखिम आता है, यह विफल हो जाता है।
Evals वह निकास रास्ता है।
Eval वास्तव में क्या होता है
Eval एक function है जो एक prompt और expected behavior लेता है और एक score लौटाता है। बस इतना। शुरू करने के लिए कोई fancy infrastructure की जरूरत नहीं।
सबसे सरल eval जो आप लिख सकते हैं:
interface EvalCase {
input: string;
expected: string;
check: (output: string) => boolean;
}
const cases: EvalCase[] = [
{
input: "What is 2 + 2?",
expected: "4",
check: (out) => out.includes("4"),
},
{
input: "Summarize: 'The quick brown fox jumps over the lazy dog'",
expected: "mentions fox and dog",
check: (out) => out.toLowerCase().includes("fox") && out.toLowerCase().includes("dog"),
},
];
async function runEvals(model: (prompt: string) => Promise<string>) {
let pass = 0;
for (const c of cases) {
const output = await model(c.input);
if (c.check(output)) {
pass++;
console.log(`✓ ${c.input.slice(0, 40)}`);
} else {
console.log(`✗ ${c.input.slice(0, 40)}`);
console.log(` Got: ${output.slice(0, 100)}`);
}
}
console.log(`\n${pass}/${cases.length} passed (${Math.round(pass / cases.length * 100)}%)`);
}
हर prompt बदलाव पर इसे चलाएं। अब आपके पास एक regression suite है।
तीन check types जो आपको चाहिए
1. Exact match — structured outputs, codes, IDs, yes/no decisions के लिए। Binary। तेज।
2. Contains check — prose outputs के लिए जहाँ exact wording बदलती है लेकिन key facts आने चाहिए। "Output में 'Paris' का उल्लेख है" यह "output 'Paris is the capital of France' के बराबर है" से ज्यादा robust है।
3. Model-graded — complex tasks के लिए जहाँ semantic judgment चाहिए। एक दूसरे (सस्ते, तेज) model से पूछें: "क्या यह response सवाल का सही जवाब देता है? YES या NO के साथ एक कारण बताएं।" यह subjective quality, tone, और reasoning chains तक scale होता है।
async function modelGrade(output: string, criterion: string): Promise<boolean> {
const verdict = await callModel(
`Criterion: ${criterion}\nOutput: ${output}\nDoes the output meet the criterion? Reply YES or NO only.`
);
return verdict.trim().startsWith("YES");
}
पहले क्या eval करें
अगर आप शून्य से शुरू कर रहे हैं, इस क्रम में eval करें:
-
Happy path — वे 5-10 inputs जिनके लिए आपका agent स्पष्ट रूप से डिज़ाइन किया गया था। ये सभी pass होने चाहिए। अगर नहीं होते, तो आपके पास काम करने वाला agent नहीं है, आपके पास सिर्फ एक demo है।
-
Edge cases जो आप पहले से fail होते देख चुके हैं — testing में जो भी टूटा। इन्हें तुरंत encode करें। हर bug एक eval case है।
-
Adversarial inputs — खाली inputs, malformed inputs, out-of-domain questions, prompt injection attempts। आपके agent को gracefully degrade करना होगा।
-
Regression set — 50-100 cases का एक fixed set जो आप हर बदलाव पर चलाते हैं। Green का मतलब है आपने कुछ नहीं तोड़ा। Red का मतलब है आपको एक निर्णय लेना है।
Eval workflow
Prompt बदलाव → Evals चलाएं → Score delta जांचें → अगर delta > threshold तो Ship करें → पूरा
आपका threshold stakes पर निर्भर करता है। एक toy project -2% स्वीकार कर सकता है। customer data handle करने वाला production agent +0% या बेहतर की मांग करनी चाहिए। इसे शुरू से पहले स्पष्ट रूप से set करें ताकि जब आपका score एक "छोटे" prompt tweak के बाद 4% गिरे तो आप दबाव में निर्णय न लें।
जानने योग्य tools
- Braintrust — eval runs, logging, model comparison। उदार free tier है।
- Promptfoo — open-source, locally चलता है, red-teaming के लिए उत्कृष्ट।
- Langfuse — observability और eval, अच्छा अगर आप scores के साथ tracing चाहते हैं।
- DIY script — simple agents के लिए, एक 50-line TypeScript script अक्सर काफी होती है। Over-engineer न करें।
असुविधाजनक सच्चाई
अधिकांश agentic failures prompt failures हैं, model failures नहीं। आपको नए model की जरूरत नहीं है। आपको यह जानना है कि आपका current prompt कहाँ टूटता है और उसे ठीक करना है।
Evals यह बताते हैं। Vibes नहीं।
अगला feature जोड़ने से पहले eval harness बनाएं। भविष्य का आप आभारी होगा।
