6.5.7 · HinglishResearch Frontiers & Practice

Continual and lifelong learning

3,615 words16 min readRead in English

6.5.7 · AI-ML › Research Frontiers & Practice

Ye kyun zaroori hai: Real-world AI ko continuously adapt karna padta hai (recommendation mein naye products, medical imaging mein nayi bimaariyaan, translation mein nayi bhashayein) bina har baar scratch se retrain kiye. Ek self-driving car jo naaye road signs seekhne ke baad pedestrians detect karna bhool jaaye—woh catastrophic hai.


The Stability-Plasticity Dilemma

Challenge yeh hai: standard SGD update sirf current task ka loss optimize karta hai, ke liye useful weights ko overwrite karta hai.

Lifelong Learning isko interchangeably use kiya jaata hai, kabhi kabhi transfer par emphasis de ke: nayi tasks purani knowledge se benefit leti hain (forward transfer), purani tasks nayi knowledge se improve hoti hain (backward transfer).


Catastrophic Forgetting Kyun Hota Hai (First Principles)

Chaliye derive karte hain neural nets kyun bhoolte hain. Maano hum task 1 ko convergence tak train karte hain:

par, gradient (local minimum). Ab task 2 aata hai. Hum update karte hain:

Yeh step kyun? Hum ko us direction mein move kar rahe hain jo ko reduce kare. Lekin yeh gradient sirf par compute hota hai. Agar us direction mein point kare jo ko increase kare, toh hum actively task 1 ko kharaab kar rahe hain.

Catastrophic forgetting isliye hota hai kyunki:

  1. Parameter overlap: Wahi weights sabhi tasks ke liye kaam karni padti hain. Task 2 ke liye ko move karna task 1 ke liye optimize configuration ko disturb karta hai.
  2. No explicit memory: Standard SGD mein chale jaane ke baad yaad rakhne ka koi mechanism nahi hai.

jahan = task tak training ke baad task par accuracy. Negative BWT ka matlab forgetting hai.

Average forgetting tasks mein:

Max kyun? Hum final performance ko task par baad ki tasks seekhne se pehle ki best performance se compare karte hain (forgetting peak se relative hai, sirf initial se nahi).


Teen Families of CL Solutions

1. Regularization-Based (Important Weights ko Protect Karo)

Idea: Identify karo ki kaun se weights purani tasks ke liye critical hain, phir nayi tasks seekhte waqt unhe badalne par penalty lagao.

Fisher kyun? Yeh measure karta hai ki agar hum ko perturb karein toh log-likelihood kitna change hoti hai. High → parameter purani task ki prediction ke liye "important" hai.

Task ke liye, hum minimize karte hain:

Yeh form kyun? Quadratic penalty ke aas paas ka second-order Taylor approximation hai:

jahan Hessian hai. Fisher , classification ke liye ke diagonal ko approximate karta hai (mild assumptions ke under). Toh hum keh rahe hain: " ko move karo minimize karne ke liye, lekin ke liye important dimensions mein ke paas raho."

Hyperparameter : Stability-plasticity trade-off control karta hai. Bada → strong penalty → zyada stability, kam plasticity.

par Fisher compute karo: Logistic regression ke liye, jahan .

Maano mein 100 examples hain, average , , :

  • (important!)
  • (kam important)

Yeh kyun matter karta hai? Task 2 seekhte waqt, ko 0.1 se deviate karne par cost aati hai . ko 0.1 se deviate karne par sirf cost aati hai. EWC automatically wahan rigidity focus karta hai jahan zaroori hai.

Task 2 loss with :

2. Replay-Based (Purana Data Store Karo aur Rehearse Karo)

Idea: Purane examples ka ek chota memory buffer rakho aur unhe nayi task training ke saath interleave karo. Yeh directly forgetting rokta hai model ko purani tasks continuously "remind" karke.

Yeh kyun kaam karta hai? Gradients ab replayed data se include karte hain. ko reduce karne ke liye move karna jabki purani losses bhi satisfy karna ek compromise force karta hai—stability.

Key challenge: Memory size. Agar fixed hai (maano 5000 examples), toh hum decide kaise karein ki kaun se examples store karein?

Reservoir Sampling: total examples ki stream ke liye, uniformly select karo. Jab example aata hai:

  • Agar : store karo.
  • Agar : probability se ek random existing example replace karo.

Kyun? Yeh ensure karta hai ki har example ka mein hone ka probability barabar hai, chahe tasks kab bhi aayen.

