Lesson 130 — Advanced

Portability, Lock-in & Migration

Platform adopt karna aasaan hai, usmein phansa rehna mushkil. Is lesson mein hum kya portable hai kya nahi, abstraction layer kaise lagate hain, lock-in ki asli cost kya hai, aur migration ko kaise ek evaluation exercise mein badalte hain — catalog lag, deprecation aur parallel running ke saath.

⏱ 20 min• Advanced• Managed Building Blocks: Build or Buy

Portability kya hai aur kyun matter karti hai

Kya hai?

Portability matlab tumhara workload doosre platform/provider par bina rewrite ke chal jaaye. Iska ulta lock-in — jahan coupling itni hai ki badalne ka kharcha bolne se zyada hai.

Kab kaam aata hai?

Naya adopt karte waqt (sabse sasti jagah), vendor negotiation ke waqt, aur jab platform apne catalog se model retire kare. Portability baad mein sochna kabhi bhi sasta nahi hota.

Kahan milta hai?

Tumhare wrapper layer mein, eval suite mein, deployment configs mein aur architecture decision records mein. Portability code mein likhi jaati hai, slide mein nahi.

Funda: portability koi cheez nahi, ek property hai — har layer ki. Prompts hamesha portable lagte hain, par managed knowledge base, agent graph aur platform-specific APIs nahi. Ye farq pehle likh lo, migration ke waqt nahi.

Timing rule: Abstraction aur evals adoption ke din se banao — pehle 6 mahine seedha SDK use karo, phir portability chaho toh wrapper aur re-test sab refactor hai. Migration cost har mahine badhti hai jo tum delay karte ho.

Kya travel karta hai, kya nahi

portable (zyada tar):
  prompts + system instructions -> text hai, copy-paste
  eval suites + golden datasets  -> tumhara data hai
  application code (agar wrapper)
  business logic + filters

NOT portable (ya mehnga):
  platform SDK calls (direct)    -> request format alag
  managed indexes / knowledge bases -> re-ingest + re-tune
  agent definitions / workflows  -> platform-specific graph
  guardrail configurations       -> rule syntax alag
  identity + network setup (IaC) -> cloud-specific code
Inventory pehle: Apne system ki har dependency ki list banao: portable, partial, nahi. Ye teen-column table hi tumhara migration risk assessment hai — bina iske "hum badal lenge" sirf wish hai.

Abstraction layer — wrapper jo provider ko chhupaye

# Tumhara client wrapper — app isko hi bulata hai
class ModelClient:
    def __init__(self, cfg):
        self.provider = cfg["provider"]   # "platform-a" | "platform-b"
        self.model = cfg["model"]

    def complete(self, messages, **params):
        if self.provider == "platform-a":
            return self._via_platform_a(messages, params)
        return self._via_platform_b(messages, params)

# app code: client.complete(msgs)   <- kabhi SDK seedha nahi
# provider swap = config change, rewrite nahi
Smell test: Agar app files mein provider ka naam har jagah dikhe (imports, request builders, response parsers) toh abstraction nahi, coupling hai. Provider naam sirf config file mein dikhna chahiye.

Lock-in ki asli cost — sirf price nahi

Log lock-in ko sirf "mehnga renewal" samajhte hain. Asli costs chaar alag hain — aur negotiate karte waqt bhi yahi chaar matter karte hain:

Cost formula: Lock-in cost = exit ka engineering time + duplicated eval/security review + quality drop during move + lost negotiating leverage. Ye numbers year-end bill se aksar zyada hote hain.

Migration = evaluation exercise

# Migration ka eval-first flow
baseline = run_eval_suite(golden_set, current_platform)   # BEFORE

new_client = ModelClient(cfg_new)
candidate = run_eval_suite(golden_set, new_client)         # DURING

compare(baseline, candidate)  # category-wise, sirf average nahi
# threshold pass? -> shadow traffic -> cutover

