A content-based attention mechanism assigns changing importance to input elements according to the decoder’s current representation. In a pointer network, it acts like a spotlight: an encoder represents the input sequence, while the decoder produces a softmax distribution over input positions and selects the next relevant element. section 11.9
The mechanism operates sequentially:
- Encode the raw input sequence into a more manageable representation. section 11.9
- Use the decoder state to modulate attention over the original inputs. section 11.9
- Convert attention scores into probabilities over input positions. section 11.9
- Select an input element at each step until the output sequence is complete. section 11.9
Convex hull selection
For a set of random two-dimensional points, Ptr-Net uses attention probabilities to point to the next vertex of the convex hull. Training uses PyTorch datasets, Adam, negative log-likelihood loss, and validation accuracy; a 50-point sample matches the reference hull with 100% overlap. section 11.9