Generative Replay: Real data store karne ki jagah (privacy issues, memory), purani tasks par ek generative model train karo aur isse "pseudo-examples" sample karo.

Equal allocation: Har task se 200 rakho → 600 total. Task 3 ke liye mini-batch (size 32) sample karte waqt, ~10 task-1 examples, ~10 task-2, ~12 task-3 include karo (buffer size ke proportion mein ya uniform).

Yeh step kyun? Yeh ensure karta hai ki sabhi tasks ko "rehearsal time" milti hai unki representation ke proportion mein. Iske bina, agar hum sirf task 3 sample karte, toh 1 aur 2 bhool jaate.

Alternative: Class-balanced buffer—agar tasks ki alag class distributions hain, toh har class se barabar examples store karo.

3. Architecture-Based (Tasks ko Parameters Dedicate Karo)

Idea: Alag tasks ke liye alag sub-networks ya parameters allocate karo, taaki task 2 seekhna task 1 ke parameters ko bilkul touch na kare.

Kyun? purani tasks ke frozen features hain. unhe reuse karna seekhta hai. Purane parameters kabhi update nahi hote → construction se zero forgetting.

Downside: Model tasks ke saath linearly grow karta hai. 10 tasks → 10× parameters.

PackNet: Har task ke baad network prune karo, us task ke liye winning lottery ticket "freeze" karo. Nayi tasks remaining capacity (pruned weights) use karti hain.

Dynamic Expandable Network: Chota shuru karo, nayi neurons/layers sirf tab add karo jab nayi task ko zyada capacity chahiye. Purani tasks ke liye important neurons freeze karo.

Task 2: Cats classify karo (10 classes). Ek parallel 3-layer CNN column add karo (nayi random init). Dog-column layer 1 se cat-column layer 1 tak lateral connections, wagera.

Yeh kyun help karta hai? Cat column, dogs ke liye seekhe gaye edge detectors aur texture features reuse kar sakta hai ( connections ke through), lekin mein cat-specific features seekhne ki azaadi hai bina dog features destroy kiye.

Task 2 ke baad: Dog accuracy abhi bhi 90% (frozen), cat accuracy 88%. Total params: 2× original.

Task 3: Birds (10 classes). Bird column add karo, dog + cat se connect karo. Ab 3× params, lekin dog abhi bhi 90%, cat 88%, bird 85%.


Common Scenarios & Metrics

  • Class-Incremental Learning (Class-IL): Test time par, task ID unknown hoti hai. Model ko sabhi dekhi gayi classes mein se sahi classify karna padta hai.
    • Example: "Is image ko classify karo (dog, cat, ya bird ho sakta hai, lekin main nahi bataunga kaun sa task)."
    • Mushkil, task-agnostic features aur output heads seekhne padte hain.

Forward Transfer (kya task future task ko help karta hai?):

jahan task par random-init accuracy hai. Positive FWT ka matlab hai ki knowledge ne help ki.

Ideal CL system: High ACC (sabhi tasks mein accha), low Forgetting (purani tasks yaad hain), positive FWT (knowledge transfer).


Key Algorithms Detail

Memory-Aware Synapses (MAS)

EWC jaisa, lekin importance Fisher ke bina compute karta hai. Har parameter ke liye:

Output gradient kyun? Agar badalne se output drastically change hota hai, toh learned function ke liye important hai, loss ki parwah kiye bina.

Task ke liye loss:

Learning without Forgetting (LwF)

CL ke liye knowledge distillation. Task seekhte waqt, purane model ko "teacher" ki tarah use karo:

Yeh step kyun? KL divergence naaye model ko penalize karta hai agar purani tasks ke outputs ke predictions purane model se diverge karein. Hum keh rahe hain: "task ke data par, apni nayi predictions purane task heads ke liye waise hi rakho jaise purana model predict karta."

Koi replay data nahi chahiye, lekin multi-head output zaroori hai (har task ke liye alag heads).

Task 2: 10-class CIFAR-100 (pehli 10 classes). Ek naya output head add karo.

Task 2 data par training:

  1. Naaye ke saath forward pass: aur lo.
  2. Purane ke saath forward pass: lo (frozen).
  3. Loss: .

Yeh kyun matter karta hai? Bhale hi task 2 se ho, KL term task-1 head ko force karta hai ki wahi predictions rakhe jo purana model rakhta tha. Yeh implicitly task-1 knowledge preserve karta hai bina task-1 data dekhe.


Advanced: Gradient Projection Methods

Agar violate ho, toh ko feasible region mein project karo:

