Exercises — Responsible AI deployment practices
6.4.15 · D4· AI-ML › AI Safety & Alignment › Responsible AI deployment practices
Is page ke ideas 6.4.1-Adversarial-examples, 6.4.8-Fairness-metrics, 6.4.12-Explainability-methods, 6.3.2-MLOps-principles, 5.2.4-A-B-testing, aur 6.4.14-AI-governanceframeworks se liye gaye hain. Hinglish version chahiye? Yeh page Hinglish mein →.
Symbols Jo Tumhe Chahiye Honge (ek baar build kiye, har jagah use hote hain)
Yeh definitions saamne rakh lo. Neeche har problem inhi tools mein se ek hai jo ek clear sawal ka jawab de rahi hai.
Level 1 — Recognition
Exercise 1.1
Har safeguard ko us failure se match karo jo woh prevent karta hai: (a) Shadow mode, (b) Circuit breaker, (c) Staged rollout, (d) Confidence-based routing. Failures: (i) ek rare edge case jo ek saath sare users ko wipe out kar de, (ii) users ka broken naye model ko bilkul dekhna, (iii) adversarial inputs ki ek burst jo hazaaron bad decisions mein cascade ho jaaye, (iv) ek low-confidence prediction jo bina kisi human check ke act ho jaaye.
Recall Solution
- (a) Shadow mode → (ii). Naya model parallel mein run karta hai lekin uska output kabhi users ko nahi dikhaya jaata, toh failure ka zero user impact hota hai.
- (b) Circuit breaker → (iii). Yeh low-confidence/error signals ki burst ke baad "trip" karta hai, blast radius ko cap karta hai (upar define kiya gaya).
- (c) Staged rollout → (i). Audience ko slowly grow karne ka matlab hai ki ek rare edge case pehle ek small population ko hit karta hai.
- (d) Confidence-based routing → (iv). Below-threshold predictions ko human ke paas bhej diya jaata hai. Yeh kyun matter karta hai: yeh teen pillars hain — pre-deployment (c, a), runtime (b), oversight (d) — har ek alag failure mode ko catch karta hai. Neeche diya diagram har safeguard ko deployment timeline par place karta hai taki tum dekh sako ki har ek kahan blast radius ko shrink karta hai.

Diagram deployment lifecycle ke saath left se right padhta hai. Staged rollout (lavender) aur shadow mode (mint) pehle act karte hain jab users expose hote hain; widening funnel dikhata hai ki audience sirf tab grow hoti hai jab har gate pass ho jaata hai. Circuit breaker (coral) runtime par baitha hai, failures ki spike ko clamp karta hai. Confidence routing (butter) uncertain cases ko ek human ke paas peel off karta hai. Shaded "blast radius" band har baar shrink hoti hai jab ek safeguard intervene karta hai.
Exercise 1.2
Formula mein, kaun sa symbol "real failure miss karne ka acceptable chance" hai? Kaun sa "failure rate" hai?
Recall Solution
- = acceptable miss chance (jaise ).
- = failure rate jise hum pakadna chahte hain (jaise ). (zaroorat ke samples) tab badhta hai jab shrink hota hai (rarer bugs ko zyada looks chahiye) aur jab shrink hota hai (zyada certainty ke liye zyada looks chahiye).
Level 2 — Application
Exercise 2.1
Tumhe suspect hai ki failure rate () hai. Tum chahte ho ki ise catch karne ka chance ho (). Stage ko kitne samples observe karne chahiye?
Recall Solution
WHAT: mein plug karo. YEH FORMULA KYUN: independent tries mein zero failures ka chance hai; hum ise force karte hain ki woh at most ho, phir ke liye solve karte hain. Round up karo (tum fractional request observe nahi kar sakte): samples. Agar is stage par daily volume users hai, toh woh din hai.
Exercise 2.2
classes wala ek image classifier ek request par probabilities output karta hai. Prediction entropy compute karo (base-2, toh answer "bits" mein hai — Symbols box mein fix ki gayi convention match karta hai).
Recall Solution
ENTROPY YAHAN KYUN: hum ek single number chahte hain ki "yeh guess kitna unsure hai?" Ek confident guess ka score low hona chahiye. Neeche diya figure padho is number ko ek scale par place karne ke liye: mint bar ek totally sure guess hai jiska hai; coral bar total confusion hai jiska bits hai; hamara butter bar par unke beech mein hai — moderately confident. Visual concretely dikhata hai ki production mein rising average entropy (Exercise 3.2) ek alarm kyun hai: bars rightward slide ho rahe hain confusion ki taraf.

