Encoding Millions of Advertiser Page IDs for a Conversion Model

Last updated: November 29, 2026

Quick Overview

An ads conversion model needs to use the advertiser's Page ID, which has tens of millions of distinct values with a long tail. Compare one-hot encoding, the hashing trick, target encoding and learned embeddings, and recommend an approach.

Meta
Machine Learning
Machine Learning Engineer
Meta
November 29, 2026
Machine Learning Engineer
Onsite
Machine Learning
Medium

0

0

0 solved


An ads conversion model needs to use the advertiser's Page ID, which has tens of millions of distinct values with a long tail. Compare one-hot encoding, the hashing trick, target encoding and learned embeddings, and recommend an approach.

High-cardinality categorical features are everywhere in Meta ads and recommendations: Page IDs, ad IDs, user IDs. The interviewer is checking whether you understand memory, collisions, leakage and cold start for each encoding.

What the Interviewer Expects
  • Explain the memory and sparsity cost of one-hot at this scale
  • Describe hashing and the effect of collisions
  • Explain target encoding and its leakage risk
  • Describe learned embeddings and how to handle rare IDs
  • Recommend a combination with cold-start fallbacks
Key Topics to Cover
High-cardinality features
Hashing trick
Target encoding
Embeddings
Cold start
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 hash space size?
  • How would you handle a Page created yesterday?
  • Why might frequency thresholds help embeddings generalize?
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

I would ask the model family (deep model with embedding tables or gradient boosted trees), memory budget for serving, how fast new Pages appear, and how skewed traffic is across Pages. Typically a few...

Approach

Each encoding trades memory, expressiveness and leakage risk differently. I would compare them on those axes and then design for the long tail explicitly, because most IDs have very few examples and c...


Submit Your Answer
Markdown supported