Ek transformer layer computation se shuru karo. Real transformers LayerNorm apply karte hain (ya to pre-norm ya post-norm). Common pre-norm form likhte hain:
hmid=hl+Attn(LN1(hl))hl+1=hmid+MLP(LN2(hmid))
LayerNorm explicitly kyun include karein? Normalization ki placement change karti hai ki nonlinearities kahan act karte hain, aur yeh residual-stream picture ke liye essential hai — yeh normalize karta hai ki har sublayer residual stream se kya padhta hai jabki stream khud raw sums accumulate karta rehta hai. Ise drop karna (jaise bare hl+1=hl+MLP(hl+Attn(hl))) actual computation ko misrepresent karta hai.
Ab attention sublayer ko decompose karo. H heads mein se har ek value-weighted sum compute karta hai, phir saare head outputs concatenate hote hain aur ek single output matrix WO apply hoti hai:
Attn(x)=WO⋅concati=1H(softmax(dkQiKiT)Vi)
Equivalently, WO ko per-head blocks WO=[WO(1)WO(2)⋯WO(H)] mein split karke jo har head ke slice par act karte hain, hum additive-over-heads form likh sakte hain:
Attn(x)=∑i=1HWO(i)⋅softmax(dkQiKiT)Vi
Yahan WO(i)independent projection matrices nahi hain — yeh single shared WO ke column-blocks hain. 1/dk factor kyun? Yeh dot-product logits ko rescale karta hai taaki unka variance ≈1 rahe regardless of head dimension dk, softmax ko saturation se baahir rakhta hai. Yeh decomposition kyun? Kyunki empirically, individual heads aksar distinct operations perform karte hain (jaise "previous token head", "induction head").
Ek circuit in heads + MLP neurons ka subset hota hai jo:
Output par strong causal effect rakhta ho
Ek coherent algorithm implement karta ho
Minimally sufficient ho (components hatane se functionality toot jaaye)
Ablation batata hai ki component matter karta hai ya nahi
Patching batata hai ki yeh kaunsi information compute karta hai aur kahan woh information flow karti hai
Patching method ki derivation:
Do inputs xclean aur xcorrupted consider karo jahan model clean par succeed karta hai lekin corrupted par fail karta hai.
Maan lo aiclean component i ki activation hai clean input par. Patching experiment:
model(xcorrupted)but withaj←ajclean
Agar performance recover ho jaaye, component j correct computation ko causally mediate karta hai.
Yeh kyun kaam karta hai: Agar j success ke liye zaroori key information compute karta hai, toh us computation ko transplant karna functionality restore karta hai.
AI Safety: Deployment se pehle deceptive reasoning circuits detect karo
Capability analysis: Samjho ki model kya seekh sakta hai uski limits kya hain
Scientific discovery: Networks novel algorithms implement kar sakte hain jo humans ne design nahi kiye
Model editing: Specific circuits target karke behavior surgically modify karo
Recall Ek 12-saal ke bacche ko explain karo
Socho tumhe ek super advanced alien computer mila hai jo chess bahut accha khelti hai, lekin tum samajh nahi rahe ki andar kaise kaam karta hai. Tumhare paas ise figure out karne ke do tarike hain:
Purana tarika (regular interpretability): Dekho ise khelते aur notice karo "oh, jab board par queen hoti hai, yeh light blink karti hai." Tum sirf bahar se patterns notice kar rahe ho.
Naya tarika (mechanistic interpretability): Tum carefully ise kholo aur wires trace karo. Tumhein pata chalta hai ki parts ka ek group milkar "aisi pieces dhundta hai jo capture ho sakti hain", doosra group "evaluate karta hai ki king safe hai ya nahi", aur yeh groups ek specific tarike se connected hain decisions lene ke liye. Tumne woh actual step-by-step recipe figure out kar li jo computer use karta hai!
Mechanistic interpretability aise detective ki tarah hai jo sirf yeh nahi dekhta ki AI kya karta hai, balki actual "recipe" ya "algorithm" figure out karta hai jo woh follow kar raha hai, step by step, wire by wire. Yeh bahut zaroori hai kyunki agar hum AI par important decisions ke liye trust karne wale hain, toh hume sirf YEH nahi samajhna ki woh KYA decide karta hai, balki yeh bhi ki WOH KAISE SOCHTA HAI!
Model Editing — mechanistic understanding ke applications
#flashcards/ai-ml
Mechanistic interpretability kya hai aur yeh post-hoc interpretability se kaise differ karti hai? :: Mechanistic interpretability neural networks ke learned algorithms ko reverse-engineer karti hai individual components aur circuits analyze karke. Post-hoc interpretability decisions ke baad unhe explain karti hai; mechanistic interpretability woh computational mechanism explain karti hai jo decisions produce karta hai.
Circuits Hypothesis kya hai?
Yeh hypothesis ki neural networks circuits se bane hote hain — sparse subgraphs jo specific, interpretable algorithms implement karte hain. Har circuit ek human-understandable computation perform karta hai jaise edge detection ya pattern completion.
Yeh query-key dot products ko rescale karta hai taaki unka variance approximately 1 rahe regardless of head dimension d_k, softmax ko uski saturated regime se baahir rakhta hai aur useful gradients preserve karta hai.
Multi-head attention mein, kya har head ke liye alag output matrix W_O hoti hai?
Nahi. H head outputs concatenate hote hain aur ek single shared output matrix W_O apply hoti hai. Per-head blocks W_O^(i) sirf us ek W_O ke column-slices hain, jo tumhein attention ko heads par additive sum ke roop mein likhne deta hai.
Activation patching kya hai aur yeh ablation se zyada powerful kyun hai?
Activation patching ek run ki activations ko doosre run ki activations se replace karta hai yeh test karne ke liye ki behavior transfer hota hai ya nahi. Yeh ablation se zyada powerful hai kyunki ablation sirf dikhata hai ki component matter karta hai ya nahi, jabki patching dikhata hai ki yeh KAUNSI information compute karta hai aur WOH information KAHAN flow karti hai.
Superposition kya hai aur yeh polysemanticity kyun cause karta hai?
Superposition tab hota hai jab networks apne dimensions se zyada features represent karte hain features ko non-orthogonal directions ke roop mein encode karke. Yeh polysemanticity cause karta hai (neurons multiple unrelated features par respond karte hain) kyunki features ek doosre ke saath interfere karte hain jab woh orthogonal nahi hote.
Logit lens technique kya hai?
Ek technique jo intermediate layer activations ko directly vocabulary logits mein project karti hai yeh reveal karne ke liye ki model har layer par kya "sochta" hai. Yeh kaam karta hai kyunki residual stream information linearly accumulate karta hai, toh early layers mein partial "answers" hote hain jo unembedding matrix padh sakti hai.
Induction head kya hai aur yeh kaunsa algorithm implement karta hai?
Ek induction head ek attention pattern hai jo repeated sequences complete karta hai. Yeh implement karta hai: "Current token ki previous occurrence dhundo, phir jo uske baad aaya tha use copy karo." Example: "A B ... A B" mein, yeh predict karta hai ki agla token wahi hona chahiye jo pehle "A B" ke baad aaya tha.
Neuron activation aur ek concept ke beech correlation yeh claim karne ke liye insufficient kyun hai ki neuron woh concept "detect" karta hai?
Correlation yeh prove nahi karta ki neuron woh concept COMPUTE karta hai — yeh spurious correlation ho sakta hai, aur yeh explain nahi karta ki neuron decisions mein KAISE contribute karta hai. Computational role verify karne ke liye causal methods (patching, ablation) use karne chahiye.
Dictionary learning polysemantic neurons decompose karne mein kaise help karta hai? :: Dictionary learning L1 penalty ke saath sparsity ke liye ek overcomplete basis (dimensions se zyada features) dhundta hai. Yeh ek single polysemantic neuron ko multiple interpretable features mein decompose karta hai jo superposition mein the, alag-alag computations ko separate karta hai.
Neural network mein circuit identify karne ke liye teen criteria kya hain?
1) Output par strong causal effect (ablation/patching ke zariye), 2) Ek coherent algorithm implement karta hai jo human-understandable ho, 3) Minimally sufficient ho (koi bhi component hatane se functionality toot jaaye).