In Batch Negatives and LogQ Correction for Two Tower Job Retrieval

Last updated: November 29, 2026

Quick Overview

A two-tower model retrieves candidate jobs for members by dot product of member and job embeddings, trained with in-batch negatives. Explain why in-batch negatives work, what bias they introduce, and how to correct it.

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

0

0

0 solved


A two-tower model retrieves candidate jobs for members by dot product of member and job embeddings, trained with in-batch negatives. Explain why in-batch negatives work, what bias they introduce, and how to correct it.

LinkedIn uses embedding-based retrieval for jobs, feed, and people search ahead of heavier rankers. Senior ML interviews probe whether you understand the sampled softmax behind in-batch training, its popularity bias, and practical fixes like logQ correction and hard negatives.

What the Interviewer Expects
  • Explains the two-tower architecture and why it suits retrieval
  • Derives the in-batch softmax loss
  • Identifies popularity bias from in-batch sampling
  • Applies logQ correction with sampling probability estimates
  • Discusses hard negatives and mixed negative sampling
  • Evaluates with recall at k on a time-based holdout
Key Topics to Cover
two-tower models
sampled softmax
in-batch negatives
logQ correction
embedding retrieval
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 estimate an item's sampling probability in a streaming setting?
  • What goes wrong if you add hard negatives that are actually relevant?
  • Why can't you add member-job cross features to a two-tower model?
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

Setup: member tower u=f(member)u = f(\text{member}), job tower v=g(job)v = g(\text{job}), score s=u⊤vs = u^\top v. Jobs are indexed with approximate nearest neighbor search, so the towers must not share cross features....

Approach

Treat retrieval as a softmax over all jobs and approximate it with the other positives in the batch as negatives. Then correct the sampling bias this creates....


Submit Your Answer
Markdown supported