Kyun? Yeh ek convex quadratic program hai. Hum ke sabse paas ka gradient dhundh rahe hain jo purani tasks ko hurt na kare (non-negative dot product ka matlab hai loss us direction mein increase nahi hoti).

Intuition: Har task ke gradient ko "is direction mein mat jao" constraint ki tarah socho. GEM sabhi constraints ke intersection mein navigate karta hai.


Mistake 1: "Continual learning aur transfer learning same hai."

Kyun sahi lagta hai: Dono mein multiple tasks seekhna hota hai.

The fix: Transfer learning: source task par train karo, phir target par fine-tune karo. Source data available rehta hai. Continual learning: sequential tasks, purana data discard hota hai, forgetting rokna zaroori hai. Transfer catastrophic forgetting address nahi karta.


Mistake 2: "Bas sabhi purana data replay karo—problem solve."

Kyun sahi lagta hai: Purane examples rehearse karna forgetting rokta hai.

The fix: Real continual learning mein, sabhi data store karna often impossible hai (privacy, memory, streaming). Replay ek chote buffer ke saath compromise hai. Aur bhi, true lifelong learning (millions of tasks) mein bahut bada storage chahiye. Replay ek tool hai, complete solution nahi.


Mistake 3: "EWC ka Fisher matrix Hessian hai, toh yeh exact hai."

Kyun sahi lagta hai: Fisher ko often Hessian approximation kaha jaata hai.

The fix: Fisher, model ki current predictions ke under curvature measure karta hai, Hessian true loss surface ki curvature measure karta hai. Dono sirf correctly specified log-likelihood models ke liye coincide karte hain. Deep nets ke liye, Fisher ek practical approximation hai (diagonal, compute karna aasaan) lekin exact nahi. EWC ki quadratic penalty sirf ke aas paas locally valid hai.


Mistake 4: "Class-IL mein, bas sabhi task outputs ko ek bade softmax mein concatenate karo."

Kyun sahi lagta hai: Unified output natural lagta hai.

The fix: Softmax normalization task recency bias create karta hai: nayi task classes ko zyada probability milti hai kyunki purane task heads frozen ya under-trained hote hain. Cross-entropy balancing, gating ke saath separate task outputs, ya specialized architectures chahiye (jaise NCM classifiers).


Connections

  • Catastrophic Forgetting: Woh core problem jo CL solve karta hai.
  • Transfer Learning: CL, transfer ko multiple sequential tasks tak extend karta hai forgetting prevention ke saath.
  • Meta-Learning: Learning to learn mein overlap; MAML kam forgetting ke saath quickly adapt kar sakta hai.
  • Regularization Techniques: EWC importance se weighted L2 regularization hai.
  • Knowledge Distillation: LwF, purani task knowledge preserve karne ke liye distillation use karta hai.
  • Neural Architecture Search: Dynamic architecture methods (PackNet, DEN) capacity allocation ke liye NAS se relate karte hain.
  • Online Learning: CL, non-stationary distributions ke saath online learning ka ek form hai.
  • Neuroscience - Memory Consolidation: Biological inspiration; complementary learning systems (rapid learning ke liye hippocampus, slow consolidation ke liye cortex).

Recall Kisi 12-Saal-Ke Bachche Ko Samjhao

Socho tumhare paas ek robot hai jo tricks seekhta hai. Pehle, tum use ball fetch karna sikhate ho—woh bahut accha ho jaata hai! Phir tum use roll over karna sikhate ho. Lekin yahan woh ajeeb baat hoti hai: jaise hi woh roll over seekhta hai, fetch karna bhool jaata hai! Yahi catastrophic forgetting hai.

Yeh kyun hota hai? Robot ka brain (uski "weights") knobs ke ek set jaisi hai. Knobs ek taraf ghumana use fetch karata hai. Doosri taraf ghumana use roll over karata hai. Jab tum use roll over train karte ho, tum knobs ghuma dete ho, lekin isse fetch settings kharaab ho jaati hain.

Continual learning is baare mein hai ki robot ko saari tricks yaad rahen. Teen tarike:

  1. Important knobs protect karo (EWC): Hum mark karte hain ki kaun se knobs fetch ke liye super important hain (jaise "ball dekho" knob). Roll-over sikhate waqt hum kehte hain "woh knobs zyada mat ghuma."

  2. Purani tricks practice karo (Replay): Har roz, hum randomly robot se roll-over seekhte waqt kuch baar fetch karate hain. Woh poora nahi bhoolti kyunki rehearsal chalti rehti hai.

  3. Alag controls (Architecture): Robot ko ek "fetch brain" aur ek "roll-over brain" do. Har trick apne khud ke knobs use karti hai, toh woh kabhi interfere nahi karte.

