Implement Beam Search for Language Model Decoding
Asked at NVIDIA · LLMs & Prompt Engineering · Difficulty: Medium · Last asked Jul 12, 2025
A language model generates text one token at a time. Greedy decoding always takes the single most likely next token, which can miss a sequence that is more likely overall. Beam search keeps the `beam_width` best partial sequences at every step instead of one. Implement beam search over a given language model.
Loading the problem…
More NVIDIA interview questions
- Design a GPU Inference Serving System
- Deep Learning Fundamentals: Optimization, Drift, Calibration
- LLM SQL Chatbot Access Control and Query Safety
- Data Platform, Pipeline, and ML Operations Fundamentals
- Rate Limiter Algorithm Design
- HPC Host Control Plane and Job Coordination