← Uber Interview Insights

Uber·Machine Learning Engineer·Technical Phone Screen·Intermediate

Intermediate
Jun 2026

Summary

ML engineer screen at Uber, just one question about cross entropy. Short and a bit anticlimactic.

Questions Asked (1)

Q1

Can you explain cross entropy and how it works?

Technical Trade-offsAlgorithms & Data Structures
Author's notes

Blanked a little on the formal derivation and ended up explaining it more intuitively, like framing it as how surprised your model is by the true label.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by defining cross entropy in information theory terms, then connect it to its use as a loss function in classification. Explain the formula, its properties, and why it's preferred over alternatives like MSE. Finally, discuss practical implications and trade-offs in ML systems.

Pro tip: Mention that cross entropy is equivalent to minimizing KL divergence between the predicted and true distributions, and highlight its role in handling class imbalance and probabilistic outputs. This shows depth beyond textbook definitions.

1. Define cross entropy

Explain cross entropy as a measure of the difference between two probability distributions, rooted in information theory. Mention that it quantifies the average number of bits needed to encode data from one distribution using a code optimized for another.

2. Present the formula

Write the formula: H(p, q) = -Σ p(x) log q(x), where p is the true distribution and q is the predicted distribution. For classification, p is one-hot and q is softmax output, simplifying to -log q(true class).

3. Explain why it's used in ML

Discuss that cross entropy is convex for softmax outputs, provides well-calibrated probabilities, and penalizes confident wrong predictions heavily. Compare with MSE, which can lead to slow convergence due to vanishing gradients.

4. Discuss practical considerations

Mention numerical stability (log-sum-exp trick), handling class imbalance (weighted cross entropy), and its use in multi-class and multi-label settings. Also note that it assumes mutually exclusive classes for softmax.

5. Connect to broader context

Relate cross entropy to KL divergence and maximum likelihood estimation. Highlight its importance in training neural networks and its role in evaluating model performance (e.g., perplexity in NLP).

Key Points to Mention

  • Cross entropy measures the difference between two probability distributions.
  • Formula: H(p, q) = -Σ p(x) log q(x); for one-hot labels, it reduces to -log q(true class).
  • It is convex when used with softmax, leading to efficient optimization.
  • Cross entropy is equivalent to minimizing KL divergence plus entropy of true distribution.
  • It heavily penalizes confident incorrect predictions, which is desirable for classification.
  • Practical issues: numerical stability, class imbalance, and multi-label extensions.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.