Implement Top-p (Nucleus) Sampling in NumPy
Company: Amazon
Role: Machine Learning Engineer
Category: Coding & Algorithms
Difficulty: medium
Interview Round: Onsite
Quick Answer: This coding question tests practical implementation of top-p (nucleus) sampling, a core decoding strategy in large language models. It evaluates NumPy proficiency including numerically stable softmax, cumulative probability thresholding, and reproducible stochastic sampling — skills central to machine learning engineering roles.