Goal? Ek robot jo 10, 100, 1000 tricks seekh sake aur sabhi yaad rakhe!


EWC vs MAS ke liye: "Fish Eat Food"Fisher Errors/Loss use karta hai, MAS Function (output gradient) use karta hai.


#flashcards/ai-ml

Catastrophic forgetting kya hai? :: Jab ek neural network Task 1 par, phir Task 2 par train hota hai, toh Task 1 par performance lose kar deta hai kyunki Task 1 ke liye optimize parameters Task 2 training ke dauran overwrite ho jaate hain. Standard SGD ko purani tasks ki koi memory nahi hoti.

EWC formula :: , jahan parameter ki purani tasks ke liye Fisher information (importance) hai. Important weights badalne par penalty lagaata hai.

EWC mein Fisher Information kya measure karta hai?
. Yeh parameter ke liye log-likelihood ki sensitivity measure karta hai. High → parameter task ki predictions ke liye important hai. EWC mein quadratic penalty weight karne ke liye use hota hai.
Experience Replay objective
, jahan purane examples ka memory buffer hai. Nayi task training ko purane data ki rehearsal ke saath interleave karta hai forgetting rokne ke liye.
Stability-Plasticity Dilemma
Continual learning mein trade-off: Stability = purani task performance retain karna (forgetting resist karo). Plasticity = nayi tasks ke liye adapt karna (naaye patterns seekho). Standard training plasticity maximize karta hai, stability ignore karta hai. CL methods dono balance karte hain.
Progressive Neural Networks architecture
Har nayi task ke liye, sabhi pichle columns se lateral connections ke saath layers ka naaya column add karo: . Purane columns frozen → zero forgetting. Tasks ke saath linearly grow karta hai.
Backward Transfer (BWT) formula
, jahan task tak training ke baad task par accuracy hai. Negative BWT baad ki tasks seekhne ke baad task ka forgetting indicate karta hai.
Learning without Forgetting (LwF)
. Knowledge distillation use karta hai: naaya model purane model ki predictions purane task heads par match kare. Koi replay data nahi chahiye, lekin multi-head output zaroori hai.
Task-Incremental vs Class-Incremental
Task-IL: test time par task identity jaani hoti hai (aasaan, bas sahi head use karo). Class-IL: task ID unknown, sabhi dekhi gayi classes mein classify karna padta hai (mushkil, task-agnostic features aur output interference handle karna padta hai).
Gradient Episodic Memory (GEM) constraint
sabhi purani tasks ke liye. Nayi task ka gradient project karo taaki memory examples par loss increase na ho. Sabhi constraints respect karte hue sabse paas ka gradient find karne ke liye QP solve karta hai.
Catastrophic forgetting kyun hota hai?
(1) Parameter overlap: wahi weights sabhi tasks ke liye kaam karni padti hain. Task 2 ke updates task 1 ke liye optimize configuration disturb karte hain. (2) No explicit memory: task 2 data par SGD ko task 1 data ka koi signal nahi milta. Gradients sirf current loss minimize karte hain, past losses ignore karte hain.
Memory-Aware Synapses (MAS) importance
. Measure karta hai ki badalne par output kitna change hota hai. Output gradient magnitude use karta hai, Fisher nahi (labels nahi chahiye). Zyada → learned function ke liye zyada important.
Average Forgetting metric
. Purani tasks par final accuracy ko baad ki tasks seekhne se pehle ki peak accuracy se compare karta hai. Worst-case forgetting quantify karta hai.
Class-IL, Task-IL se mushkil kyun hai?
Task-IL task ID provide karta hai → model sahi head/subnet use karta hai. Class-IL mein sabhi classes par single unified output chahiye, jo inter-task interference create karta hai (softmax competition, task recency bias, sirf data se task boundaries distinguish karne padte hain). Test time par task oracle nahi hota.

Concept Map

learns from

must balance

requires

requires

synonym emphasizing

interchangeable with

optimize only

overwrites weights

caused by

caused by

violates

measured by

negative means

Continual Learning

Stream of Tasks T1..Tt

Stability-Plasticity Dilemma

Plasticity: adapt to new task

Stability: retain old tasks

Lifelong Learning

Forward and Backward Transfer

Standard SGD Updates

Current Task Loss Lt

Catastrophic Forgetting

Parameter Overlap

No Explicit Memory

Backward Transfer BWT