Case Study
Logistic Regression Beat the Neural Ranker for Four Months
The deep model won every offline benchmark and lost in production for a third of a year. A post-mortem on why the old approach kept winning, and what finally changed.
The gradient-boosted and neural rankers I built were, by every offline measure, better than the logistic regression they were supposed to replace. Higher AUC, better NDCG, better calibration on the holdout. It was not close.
In production, the logistic regression kept winning. For four months.
This is a write-up of why, because the reasons turned out to be almost entirely unrelated to modelling, and because "the simple model keeps beating the clever one" is a situation a lot of people find themselves in and quietly stop talking about.
#The setup
The task was ranking products for a storefront. Features were the usual mix: user-side aggregates, item-side aggregates, and interaction terms, category affinity, price-band affinity, recency of last interaction with the category.
The baseline was a logistic regression on about forty hand-built features, trained weekly. Entirely unglamorous. The challenger was a two-tower neural model with learned embeddings for user and item, trained on the same window.
Offline, the challenger was clearly ahead. Online, over four separate A/B tests, it either lost or tied on the metric that mattered.
#Reason one: the features were doing the work
The forty hand-built features encoded a lot of accumulated knowledge about the domain. "Days since last purchase in this category" is not a sophisticated feature, but it carries real causal structure: somebody who bought a winter coat three weeks ago does not want another winter coat.
The neural model was given raw IDs and expected to learn that structure from interaction data. With a few hundred thousand interactions, it could not. It learned a blurry approximation of what I had handed the baseline for free.
This is the unglamorous reality of mid-scale data. Representation learning needs volume to beat feature engineering, and the threshold is higher than the papers suggest, because the papers are usually written on datasets two or three orders of magnitude larger than the one in front of you.
#Reason two: the offline metric was measuring the wrong population
Covered this in more detail elsewhere, but it applies here too. The offline set was dominated by users with deep histories. The neural model was much better on them. The logistic regression was slightly worse on them and noticeably better on thin-history users, because its hand-built features degraded gracefully when inputs were missing while the learned embeddings fell back to a near-random initialisation.
Production traffic was mostly thin-history users. Offline evaluation was mostly deep-history users. The two models were being ranked on different populations and I was comparing the numbers as though they were comparable.
#Reason three: latency changed the product
The neural model added about 70 ms to the ranking call. On paper, nothing. In practice it pushed the carousel's render past the point where a meaningful fraction of mobile users had already scrolled past it.
A better ranking that arrives after the user has moved on is a worse ranking. This is obvious when stated and very easy to miss when your evaluation harness has no concept of time.
#Reason four: nobody could debug it
This is the one I underrated most, and the one with the longest tail.
When the logistic regression did something strange, I could read the coefficients and find out why in about ten minutes. When the neural model did something strange, the honest answer was "I don't know, let me retrain it and see if it stops."
Over four months that difference compounded. The baseline got five or six small, targeted fixes, each one driven by someone looking at a bad result and tracing it to a specific feature. The challenger got retrained. The baseline was improving continuously; the challenger was improving in discrete, unreliable jumps.
A model you can debug improves every week. A model you can only retrain improves whenever you happen to get lucky.
#What eventually made the neural model win
Three changes, none of them architectural.
It stopped starting from scratch. Instead of learning embeddings from interaction data alone, item embeddings were initialised from content, title, category, attributes, description, and fine-tuned. This handles new and rare items immediately, which was most of the catalogue's tail and most of where the baseline had been winning.
It got the hand-built features too. The two-tower model was treated as a representation learner feeding into a layer that also received the same forty features the baseline used. Not an elegant architecture. It let the model use engineered causal structure where it existed and learn the rest, instead of re-deriving everything from nothing.
Evaluation was rebuilt around traffic, not around the dataset. Offline metrics were reported per history-depth bucket and weighted by actual production traffic mix. The moment that happened, the offline numbers started agreeing with the online results, which is the real test of an evaluation harness. If your offline metric does not predict your online metric, the problem is the metric.
After those three changes the neural model won, and the margin has grown since, because the embedding quality improves as data accumulates while the hand-built features are roughly fixed.
#The cost that was never in the comparison
There is a column missing from almost every model comparison table, and it is the one that decides whether a model survives its first year.
The logistic regression trained in minutes on a single machine, served from a handful of coefficients, and could be retrained by anyone who could run one script. If it broke at 2 am, the fix was a config change.
The neural model needed GPU time to train, a model registry, a serving container with its own scaling behaviour, a feature pipeline that had to agree exactly with training, and version compatibility between the training and serving runtimes. Each of those is reasonable on its own. Together they are a system, and that system has an availability number, an operating cost and a set of ways to fail at 2 am.
I did not count any of that when I decided the neural model was better. I compared AUC.
The honest comparison has at least four columns:
| Logistic regression | Neural ranker | |
|---|---|---|
| Offline AUC | Lower | Higher |
| Time to retrain | Minutes | Hours |
| Time to debug a bad result | ~10 minutes | Unbounded |
| Components that can fail | 2 | 7 |
Looked at that way, the baseline was not losing on three of four dimensions. It was winning on three of four, and the fourth was a number measured on the wrong population.
This is not an argument for never shipping the complex thing. It is an argument for knowing what you are paying. The neural model is worth its operational weight now, because the data volume grew into it and because the tooling got built. It was not worth it at the point I first tried to ship it, and the comparison table I was using could not have told me that.
The question is not "which model scores higher". It is "which model will still be getting better in six months, given who has to maintain it".
#What I take from it
Not "simple models are better". That is the lazy reading and it is wrong, the complex model did eventually win, and it keeps getting better in a way the baseline cannot.
The actual lessons are narrower:
- A new model has to beat the old one on the production traffic mix, not on a convenient sample. Weight your offline evaluation accordingly or your offline evaluation is theatre.
- Latency is part of model quality. Measure the end-to-end experience, not the forward pass.
- Debuggability is a compounding advantage. Build the interpretability tooling for the complex model before you ship it, not after it has confused you three times.
- Hand-built features are accumulated domain knowledge. Do not throw them away in the name of end-to-end learning until you have the data volume to replace them.
The four months were not wasted, but about three of them were spent believing a number that was never measuring what I thought it was.