← Openai Interview Insights

Openai·Machine Learning Engineer·Technical Phone Screen·Senior

Senior
Apr 2026

Summary

Got a pretty focused ML interview at OpenAI, at least the one question I remember was a real head-scratcher about streaming inference. Short but not easy.

Questions Asked (1)

Q1

If logits are arriving block-by-block in a streaming fashion, how would you compute entropy online without waiting for all of them?

Algorithms & Data StructuresTechnical Trade-offsSystem Design
Author's notes

This one took me a second.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Explain that entropy can be computed online by maintaining running aggregates of the logits, such as the maximum logit and the sum of exponentials, using numerically stable updates. Then, at any point, the entropy can be derived from these aggregates without storing all logits.

Pro tip: Mention that for streaming entropy, you can use the log-sum-exp trick with a running maximum to avoid overflow, and that the same approach extends to other softmax-based quantities like cross-entropy.

1. Define entropy in terms of logits

Recall that entropy H = log(sum(exp(logits))) - sum(softmax(logits) * logits). This can be computed from the log-sum-exp and the expected logit under the softmax.

2. Identify sufficient statistics

The entropy depends only on the log-sum-exp of the logits and the sum of logits weighted by softmax probabilities. These can be updated incrementally.

3. Maintain running aggregates

Keep a running maximum logit M and a running sum S = sum(exp(logit - M)). Also maintain a running weighted sum W = sum(logit * exp(logit - M)). Update these as new logits arrive.

4. Handle numerical stability

When a new maximum arrives, rescale S and W by exp(old_M - new_M) to avoid overflow. This ensures stable updates.

5. Compute entropy on demand

At any point, compute log-sum-exp as M + log(S), and the expected logit as W/S. Then entropy = log-sum-exp - expected logit.

Key Points to Mention

  • Log-sum-exp trick for numerical stability
  • Running maximum and rescaling
  • Sufficient statistics for entropy
  • Online update formulas
  • Memory efficiency: O(1) space
  • Extension to cross-entropy and other softmax-based metrics

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