The input is the output dictionary
An ordinary fixed-vocabulary decoder predicts one of a predetermined set of tokens. A pointer decoder instead scores the current input positions: three candidates give three choices, while seven candidates give seven. The same learned scoring function can handle different input lengths. This capacity does not guarantee good predictions on lengths absent from training.
Three candidates, one decision
Consider a fictional candidate list: instrument A at position 1, B at position 2 and C at position 3. Suppose the decoder produces the unitless scores , and . These are illustrative scores, not expected returns.
Here the unnormalised weights are 1, 2 and 3, so their sum is 6:
Greedy decoding selects position 3, hence instrument C. Sampling would sometimes choose A or B. A probability of one half is a model probability of selection, not a forecast that C has a 50% chance of making money. Nor is the vector an allocation: it sums to one because it describes a discrete choice.
In an actual decoder, the state and scores normally change after each selection. The next probabilities therefore need not equal these numbers. A mask should encode the task's eligibility rule; a task that allows repeated choices needs a different rule. A decoder also needs a stopping convention, such as a specified number of selections or an end token.
A selected item is only part of a solution
A pointer identifies an available input item. It does not inherently prevent repeats, guarantee a complete tour or enforce a portfolio's exposure limits. The original paper's travelling-salesman experiment restricts beam search to valid tours because unconstrained decoding could repeat or omit cities (§4.4).
For the fictional trade list, excluding already selected instruments would prevent duplicate selections, but would say nothing about cash usage, transaction costs or risk limits. Those requirements need their own representation and enforcement. Greedy decoding chooses the most likely next position; it does not certify the most likely complete sequence, the shortest route or an optimal portfolio.
Sources
- Vinyals, Fortunato and Jaitly (2015), Pointer Networks, §§2.1–2.3 for the conditional decoder and input-index distribution; §4.4 for constrained tour decoding.