Neural architecture that outputs pointers to input positions, enabling variable-size outputs
Pointer Networks solve a fundamental limitation of sequence-to-sequence models: they can only output from a fixed vocabulary. Pointer Networks instead output pointers to input positions, enabling tasks where output size depends on input.
The Problem
Standard seq2seq models produce outputs from a fixed dictionary:
But what if the output should reference input positions? For convex hull, the output is indices into the input—vocabulary size equals input size.
The Pointer Mechanism
Instead of projecting to a fixed vocabulary, use attention over inputs as the output:
The attention weights directly become the output probability over input positions.
Architecture
- Encoder: Process input sequence to get representations
- Decoder: At each step, produce hidden state
- Pointer: Compute attention over encoder states, output highest-attention position
Interactive Demo
Watch a Pointer Network solve convex hull by pointing to input coordinates:
Pointer Networks
Applications
Convex Hull
Given points, output the subset forming the convex hull. Output size varies with input geometry.
Delaunay Triangulation
Given points, output triangles. Number of triangles depends on point configuration.
Traveling Salesman Problem
Approximate TSP by learning to output city visitation order.
Sorting
Learn to sort sequences by outputting indices in sorted order.
Why Pointers Matter
| Standard Seq2Seq | Pointer Network |
|---|---|
| Fixed vocabulary | Input-dependent vocabulary |
| Can’t reference input | Output references input |
| Fixed output size | Variable output size |
Key Equations
Encoder (bidirectional LSTM):
Decoder with attention:
Pointer distribution:
Influence
Pointer Networks introduced the idea of using attention as output, which influenced:
- Copy mechanisms in text generation
- Pointer-generator networks for summarization
- Graph neural network outputs
Key Paper
- Pointer Networks — Vinyals, Fortunato, Jaitly (2015)
https://arxiv.org/abs/1506.03134