Concept-based explanations
6.3.11· AI-ML › Interpretability & Explainability
Concept-based Explanations Hain Kya?
Shift yeh hai:
- Feature attribution → "Pixel (x, y) ne output mein +0.8 contribute kiya."
- Concept-based → "'Stripes' ki presence ne ise zebra classify karne mein +2.3 contribute kiya."
Yeh Kaise Kaam Karta Hai: TCAV Derive Karna (Testing with Concept Activation Vectors)
TCAV (Kim et al., 2018) canonical concept-based method hai. Isse scratch se samjhte hain.
Step 1: Concept Activation Vector (CAV) Kya Hota Hai?
Maano hum test karna chahte hain ki model "striped" concept use karta hai ya nahi.
- Concept examples collect karo: Stripes wali images (P) aur bina stripes ki random images (N) lo.
- Activations extract karo: Dono sets ko model se feed karo, layer par activations extract karo: .
- Linear classifier train karo: Activation space mein P aur N ko alag karne wala hyperplane seekho:
jahan concept examples ke liye, random ke liye. Normal vector (normalization ke baad) hi CAV hai — yeh activation space mein "striped" direction ki taraf point karta hai.
Yeh kyun kaam karta hai: Agar model "stripes" ko internally represent karta hai, toh striped images activation space mein cluster ho jaati hain. CAV usi clustering direction ko capture karta hai.
Step 2: Concept Sensitivity Measure Karna
Ab hum test karte hain: Kya class ke liye model ki prediction concept par depend karti hai?
Class ke logit ka concept ke saath directional derivative define karo:
Tukda tukda samjho:
- : class ke logit ka layer activations ke w.r.t. gradient. Yeh batata hai " badhane ke liye ko kaise change karein."
- : dot product. Agar positive hai, toh ko concept direction ki taraf move karne se badhta hai.
- : binary indicator. Hum un examples ka fraction count karte hain jahan concept class ko positively influence karta hai.
Expectation kyun? Hum class ke multiple examples par test karte hain (jaise kai zebra images) taaki ek single sample ka noise avoid ho.
Step 3: Statistical Significance
TCAV ko multiple random concept sets ke saath run karo (same size as P, N se drawn). Agar real CAV ka score random se significantly zyada hai, toh concept genuinely use hota hai.
Typical threshold: .
Worked Example: Zebra Classification ke liye "Striped"
Setup: ImageNet classifier, class = zebra, concept = "striped."
- Concept examples collect karo: 50 striped images (tigers, barcode patterns, striped shirts), 50 random ImageNet images.
- Activations extract karo: Layer
mixed5c(Inception V3) use karo. Har image → . - CAV train karo: 100 activations par Logistic regression. milta hai.
- Zebras par test karo: 100 zebra images lo. Har ek ke liye:
- Backprop se compute karo.
- Check karo ki hai ya nahi.
- Result: 87% zebras ka positive directional derivative hai → .
- Random se compare karo: 20 random CAVs run karo → mean TCAV = 0.52, std = 0.08. Score 0.87, door hai → . Conclusion: Model genuinely "stripes" use karta hai zebras classify karne ke liye.
Yeh step kyun? Statistical testing ke bina, 0.6 ka TCAV noise ho sakta hai. Random baseline spurious correlations ko activation space mein control karta hai.

ACE: Automated Concept Extraction
Yeh kaise kaam karta hai:
- Inputs segment karo: Image segmentation (jaise SLIC superpixels) use karke patches extract karo.
- Activations cluster karo: Sabhi patches ke layer activations par k-means run karo. Har cluster = ek discovered concept.
- Concepts ko naam do: Cluster examples manually inspect karo ya captioning model use karo.
- TCAV run karo: TCAV ke zariye har discovered concept ki importance test karo.
Faida: Poora data-driven hai. Aisi concepts discover karta hai jo tumne test karne ke baare mein socha bhi nahi tha (jaise "model background grass use karta hai cows classify karne ke liye").
Limitation: Cluster quality segmentation par depend karti hai. Semantic meaning guaranteed nahi hai.
Common Mistakes
Connections
- Feature Attribution Methods — Concept-based explanations pixel-level saliency ko semantic meaning add karke complement karti hain.
- Layer-wise Relevance Propagation — LRP importance ko inputs tak trace karta hai; TCAV importance ko concepts tak trace karta hai.
- Adversarial Examples — Concept-based methods un spurious concepts ko reveal kar sakti hain jo model exploit karta hai (jaise medical images mein "watermark").
- Model Editing — Ek baar harmful concepts identify ho jayein (TCAV ke zariye), tum corresponding CAV directions ko ablate kar sakte ho.
- Probing Classifiers — Dono representation spaces probe karte hain, lekin probing poochti hai "kya concept X encoded hai?" jabki TCAV poochta hai "kya X decision Y ke liye use hota hai?"
Key Takeaways
- Concept-based explanations model internals ko human semantics mein translate karti hain.
- TCAV class logits ke directional derivatives ke zariye concept importance measure karta hai.
- False positives se bachne ke liye Statistical testing (random CAVs) mandatory hai.
- ACE clustering ke zariye concept discovery automate karta hai, lekin control ke badle coverage milti hai.
- Concepts atomic (single semantic) hone chahiye aur causally tested (sirf present nahi) hone chahiye.
Recall Ek 12-saal ke bachche ko explain karo
Socho tum ek robot ko animals pehchanna sikha rahe ho. Tum use pictures dikhate ho, aur woh khud seekhta hai. Baad mein tum poochho: "Jab tum zebra dekhte ho, tum kya dhundhte ho? Stripes? Shape? Background?"
Lekin robot English nahi bolta! Uska brain sirf numbers ka bunch hai. Toh hum ek trick use karte hain:
- Robot ko bahut saari striped cheezein dikhao (flags, tigers, barcodes).
- Jab woh stripes dekhta hai toh uske brain ke numbers dekho.
- Uske brain mein woh "direction" dhundho jiska matlab "stripy" hai.
- Test karo: Jab robot zebra dekhta hai, kya uske brain ko "stripy" ki taraf change karne se woh zyada confident ho jaata hai ki yeh zebra hai? Agar haan → robot stripes use karta hai! Agar nahi → shayad woh kuch aur dekh raha hai (jaise grass). Yeh robot ko un concepts ke liye vocabulary test dene jaisa hai jo hum samajhte hain.
Flashcards
#flashcards/ai-ml