Ranking that learns from clicks, and keeps its rules
Your search ranking is a formula someone guessed. Let the clicks fix the numbers, without letting them touch the rules.
1 A ranking formula someone guessed
Every search box has one: a few weights, picked by gut, plus two business rules that must never break. Here it is, running as an exact Handwired net.
your ranking code runs as a Handwired net
- pinned result on top
- out-of-stock in top 10
- shoppers' favourite in top 3
results for “wireless headphones” · or click one yourself
2 Predict
3 Let shoppers vote, then let the code learn
Simulate 1,000 shoppers, or click results yourself. Then watch the four weights in the code above move while the list re-sorts. The rules never move.
4 The foil: a generic model on the same clicks
The usual move is to train a small neural net on the click log. Same clicks, same optimizer, same loss.
- test lists where the pinned result is not on top
- test lists with out-of-stock in the top 10
- favourite in top 3
- what you can read in it
5 The diff you’d actually review
Learn first (step 3) to see the diff.
Reach for Handwired when you already have a formula people understand, rules that must hold exactly, and data that should tune the numbers, not replace the code.
Shoppers are simulated with a hidden taste (2·match + 1·pop + 4·fresh + 3·rating, hidden from both models), attention that fades with position (1 / (1 + 0.35 × position)), and less interest in out-of-stock items. Rates are measured live on seeded test lists of 20 results each. The generic model is a 6→8→1 ReLU net, also trained with Adam, in a Web Worker so the page stays responsive. Both train on the clicks of non-pinned, in-stock results, since the rules decide the others.