top k
AI, ML & GenAI interview questions tagged top k, across every topic.
4 questions · 2 unlocked for you
Concepts behind "top k"
The curriculum that explains the ideas these questions test.
Core
Temperature and SamplingAt each step a model outputs a probability distribution over the next token; how you pick from it is decoding. Temperature reshapes the distribution (low sharpens toward the most likely token, high flattens it), while top-k and top-p (nucleus) trim the tail before sampling. The choice sets the trade-off between deterministic, focused output and diverse, creative output. AI, ML, and GenAI engineer interviews probe it because the right decoding settings differ sharply between factual/extraction tasks and creative ones, and because reproducibility hinges on them.🧠 Foundations of LLMs & GenAISign in
Core
Heaps and Priority QueuesA binary heap holds a partial order so you can pull the smallest or largest element in O(log n) and peek at it in O(1), without paying for a full sort. This is the right tool for top-k, merging k sorted streams, and a running median, cases where you want the extreme few, not the whole order. Applied-AI interviews test it because retrieval, ranking, and streaming pipelines all rest on cheap partial-order operations.💻 Coding & Engineering CraftSign in
