मुख्य सामग्री पर जाएँ
Zubnet AIसीखेंWiki › In-Context Learning
मूल तत्व

In-Context Learning

इसे भी कहा जाता है: ICL
Large language model की prompt में रखे examples या instructions से task सीखने की क्षमता, model weights को update किए बिना। उसे कुछ input-output pairs दिखाएँ और वह नए inputs पर pattern जारी रखता है, request time पर plain text में effectively program होता हुआ। OpenAI के 2020 GPT-3 paper ने इसे popular बनाया, और prompting के interface के रूप में काम करने का यही कारण है।

यह क्यों मायने रखता है

In-context learning ने एक frozen model को general-purpose tool बनाया: हर task के लिए specialist train करने के बजाय आप task को text में describe करते हैं और seconds बाद usable answer पाते हैं। इसी कारण prompt engineering skill के रूप में मौजूद है और ML training pipeline के बिना teams AI features ship कर सकती हैं। Catch यह है कि learning owned नहीं, rented है — वह केवल context window में रहती है और हर call पर उन examples के लिए फिर pay करना होता है।

गहन अध्ययन

Mechanically, in-context learning केवल inference है। Prompt — instructions, कुछ demonstrations और नया input — single forward pass में Transformer से गुजरता है और attention layers काम करती हैं: वे new input को context में बैठे demonstrations से match करके implied pattern के अनुरूप continuation बनाती हैं। कोई gradients compute नहीं होते, weights नहीं छुए जाते और disk पर model पहले तथा बाद में byte-identical रहता है। Learning जैसा महसूस होना pre-training में tasks लिखे जाने के तरीकों के बारे में absorbed patterns का model द्वारा उपयोग है। इसे famous बनाने वाला demonstration OpenAI का 175-billion-parameter GPT-3 paper, 'Language Models are Few-Shot Learners' (2020), था: एक frozen model केवल prompt text से translation, question answering तथा arithmetic ऐसे level पर कर रहा था जहाँ era के smaller models नहीं पहुँच सकते थे।

Zero-Shot, One-Shot और Few-Shot

Terms बताते हैं कि prompt में कितने demonstrations हैं। Zero-shot केवल instructions है, जैसे 'इस review को positive या negative classify करें'; one-shot एक worked example जोड़ता है। फ्यू-शॉट लर्निंग कुछ examples जोड़ती है — chat models में आम तौर पर 2–10 और research settings में कुछ दर्जन तक। Sentiment के few-shot prompt में तीन short reviews और हर एक के बाद label, फिर चौथा review तथा 'Sentiment:' शब्द दिख सकते हैं — model दिखाया format copy करके label भरता है। Format consistency newcomers की expectation से अधिक महत्वपूर्ण है: same delimiter, same label vocabulary और same field order। Few-shot classification, extraction तथा formatting tasks में reliably zero-shot से बेहतर है जहाँ output contract describe करना कठिन लेकिन demonstrate करना आसान है।

Catch यह है कि models examples के selection तथा arrangement के प्रति अजीब तरह sensitive हैं। Well-documented failure mode majority-label bias है: चार में तीन examples 'positive' label हों तो actual input के बावजूद model positive की ओर झुकता है। Recency bias, last example को अधिक weight देना, और example-order effects भी real हैं — same examples shuffle करने पर accuracy कई points बदल सकती है। Practitioners balanced label sets, easy के बजाय hard representative examples और कभी-कभी output probabilities recalibrate करके इसका सामना करते हैं। यह fragility इस कारण का हिस्सा है कि field ने 2020 के बाद instruction tuning पर इतना ज़ोर दिया: plain instructions follow करने वाले model को babysit करने के लिए कम examples चाहिए।

यह काम ही क्यों करता है

कोई settled explanation नहीं है, लेकिन दो theories dominant हैं। पहली मेकैनिस्टिक इंटरप्रेटेबिलिटी से आती है: attention reverse-engineer करते researchers को ऐसे circuits मिले जिन्हें वे Induction Head कहते हैं, जो simple algorithm implement करते हैं — context में पिछली जगह खोजें जहाँ current pattern आया था, देखें उसके बाद क्या आया और फिर वही predict करें। Copy-the-pattern move लगभग ठीक वही है जो few-shot learning को चाहिए, और induction heads training में करीब उस point पर बनते हैं जहाँ in-context learning ability spike करती है, जो suggestive है भले पूरी story न हो। दूसरी theory ICL को implicit Bayesian inference मानती है: pre-training text latent tasks तथा formats की उलझी सामग्री है और coherent prompt model को infer करने देता है कि वह किस kind के document के भीतर है, फिर उसी तरह continue करता है। दोनों views compatible हैं — एक circuit describe करता है, दूसरा statistics — और दोनों समझाते हैं कि clean, self-consistent prompts sloppy prompts से बेहतर क्यों हैं।

Scale dependence पर debate नहीं है। Few-shot ability small models में weak या absent होती है और parameters तथा training data के साथ तेज़ी से improve करती है, एमर्जेंस का सबसे साफ़ example। इसीलिए GPT-3 result का इतना असर पड़ा: billion-parameter model पर कुछ न करने वाले prompts 175-billion model पर काम करते थे। यही कारण है कि in-context learning quality model generations के बीच अब भी quiet differentiator है — bigger models को कम examples चाहिए और वे messier examples tolerate करते हैं।

कुछ Save नहीं होता

लगातार बनी गलतफ़हमी है कि model आपके examples से training की तरह 'सीखता' है — कि अच्छा few-shot session अगले user के लिए model improve करता है। ऐसा नहीं है। Inference में weights frozen रहते हैं; apparent learning कॉन्टेक्स्ट विंडो के भीतर activation state है और context drop होते ही evaporate होती है। New chat शुरू करें और carefully chosen examples का कोई trace नहीं रहता। यही फ़ाइन-ट्यूनिंग से fundamental difference है, जो gradient descent से weights rewrite करती है और हर future request में persist होती है। Chat product sessions के बीच आपको याद करता दिखे तो वह memory feature है — stored notes बाद के prompts में फिर inject होते हैं — in-context learning नहीं।

Ephemerality की cost है: कुछ save न होने के कारण behavior चाहने वाली हर request को examples फिर carry करने होते हैं, और substantial examples वाला 10-shot prompt हर call में thousands of tokens जोड़ सकता है। Prompt Caching इसे soften करती है — providers processed prefix discount पर reuse करते हैं — लेकिन high-volume, narrow tasks के लिए fine-tuned small model unit economics में अक्सर जीतता है। Common rule of thumb: in-context learning से prototype करें और fine-tuning तभी चुनें जब prompt tax या error rate शर्मनाक हो जाए।

Prompting कैसे Interface बना

2020 से पहले language model को task के लिए adapt करने का अर्थ transfer learning था: pretrained model लें, labeled data पर fine-tune करें और specialist deploy करें। GPT-3 के few-shot results ने economics पलट दी — frozen model natural language में program हो सके तो एक API हर task serve कर सकती है और users अपना task ला सकते हैं। उस inversion ने प्रॉम्प्ट इंजीनियरिंग को discipline बनाया, system prompt को standard control surface बनाया और बाद की ऐसी techniques तैयार कीं जो वास्तव में disguise में ICL हैं: विचार-शृंखला prompting आंशिक रूप से model को worked reasoning traces दिखाकर काम करती है, और retrieval-augmented generation model पर भरोसा करती है कि context में आने वाला text इस्तेमाल करेगा। नया term 'context engineering' वही insight mature रूप में है: context window programming surface है और in-context learning उसे चलाने वाला interpreter।

← सभी शब्द
ESC