Offline evaluation খুব important।

কিন্তু offline dataset production environment-এর full reality capture করতে পারে না।

Real users, feedback loops, latency, changing behavior এবং business interaction production-এ আলাদা হতে পারে।

তাই important models-এর জন্য online evaluation দরকার।

Offline vs Online Evaluation

Offline evaluation:

Historical Data
↓
Predictions
↓
Compare with Ground Truth

Online evaluation:

Real Production Traffic
↓
Model Behavior
↓
Measure User / Business Impact

A/B Testing

A/B Test-এ users বা requests randomভাবে different groups-এ assign করা হয়।

উদাহরণ:

Control Group
→ Old Model

Treatment Group
→ New Model

তারপর relevant business metrics compare করা হয়।

Example

Recommendation model test করছি।

Control:

Current Recommendation Model

Treatment:

New Recommendation Model

Metrics:

CTR
Add-to-Cart Rate
Conversion
Revenue
Retention

তারপর দেখি new model actual user behavior improve করছে কি না।

Randomization কেন Important?

যদি high-value users শুধু treatment group-এ দিয়ে দিই, তাহলে comparison biased হবে।

Randomization চেষ্টা করে groups-কে comparable রাখতে।

Traffic
↓
Random Assignment
↓
Control / Treatment

Guardrail Metrics

Primary KPI improve করলেই deployment safe নয়।

ধরুন new recommendation system:

CTR ↑

কিন্তু:

Cancellation ↑
Latency ↑
Customer Complaints ↑

তাহলে problem থাকতে পারে।

তাই primary metric-এর পাশাপাশি guardrail metrics রাখা হয়।

Shadow Testing

Shadow deployment-এ new model real production requests receive করে এবং prediction দেয়।

কিন্তু তার output user-facing decision হিসেবে ব্যবহার করা হয় না।

Flow:

Real Request
   ↓
──────────────
↓            ↓
Old Model   New Model
Serve       Shadow Only
User

কেন Useful?

New model-এর:

Latency
Errors
Prediction Distribution
Feature Availability
Infrastructure Behavior

real traffic-এ test করা যায়, user impact ছাড়া।

Limitation

Shadow testing model-এর direct user/business impact measure করতে পারে না।

কারণ:

New Model Output
→ User দেখছে না

তাই recommendation conversion-এর মতো metric shadow mode-এ directly measure করা যায় না।

Canary Deployment

Canary deployment-এ new model actual users-কে serve করে, কিন্তু initially ছোট traffic percentage-এ।

উদাহরণ:

Stage 1 → 1%
Stage 2 → 5%
Stage 3 → 20%
Stage 4 → 50%
Stage 5 → 100%

প্রতিটি stage-এ system health check করা হয়।

কেন Useful?

Problem হলে blast radius ছোট থাকে।

যেমন:

Error Rate ↑
Latency ↑
Business KPI ↓

হলে rollout stop বা rollback করা যায়।

A/B Test vs Shadow vs Canary

A/B Test
→ Business impact compare

Shadow
→ Safe technical comparison

Canary
→ Gradual real rollout

একটি Practical Sequence

High-risk model-এর ক্ষেত্রে flow হতে পারে:

Offline Evaluation
      ↓
Shadow Testing
      ↓
Canary Deployment
      ↓
A/B Testing / Controlled Experiment
      ↓
Full Rollout

সব project-এ exact same sequence দরকার হয় না।

Risk অনুযায়ী choose করতে হয়।

Interview-ready Explanation

Offline evaluation is necessary but may not fully represent
production behavior.

A/B testing compares an old and new model on randomized
real users to measure business impact.

Shadow testing sends real requests to a new model without
using its outputs for user-facing decisions, making it
useful for validating latency, failures, and prediction
behavior safely.

Canary deployment exposes a small percentage of real traffic
to the new model and gradually increases the traffic if
system and business metrics remain healthy.