Exercise 2.3
bins par training feature histogram: . Is hafte ka production histogram: . compute karo (base-2, bits — same convention).
Recall Solution
KL YAHAN KYUN: yeh score karta hai "ek model jo par tuned hai woh milne par kitna surprised hoga." Zyada = zyada drift. Note karo ki middle bin zero contribute karta hai (woh move nahi kiya) aur shrinking bin ek negative term contribute karta hai — lekin growing bin ise outweigh karta hai, toh total positive hai, jaise KL hamesha hota hai. Edge-case reminder: yahan har hai, toh sum well-defined hai. Agar koi production bin empty hota () jabki training ne use dekha tha (), toh woh term hota aur undefined hota — isliye real monitors ko pehle Laplace-smooth karte hain (Symbols box dekho).
Level 3 — Analysis
Exercise 3.1
Ek hafte ke shadow mode mein ek content-moderation model:
- Old model false-positive rate: .
- New model false-positive rate: .
- Lekin new-model false positives split: non-English names par , English names par .
Kya tumhe new model ko traffic par promote karna chahiye? Fairness lens use karke justify karo.
Recall Solution
Nahi. Aggregate metric () ek disparity hide kar raha hai. Demographic-parity idea use karke: false-positive rate group ke hisaab se differ karta hai. Ratio — ek -to- gap jo "within " parity gate se kaafi zyada hai. Diagnosis: English-biased training data ne model ko sikhaya "uncommon character sequences spam," toh Xiang ya Aditya jaisi names false positives trigger karti hain. Ek lower average error ek subgroup ki keemat par buy kiya gaya tha. Action: promote mat karo. Protected features ke roop mein multilingual name dictionaries ke saath training par return karo; kisi bhi staged rollout se pehle group ke hisaab se sliced shadow comparison re-run karo.
Exercise 3.2
Ek image classifier ki average entropy readings: Train , Week 1 , Week 4 (bits). Trend ko interpret karo aur likely cause ka naam batao. Kaun sa specific runtime metric ise confirm karega?
Recall Solution
Rising entropy = model average pe kam sure ho raha hai = woh aise inputs se mil raha hai jo uski training mein nahi the (out-of-distribution). Week 1 ka tiny rise () noise hai; Week 4 ki tak jump (almost doubled) ek red flag hai 🚨. Likely cause: ek distribution shift — jaise seasonal change (training mein bare winter trees vs. abhi blossoming spring trees). Yeh data drift hai. Confirming metric: input features par compute karo. Agar woh bhi apne threshold se spike kare, toh drift confirm ho jaata hai aur retrain justified hai. Entropy batata hai model unsure hai; KL batata hai inputs actually change ho gaye — tum chaahte ho dono agree karein pehle action lene se.
Level 4 — Synthesis
Exercise 4.1
Ek spam classifier ke liye ek circuit breaker design karo. Requirements:
- Ek prediction ko "error" treat karo agar uski confidence ho.
- Trip (open) karo jab last predictions mein error rate se exceed kare.
- Attack ke under, adversarial emails ki ek stream mein emails ki confidence hai.
(a) Kitni emails ke baad breaker trip karta hai? (b) Trip se pehle kitni bad emails users tak pahunchti hain, aur baaki ko humans ke paas route karke kitni bachayi jaati hain? (c) Full state machine specify karo — startup, reset, aur cooldown including.
Recall Solution
(a) Trip kab hota hai? — explicit answer. Breaker last predictions mein error rate ko ke against compare karta hai, yani woh tab trip karta hai jab trailing mein se se zyada errors hon ( ya zyada). steady error rate ke saath errors per email ki rate se aate hain. errors accumulate karne ke liye hum expect karte hain emails ki zaroorat hogi — lekin window ko contain karna hoga predictions jab tak ek "last-100" rate define bhi ho, aur jab tak vi email process hoti hai window mein errors hain, jo already hai. Toh steady-rate assumption ke under, pehle woh moment jab ek full trailing window exist karta hai () woh already errors dikhata hai aur trip ho jaata hai. Explicit answer: breaker vi email par trip karta hai (woh earliest point jab ek full -prediction window exist karti hai, us point par woh already over threshold hai).
(b) Blast radius — explicit numbers.
- Trip se pehle model ne actually jo emails process kiye: .
- Un mein se misclassified (low-confidence errors served): bad emails users tak pahunchi.
- Trip ke baad human reviewers ko route ki gayi emails: emails (sab remaining traffic fallback par jaata hai).
- Un mein se prevented bad emails: likely errors avoid kiye gaye. Contrast: bina breaker ke, sab emails model ko hit karti hain aur misclassified hoti hain. Breaker served errors ko se ghataa kar tak le aata hai — blast radius mein reduction.
(c) Full state machine — startup, cooldown, aur ek explicit RESET. Neeche diya diagram har state aur transition dikhata hai; har ek yahan spell out hai.
- CLOSED (normal): model predictions serve karta hai; har ek last events ki sliding window mein log hota hai.
- Startup rule (problem statement se, koi invented hyperparameter nahi): trip condition yeh hai ki "last predictions mein error rate se exceed kare." Literally liya jaaye, woh rate sirf tab defined hai jab predictions exist karti hain. Isliye breaker window full hone se pehle trip nahi kar sakta () — startup behaviour simply hai "CLOSED raho jab tak trailing- window exist na ho." Yeh directly given requirement se nikalta hai; hum kuch add nahi karte.
- OPEN (tripped): sab traffic fallback (human reviewers / safe default) par jaata hai; koi model calls nahi hote. Ek cooldown timer run karta hai (ek fixed wait, jaise s ya events) jis dauraan breaker model ko bilkul touch karne se refuse karta hai — yeh rapid on/off flapping prevent karta hai.
- HALF-OPEN (probing, automatically enter hota hai jab cooldown elapse ho jaata hai): breaker model ke through ek small trial batch let karta hai. Agar trial batch ka error rate below wापas aa jaaye, toh CLOSED pe transition karo; agar abhi bhi high ho, toh OPEN wापas jaao aur cooldown restart karo.
- RESET (explicit transition, HALF-OPEN → CLOSED): "reset" precisely woh successful HALF-OPEN probe hai — breaker apna error window clear karta hai aur normal CLOSED operation par return karta hai. Ek manual RESET bhi hai: ek on-call engineer, root cause fix karne ke baad, directly OPEN → CLOSED force kar sakta hai (window clear karte hue), automatic path ko override karte hue. Dono diagram mein labelled hain. Design note: sliding window recent degradation par react karta hai; startup rule early flapping prevent karta hai; cooldown oscillation prevent karta hai; HALF-OPEN probe (auto-reset) plus manual reset dono service restore karte hain; aur fallback guarantee karta hai ki users ko phir bhi koi answer mile. Yeh adversarial-robustness safety net in action hai.
Full state machine (CLOSED → OPEN → HALF-OPEN, plus dono reset paths) jo solution specify karta hai:
Exercise 4.2
Ek hospital diagnosis assistant ke liye ek monitoring dashboard design karo. Paanch panels ke liye, state karo woh failure mode jo har ek catch karta hai aur ek concrete alert trigger. Design ko teen pillars aur governance se tie karo.
Recall Solution
Neeche diya wireframe paanch panels ko ek annotated dashboard ki tarah sketch karta hai; accompanying reasoning har panel ke neeche state ki gayi hai.
Panel 1 — Human override rate. Catches: model ab useful nahi raha (doctors ise reject karte hain). Trigger: h ke liye → page on-call. Panel 2 — Feature drift (). Catches: inputs ab training world se match nahi karte. Trigger: → retrain queue karo. Panel 3 — Average confidence / entropy. Catches: model growing uncertain ho raha hai (out-of-distribution). Trigger: entropy baseline se up. Panel 4 — Latency P95. Catches: usability degradation aur infra stress. Trigger: P95 s → auto-scale. Panel 5 — Demographic breakdown. Catches: emerging subgroup bias. Trigger: parity gap → block + audit.
Yeh pillars se map kyun karta hai: override rate aur demographic breakdown human-oversight + fairness signals hain; drift, entropy, latency runtime monitoring hain; aur upar har threshold ek documented, auditable gate hai — exactly wahi jo ek governance framework aur MLOps discipline demand karte hain (har metric traceable, har alert owned).
Level 5 — Mastery
Exercise 5.1
Tumhara rollout budget ek stage mein at most samples observe karne ki permission deta hai, aur tum failure catch karne ka confidence demand karte ho. Smallest failure rate kya hai jo tum is budget mein reliably detect kar sakte ho? Interpret karo: yeh us failures ke baare mein kya kehta hai jo isse rare hain?
Recall Solution
WHAT: rollout formula ko aur given hone par ke liye invert karo. se starting: Interpretation: samples ke saath tum roughly tak failures catch kar sakte ho. Jo kuch bhi isse rare ho (jaise , ten-thousand mein ek) woh is stage se se zyada chance ke saath undetected nikal jaayega — yeh long-tail curse hai: tum ultra-rare events ke against testing se safety nahi pa sakte; unhe wild mein catch karne ke liye tumhe runtime monitoring aur circuit breakers chahiye.
Exercise 5.2
Ek confidence-based router predictions jo threshold se neeche hain unhe humans ko bhejta hai. Maano ko se tak badhane se human-review load se traffic tak badhta hai jabki automated errors se tak cut hote hain. Human review \0.50$40100{,}000$ daily requests ke liye, kaun sa threshold sasta hai? Kya cost sirf ek criterion hona chahiye?
Recall Solution
WHAT: total daily cost (human-review cost) (automated-error cost). par: review = 0.12 \times 100000 \times \0.50 = $6000= 0.030 \times 100000 \times $40 = $120000= $126000\tau=0.90= 0.22 \times 100000 \times $0.50 = $11000= 0.018 \times 100000 \times $40 = $72000= $83000\tau = 0.90$43000\tau$ (zyada human review) mandate kar sakti hai, aur explainability har routed case ke saath honi chahiye taki human reviewer acche se decide kar sake. Cost argument ka ek floor set karta hai, ceiling nahi.
Recall Self-Test Cloze
Ek staged rollout ko samples chahiye kyunki tries mein zero failures ka chance ==== hai, forced. Shadow mode A/B testing se isliye alag hai kyunki ::: sirf old model ka output users tak pahunchta hai; naya model silently offline score hota hai (zero user risk). Rising average entropy signal karta hai ::: model average pe kam confident ho raha hai, likely out-of-distribution inputs (drift) se mil raha hai. KL divergence undefined hai jab ek production bin empty ho kyunki ::: ; hum ise fix karne ke liye ko Laplace-smooth karte hain. Ek circuit breaker OPEN se CLOSED aata hai ::: HALF-OPEN state (auto-reset probe) ya on-call engineer ke manual reset ke zariye.