Back to problems

Beam Search Decoding

Algorithm · Microsoft AI · Hard

Implement the greedy decoding step for a sequence model. For each time step, you are given a list of scores for possible tokens. Greedy selection picks the token with the maximum score at each step, treating every step separately. Your task is to write a function greedyDecode(scores) that returns a list of the chosen token indices. The input scores is a list of lists, where scores[i][j] is the score of token j at time step i. For every step, return the index j that maximizes…

Checking your access…