Company Interview Questions · Product & Retail Tech

Flipkart: Data Scientist 2, 6 Rounds (Offer)

❓ 8 questions🏢 Flipkart🆕 Recent reports

Flipkart: Data Scientist 2 Interview Experience (6 Rounds, Offer). Rounds, real reported questions and model answers, compiled from public candidate reports (sources at the end). Practice mode hides every answer: say your answer first, press Show answer, then rate yourself. Use 🔁 Review again to build your revision list and 🎲 Random question for a quick drill.

About this interview

Compiled from a public candidate report for Flipkart Data Scientist 2 (Grade 9), an off-campus referral that ended in an offer. Rounds covered maths modelling, multimodal models (CLIP/BLIP), credit-risk ML design, a 2-hour coding round, and GenAI fine-tuning with DPO/PPO. The questions are paraphrased, and the model answers are written by EasyLearnSpace.

Role Data Scientist 2 (Foundational Models team; Cleartrip team for the second HM round)
Rounds 6: screening (30 min) → depth in maths modelling (1 h) → depth in DS / ML design (1 h) → coding (2 h) → HM, Foundational Models (1 h) → HM, Cleartrip (1 h)
Style Repeated "why this, why not that" probing; coding with internet access limited to documentation
Outcome Offer

01Rounds at a glance

02Questions and model answers

Q1
Derive the logistic regression loss from first principles.
  • Model y ∈ {0,1} as Bernoulli with p = σ(wᵀx) = 1 / (1 + e^(−wᵀx)).
  • Likelihood: L = ∏ pᵢ^yᵢ (1 − pᵢ)^(1 − yᵢ). Taking the negative log gives the binary cross-entropy: −Σ [yᵢ log pᵢ + (1 − yᵢ) log(1 − pᵢ)].
  • Gradient: ∂/∂w = Σ (pᵢ − yᵢ) xᵢ. The loss is convex, so there is a unique optimum, found by gradient descent or Newton/IRLS.
  • L2 regularisation = a Gaussian prior on w (MAP estimate): add λ‖w‖².
  • Bayes link: the log-odds of the posterior, log P(y=1|x)/P(y=0|x), is linear in x when the class-conditional distributions are Gaussian with shared covariance (or from the exponential family).
Q2
How does CLIP work? What is the contrastive loss, and what does BLIP's Q-Former add?
  • CLIP: an image encoder (ViT) and a text encoder map into a shared embedding space.
  • For a batch of N pairs (say 32), compute the N×N cosine-similarity matrix scaled by a learned temperature.
  • The InfoNCE loss treats the diagonal as positives and the other N − 1 entries as negatives, symmetric over image→text and text→image.
  • A bigger batch means more negatives, which gives better representations.
  • Weaknesses:
  • Bag-of-words behaviour: weak on compositional understanding (word order, counting, relations).
  • Biases inherited from web data.
  • BLIP-2 Q-Former: a small Transformer with learned query tokens that cross-attend to a frozen image encoder. It extracts a fixed number of visual tokens that are fed to a frozen LLM, bridging vision and language cheaply.
  • Hard negatives (similar but wrong captions) improve fine-grained discrimination.
Q3
ROC-AUC vs PR-AUC: when do you use each? What is calibration?
  • ROC-AUC: the probability that a random positive ranks above a random negative. It is insensitive to class balance, so it can look great under heavy imbalance.
  • PR-AUC: focuses on the positive class (precision vs recall). Prefer it for fraud, credit default and other rare events.
  • Calibration: predicted probabilities should match observed frequencies (of loans scored 0.2, about 20% should default). Check with reliability curves or the Brier score; fix with Platt scaling or isotonic regression.
  • It matters for pricing, credit limits and expected loss, where the probability value itself is used, not just the ranking.
Q4
What is catastrophic forgetting and how do you avoid it when fine-tuning?
  • What it is: fine-tuning on a new task overwrites the general abilities the model had (for example, after domain fine-tuning the LLM loses general reasoning or safety).
  • Mitigations:
  • PEFT (LoRA): the base weights stay frozen.
  • Lower learning rate and fewer epochs.
  • Replay: mix in 5–20% general or original data.
  • Regularisation towards the original weights (EWC, or a KL penalty).
  • Model merging.
  • Always evaluate on general benchmarks as well as the target task, before and after.
