Use Hashed Feature Crosses for Sponsored Products Click Prediction

Last updated: November 29, 2026

Quick Overview

A click-through model for Sponsored Products ads must use crosses of query category, ad brand, placement and device, producing billions of possible feature combinations. Explain the hashing trick, its collision trade-offs, and implement signed hashing for raw and crossed features.

Amazon
Machine Learning
Machine Learning Engineer
Amazon
November 29, 2026
Machine Learning Engineer
Onsite
Machine Learning
Hard

0

0

0 solved


A click-through model for Sponsored Products ads must use crosses of query category, ad brand, placement and device, producing billions of possible feature combinations. Explain the hashing trick, its collision trade-offs, and implement signed hashing for raw and crossed features.

Amazon Ads runs very large sparse models where explicit vocabularies are impractical. The interviewer checks whether a senior candidate understands hashing, collisions, crosses versus learned interactions, and the memory and freshness trade-offs.

What the Interviewer Expects
  • Explains why explicit vocabularies for crosses are infeasible
  • Describes hashing into a fixed number of buckets with signed hashing
  • Quantifies collision rates and their effect on accuracy
  • Chooses which crosses to include based on domain knowledge
  • Compares hashed crosses with factorization machines or deep cross networks
Key Topics to Cover
hashing trick
feature crosses
sparse logistic regression
collisions
factorization machines
How to Approach This
  1. Understand the bias-variance trade-off. High training accuracy but low test accuracy signals overfitting.
  2. Choose evaluation metrics carefully based on the problem. Accuracy alone is often insufficient.
  3. Feature engineering is often more impactful than model selection.
  4. Know when to use tree-based models (tabular data) vs neural networks (unstructured data).
  5. Handle class imbalance with SMOTE, class weights, or appropriate loss functions.
Possible Follow-up Questions
  • How do you choose the number of buckets?
  • What happens to a hashed model when a new brand launches?
  • How would you debug which feature a learned weight belongs to?
  • Why not let a deep network learn all interactions?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Explore ML Interview Prep
Sample Answer
Clarify

Ask the model family (sparse logistic regression or a wide and deep network), the memory budget per model replica, how often new values appear (new brands and ASINs daily), and whether interpretabilit...

Approach

Instead of a dictionary from feature string to index, compute h("field=value") mod Bh(\text{"field=value"}) \bmod B and use that bucket. Crosses are hashed from the concatenated string, so the model stores weights for $B...


Submit Your Answer
Markdown supported