top k
Applied AI 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) truncate the tail before sampling. The choice sets the trade-off between deterministic, focused output and diverse, creative output. Applied-AI interviews probe it because the right decoding settings differ sharply between factual/extraction tasks and creative ones, and because reproducibility depends on them.🧠 Foundations of LLMs & GenAISign in
Core
Heaps and Priority QueuesA binary heap keeps 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 to fully sort. This is the right tool for top-k, merging k sorted streams, and a running median, where you need the extreme few, not the whole order. Applied-AI interviews probe it because retrieval, ranking, and streaming pipelines all hinge on cheap partial-order operations.💻 Coding & Engineering CraftSign in