after = run_eval_suite(golden_set, live_platform)          # AFTER
# rollback plan cutover se pehle likha hua — baad mein nahi
Interview line: Q: "Platform migration kaise karoge?" A: "Eval suite se baseline, candidate pe same suite, category-wise compare, shadow traffic, phir cutover with rollback." — ye paanch steps ka answer bahut kam candidates dete hain.

Catalog lag aur platform-side deprecation

deprecation handling ka pattern:
  1. versions pin karo (explicit id, kabhi "latest" nahi)
  2. notice channels ke liye owner assign
  3. upcoming retirement -> eval set pe naya version chalao
  4. quality drop dikha -> prompt/tuning fix, warna fallback model
  5. cut date se pehle cutover + rollback plan ready

catalog lag ka rule: region + availability pehle check,
model selection uske baad — ulta mat karo
Chhota habit: Har quarter ek baar apna model inventory nikaalo: kaunse versions pin hain, unka lifecycle status kya hai, retirement notices kuch pending hain nahi. 30 minute ka kaam, emergency migration se sasta.

Do platforms parallel mein — aur multi-cloud ka honest hisaab

# Parallel running: gateway se route karo
routes:
  - match: { region: "required-region" }
    target: platform-a
  - match: { capability: "long-context" }
    target: platform-b
  - default: platform-a
    failover: platform-b
# do platforms = do eval runs, do security reviews, do teams ka knowledge
Scale rule: Chhote scale pe: ek platform + abstraction + evals — wahi enough resilience hai. Bade scale pe: parallel platforms socho. Fark capacity aur blast radius se decide hota hai, fashion se nahi.

Exercise

Question: Migration ka sabse pehle portable hone wala golden asset kya hai — prompts ya eval suite?

Question: App code aur provider ke beech jo chhoti layer banate hain taaki model swap config change rahe, uska common naam? (wrapper / parser)

Question: Model id ko pin karne ke bajaye kis auto-word pe chalna sabse khatarnak hai?

Question: Cutover se pehle real traffic ka copy naye platform pe chalane ko kya kehte hain?

Common mistakes

Desi example: Flat shift — built-in vs portable saman

Flat chhodna hai: jo saman suitcase mein hai wo utha ke chalo, jo built-in carpentry hai wo chhodna padega, aur landlord ka notice date fix hai. Shift se pehle inventory list banao — wahi tumhara portability assessment hai:

text
flat (platform) ka saman:
  suitcase  -> prompts, evals, app code (portable)
  built-in  -> managed KB, agent graph (chhodna padega)
  notice date -> deprecation timeline (fix hai)
rule: inventory pehle, packing baad mein, nahi toh regret
Interview angle — yahan se sawaal aate hain
  • Q: Kya portable hai, kya nahi? — Prompts, evals, app code portable; managed indexes, agent graphs, platform-specific APIs aur IaC nahi/ya mehnga.
  • Q: Abstraction layer kaisi honi chahiye? — Thin wrapper, ek request format, provider sirf config mein; provider-specific features uske andar force nahi karne.
  • Q: Migration ko kaise plan karoge? — Eval-first: baseline before, same suite during, category-wise compare, shadow traffic, phir cutover with rollback.
  • Q: Lock-in ki sirf price nahi, char costs? — Model availability, feature pace, negotiating position, aur naye platform ko prove karne ka kaam.
  • Q: Multi-cloud ka honest trade-off? — Resilience aur leverage milti hai; duplicated eval, security review aur operational knowledge kharchi hoti hai.
Lesson complete?

Portability clear — ab tum adopt karke bhi trapped nahi honge aur migration ko eval exercise bana sakte ho. Agla lesson — Capstone: Deploy on a Managed Platform — mein L11 ke saare lessons jod kar ek workload end-to-end deploy karenge.

Popular courses: Data Science Course in Lucknow · AI Course in Lucknow · Python Course in Lucknow · Power BI Course · Data Analytics Course