Q5
Design a credit-risk model to approve users for a new EMI feature with no history and no bank data (cold start).
  • Target and constraints: P(default or 90+ DPD within 6–12 months). Regulatory explainability and fairness apply.
  • Signals available without bank data (with consent and policy):
  • Platform behaviour: account age, order frequency, return and cancellation rates, payment-method history (COD vs prepaid), address stability.
  • Device and KYC signals.
  • Bureau score, if permitted.
  • Cold-start strategy: 1. Start with rules + a conservative limit for a test cohort. 2. Use proxy labels from related products (pay-later or COD-refusal behaviour). 3. Transfer a model from a similar portfolio. 4. Grow limits gradually as repayment data arrives (explore/exploit).
  • Model: a gradient-boosted tree with monotonic constraints, plus a scorecard for explainability (SHAP or reason codes); calibrated probability → expected-loss-based limit.
  • Evaluation: a time-split, out-of-time test; KS and AUC; reject inference for unapproved applicants; fairness checks; monitoring of vintage curves.
  • Why not X? Deep models are hard to explain to regulators, and pure rules leave money on the table. Be ready to defend every choice.
Q6
Coding (2 h): build an end-to-end fraud detection pipeline. What would a clean solution look like?
import pandas as pd, numpy as np
from sklearn.model_selection import train_test_split
from sklearn.compose import ColumnTransformer
from sklearn.preprocessing import OneHotEncoder, StandardScaler
from sklearn.pipeline import Pipeline
from sklearn.metrics import average_precision_score, classification_report
from sklearn.ensemble import HistGradientBoostingClassifier

df = pd.read_csv("transactions.csv", parse_dates=["ts"]).sort_values("ts")
df["hour"] = df.ts.dt.hour
df["amt_log"] = np.log1p(df.amount)
df["user_txn_24h"] = (df.groupby("user_id").rolling("24h", on="ts").amount.count()
                        .reset_index(level=0, drop=True).values)
num, cat = ["amt_log", "hour", "user_txn_24h"], ["merchant_cat", "device_type"]
cut = int(len(df) * 0.8)                       # time-based split, no leakage
tr, te = df.iloc[:cut], df.iloc[cut:]
pre = ColumnTransformer([("n", StandardScaler(), num),
                         ("c", OneHotEncoder(handle_unknown="ignore"), cat)])
model = Pipeline([("pre", pre), ("clf", HistGradientBoostingClassifier(class_weight="balanced"))])
model.fit(tr[num + cat], tr.is_fraud)
p = model.predict_proba(te[num + cat])[:, 1]
print("PR-AUC", average_precision_score(te.is_fraud, p))
  • Talk through: a time-based split, velocity features, class imbalance, choosing the threshold on cost, and a predict(txn) function for inference. Code quality (functions, naming, comments) was explicitly assessed.
Q7
Compare PPO-based RLHF and DPO for aligning an LLM or VLM.
  • PPO (RLHF): train a reward model on preferences, then do on-policy RL with a clipped objective and a KL penalty to the reference model.
  • Powerful, but complex: 4 models in memory (policy, reference, reward, value), unstable, and expensive.
  • DPO: a closed-form re-parametrisation. Optimise the log-ratio of chosen vs rejected responses relative to the reference model, directly with a cross-entropy-style loss.
  • No reward model, no sampling loop, and stable.
  • Choose:
  • DPO (or ORPO, KTO) for most preference tuning on fixed datasets.
  • PPO or GRPO when you have a live reward signal (verifiable maths or code, or a learned reward) and want online exploration.
Q8
Case: set discounts across several shoe brands, given competitors, to maximise revenue.
  • Model demand per product: q = f(own price, competitor price, brand, seasonality, inventory, traffic). Estimate price elasticity, ideally with past experiments or with instruments or DML to handle the fact that prices are endogenous.
  • Optimise: maximise Σ (price × q(price)), or margin, subject to inventory, brand MAP rules, minimum margin and cannibalisation between brands (cross-elasticities).
  • Solve: a price grid plus constrained optimisation (or a contextual bandit for online learning).
  • Test: A/B or switchback experiments by region and time; guardrails on margin and returns.
  • Always ask: "revenue or profit?" Revenue-only optimisation can destroy margin.

03How to prepare for Flipkart DS

Sources

Created by Ajeetkumar