A feature is computed at request time. What's the catch?
Some features come from the request itself: the device, the member's local hour, the row being filled. Others come from a quick computation over data already fetched, like the cosine similarity between each candidate's embedding and the titles the member browsed a minute ago. Nothing is stored, so nothing is stale.
You pay in latency and CPU on every request, times the candidate count. Netflix's Ranker service powers the personalized rows on the Netflix homepage (1 source). One of its features, serendipity scoring, measures how different a new title is from what the member has watched so far. Netflix wrote that this single feature used about 7.5% of total CPU on each node running the service.
The other cost shows up offline. A request-time feature exists for training only if you logged its inputs or its value. If nobody logged which titles the member browsed, you can't recompute last month's similarity scores.
In the editor, write stage_ms(candidates, per_candidate_us, per_member_us): the request-time stage's cost in milliseconds. The last lines price 500 candidates at 20 microseconds each, without and then with a 2 ms member-only part.
Pick an answer above to see the rest
Instructions
1
Write stage_ms(candidates, per_candidate_us, per_member_us=0): the stage in milliseconds. The per-candidate part runs for every candidate, and the member-only part runs once.