← all posts
project6 min·September 13, 2026

When your cross-validation lies to you

a Flipkart Gridlock story about a 96% out-of-fold score that dropped to 88% on the leaderboard

My out-of-fold score said 96%. The leaderboard said 88%. Both were right, and the gap between them taught me more than any single model did.

the task

Flipkart's Gridlock track asks you to predict normalised traffic demand for each geohash, timestamp, and day. The score is R squared times 100. Training had two days of data; the test set was one specific day and a narrow band of hours that the training labels barely covered.

the trap

I chased the out-of-fold number. I added a geohash-by-time-slot target encoding, dropped the feature fraction to 0.12 so the trees stayed diverse, and watched OOF climb into the mid 90s. Then I submitted, and the leaderboard went the wrong way, from 89.57 down to 88.18.

why it happened

  1. A feature fraction of 0.12 means each tree sees about four features, so the model quietly memorised the cross-validation split instead of learning the signal.
  2. The target encoding was a shortcut. Training stopped after 280 iterations because it had already 'solved' the OOF, so it never learned the general pattern that needed 2,600+ iterations to emerge.
  3. The test day only existed in training for its first three hours, so any feature built from those hours simply did not transfer to the later hours I actually had to predict.

the fix

I deleted the clever encoding, put the feature fraction back to 1.0, and let the model run with proper early stopping. The original features reached 96% OOF in about 4,000 iterations, which meant the earlier model had simply been underfit. Then I added the one thing that actually targeted the test distribution: a projection that carried the test day's early-morning signal onto its later hours, followed by two rounds of pseudo-labelling.

# stop chasing OOF, target the test distribution instead
params = dict(
    n_estimators=12000, learning_rate=0.02, num_leaves=70,
    feature_fraction=1.0,          # NOT 0.12, which memorised the split
    bagging_fraction=0.8, bagging_freq=5,
)
# project the day's early-hours signal onto its later hours,
# then add the test rows as pseudo-labels and retrain (2 rounds)

what i keep from this

  • OOF is only a proxy when the folds look like the test set. Mine did not, so it lied.
  • Any single change that makes validation jump while the leaderboard drops is a leak, not a win.
  • Change one thing, submit, write down the number. Boring beats clever.
The model was never the problem. The gap between my validation and the real test was, and no amount of tuning closes a gap you refuse to look at.