A sequence-to-sequence model maps an ordered input sequence to an output sequence. In combinatorial problems such as sorting or the travelling salesperson problem, the output elements come from the input, so their possible categories depend on input length. section 11.3.3
Pointer networks address this challenge by using attention to select input items for the output. Unlike conventional attention, which helps generate an output element, this mechanism points to an input element. section 11.3.3
Selecting convex-hull points
Given points labeled [1, 2, 3, 4], a pointer network can estimate an output sequence such as [1, 4, 2]. The output can contain fewer items than the input. section 11.3.3
Table 11.2 Sequential ML (view table figure)
| Task |
Example |
|---|---|
| One-to-one |
Image classification. We provide a single image as input, and the model outputs the classification or category, like “dog” or “cat,” as a single output. |
| One-to-many |
Image captioning. We input a single image into the model, and it generates a sequence of words describing that image. |
| Many-to-one |
Sentiment analysis. We input a sequence of words (like a sentence or a tweet), and the model outputs a single sentiment score (like “positive," “negative,” or “neutral”). |
| Many-to-many (type 1) |
Sequence input and sequence output, like in the case of named entity recognition (NER). We input a sentence (a sequence of words), and the model outputs the recognized entity, such as a person, organization, location, etc. |
| Many-to-many (type 2), known as a synchronized sequence model |
Synced sequence input and output. The model takes a sequence of inputs but doesn’t output anything until the entire sequence has been read. Then it outputs a sequence. An example of this is video classification, where the model takes a sequence of video frames as input and then outputs a sequence of labels for those frames. |
Compare sequence tasks by whether they map one item or many to their outputs. section 11.3.3









