KatInterview

Detect and Fix Feature Leakage in a Loan Default Model

Machine LearningModel answer
MediumModel answerMachine Learningmachine learningfeature leakagecredit risk

Last updated

Identify subtle forms of target leakage in a credit risk pipeline and explain how to fix each without destroying predictive signal.

Scenario

You join a fintech team that built a gradient-boosted model to predict whether a loan applicant will default within 90 days of origination. The model achieved an impressive AUC of 0.97 on the held-out test set, but after six weeks in production its AUC dropped to 0.61.

The feature set includes (among others):

FeatureDescription
credit_score_at_pullBureau score at time of application
months_since_last_delinquencyMonths since the applicant's most recent missed payment
loan_status_30dWhether the loan was 30 days past due at any point in the first month
debt_settled_flag1 if the applicant settled a prior debt during the loan term
account_age_monthsAge of the oldest open account at application time
payment_plan_enrolled1 if the borrower enrolled in a hardship payment plan
income_verified1 if income was verified before origination

The target variable is default_90d: 1 if the loan defaulted within 90 days of origination.

What is expected

  1. Identify which features are leaking the target and explain why each one leaks.
  2. Classify each leak as direct (the feature encodes or nearly encodes the target) or indirect (the feature is a downstream consequence of the target event).
  3. Describe a concrete strategy to fix or handle each leaky feature.
  4. Explain why the model looked great offline but failed in production.
  5. Discuss how you would design the training pipeline going forward to prevent leakage systematically.

Hints

Hint 1

Ask yourself: could this feature's value be known at the moment the model makes a prediction? If not, it leaks.

Hint 2

Think about the timeline: origination date → 30-day mark → 90-day default event. Which features can only be computed after that timeline has played out?

Hint 3

A near-perfect offline AUC that collapses in production is a classic leakage signature — think about what changes between the offline dataset construction and real-time scoring.