OpenAI

Verified interview challenge

Streaming Entropy

Compute entropy from logits, then keep the calculation stable as the input arrives in blocks.

Unlock with Full Access

The challenge

Begin with a NumPy entropy calculation and extend it to handle large positive and negative logits. Then process a stream of blocks with constant extra memory. The four parts share one Python file and a 60-minute timer, with an untimed practice mode also available.

What you'll practise

  • Entropy and softmax

    Turn logits into a distribution and calculate its uncertainty.

  • Numerical stability

    Preserve meaningful results when exponentials overflow or small probabilities underflow.

  • Streaming computation

    Combine blocks into one result without storing the full input.

Your coding workspacePreview
Current partFurther parts unlock as you progress
solution.pyPython 3.13
# Build on your implementation

# Run checks for the current part

# Full starter code included
Current-part checks

Run your code to see results.

The complete sequence, starter code and checks are included with Full Access.