6.3.11 · HinglishInterpretability & Explainability

Concept-based explanations

2,190 words10 min readRead in English

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.

  1. Concept examples collect karo: Stripes wali images (P) aur bina stripes ki random images (N) lo.
  2. Activations extract karo: Dono sets ko model se feed karo, layer par activations extract karo: .
  3. 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."

  1. Concept examples collect karo: 50 striped images (tigers, barcode patterns, striped shirts), 50 random ImageNet images.
  2. Activations extract karo: Layer mixed5c (Inception V3) use karo. Har image → .
  3. CAV train karo: 100 activations par Logistic regression. milta hai.
  4. Zebras par test karo: 100 zebra images lo. Har ek ke liye:
    • Backprop se compute karo.
    • Check karo ki hai ya nahi.
  5. Result: 87% zebras ka positive directional derivative hai → .
  6. 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.


Figure — Concept-based explanations

ACE: Automated Concept Extraction

Yeh kaise kaam karta hai:

  1. Inputs segment karo: Image segmentation (jaise SLIC superpixels) use karke patches extract karo.
  2. Activations cluster karo: Sabhi patches ke layer activations par k-means run karo. Har cluster = ek discovered concept.
  3. Concepts ko naam do: Cluster examples manually inspect karo ya captioning model use karo.
  4. 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

  1. Concept-based explanations model internals ko human semantics mein translate karti hain.
  2. TCAV class logits ke directional derivatives ke zariye concept importance measure karta hai.
  3. False positives se bachne ke liye Statistical testing (random CAVs) mandatory hai.
  4. ACE clustering ke zariye concept discovery automate karta hai, lekin control ke badle coverage milti hai.
  5. 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:

  1. Robot ko bahut saari striped cheezein dikhao (flags, tigers, barcodes).
  2. Jab woh stripes dekhta hai toh uske brain ke numbers dekho.
  3. Uske brain mein woh "direction" dhundho jiska matlab "stripy" hai.
  4. 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

Feature attribution aur concept-based explanations mein key difference kya hai?
Feature attribution predictions ko raw input features (pixels, tokens) se explain karta hai; concept-based methods high-level semantic concepts (jaise "stripes," "metal") use karte hain jo humans define karte hain.
Concept Activation Vector (CAV) kya hota hai?
Ek neural network ke activation space mein ek unit vector jo human-defined concept se corresponding direction ki taraf point karta hai, jo linear classifier train karke seekha jaata hai concept examples ko non-examples se alag karne ke liye.
TCAV score kya measure karta hai?
Class ke un examples ka fraction jahan class logit ka layer activations ke w.r.t. directional derivative ka concept vector ke saath positive dot product ho. Measure karta hai ki concept badhane se class probability badhti hai ya nahi.
TCAV ko random CAVs se compare karna kyun zaroori hai?
High-dimensional spaces mein, random vectors chance se gradients ke saath non-zero alignment kar sakte hain. Random baselines true concept usage ko noise se alag karte hain.
ACE kya hai aur TCAV se kaise alag hai?
ACE (Automated Concept-based Explanations) activation space mein clustering ke zariye automatically concepts discover karta hai, jabki TCAV ke liye manually curated concept example sets chahiye hote hain.
Concept-based explanations mein concepts atomic kyun hone chahiye?
Atomic concepts (single semantic meaning) precise identification allow karte hain ki model kya use karta hai. Concepts mix karna (jaise "stripes-and-color") yeh isolate karna rokta hai ki kaun sa feature predictions drive karta hai.
TCAV mein ka kya matlab hai?
Activation ko concept ki direction mein move karna class ke logit ko badhata hai, matlab model concept use karta hai input ke liye class predict karne mein.
Typical TCAV score range aur interpretation kya hai?
TCAV scores 0 se 1 ke beech hote hain. 1 ke paas matlab concept class ko strongly influence karta hai; 0 ke paas matlab irrelevant ya opposed hai; ~0.5 randomness suggest karta hai (koi relationship nahi).
ACE automatically concepts kaise discover karta hai?
ACE inputs ko patches mein segment karta hai, activations extract karta hai, unhe cluster karta hai (jaise k-means), aur har cluster ko ek concept maanta hai. Concepts ko phir inspection ya captioning models se naam diye jaate hain.
Model zebras ko "stripes" use kiye bina kyun classify kar sakta hai?
Model spurious correlations exploit kar sakta hai (jaise "savanna background" ya "four-legged silhouette") agar woh features training data mein statistically predictive hain. TCAV aisi alternate strategies reveal karta hai.

Concept Map

limited to

shows where not what

solved by

use

canonical method

examples P and N

train linear classifier

dot product with

sign counted over class

fraction positive

averaged via

Feature attribution

Raw input features

Semantic gap

Concept-based explanations

Human concepts stripes furriness

TCAV Kim 2018

Layer activations h_l

Concept Activation Vector v_c

Gradient of logit S_k

TCAV score

Concept sensitivity for class k

Expectation over examples