Abstract
We propose a novel extension of the encoder-decoder framework, called a review network. The review network is generic and can enhance any existing encoder-decoder model: in this paper, we consider RNN decoders with both CNN and RNN encoders. The review network performs a number of review steps with attention mechanism on the encoder hidden states, and outputs a thought vector after each review step; the thought vectors are used as the input of the attention mechanism in the decoder. We show that conventional encoder-decoders are a special case of our framework. Empirically, we show that our framework improves over state-of-the-art encoder-decoder systems on the tasks of image captioning and source code captioning.
Introduction
Standard encoder-decoder models with attention mechanisms have become the backbone of sequence generation tasks. However, they often suffer from a "look-ahead" problem. When a decoder generates the first word of a sequence, it attends to a specific part of the input without a global understanding of what it will attend to in the future. This sequential nature can lead to sub-optimal results in complex tasks like image captioning, where multiple objects and their relationships must be considered.
To address this, we introduce the Review Network, an architectural component that adds a "thinking" phase between encoding and decoding. By performing multiple passes over the encoded data, the model captures global context and abstract concepts before generation begins.
Methodology: The Review Network
The proposed architecture consists of three main components: an Encoder, a Reviewer, and a Decoder.
The Reviewer Module
The Reviewer is the core innovation of this work. Instead of passing encoder hidden states directly to the decoder, the Reviewer (typically an LSTM) performs $T_r$ "review steps." In each step, it uses an attention mechanism to scan the encoder's hidden states and outputs a thought vector ($f_t$). These vectors represent compact, abstract summaries of the global input.
The authors explored two primary variants of the reviewer mechanism: the Attentive Input Reviewer and the Attentive Output Reviewer. These variants differ in whether the attention mechanism is applied to the input or the output of the reviewer RNN to form the final thought vector.
Discriminative Supervision
To further enhance the quality of the thought vectors, an optional discriminative branch is added. The thought vectors are passed through linear layers and max-pooling to predict the set of words present in the target caption. This multi-task learning approach forces the reviewer to extract more semantically meaningful features during the review phase.
Evaluation and Results
The Review Network was evaluated on two distinct tasks to demonstrate its generalizability:
- Image Captioning (MSCOCO): Using a CNN encoder, the model achieved a CIDEr score of 0.969, outperforming contemporary state-of-the-art systems like Google NIC and Semantic Attention.
- Source Code Captioning (HabeasCorpus): Using an RNN encoder on Java code snippets, the model showed superior performance in log-likelihood and character savings compared to standard attentive baselines.
Key Insights
- Global Context: Visualization of attention weights indicates that the reviewer learns to recognize relationships between objects (e.g., the relative position of a giraffe to a tree) rather than just identifying individual objects.
- Weight Tying: Experiments showed that "untied" weights—where each review step has unique parameters—performed better. This suggests that the "thinking" process is non-linear and benefits from specialized logic at different stages of abstraction.
Conclusion
The Review Network effectively solves the sequential bottleneck of standard attention by pre-computing global context through multiple review steps. While the number of review steps is currently a fixed hyperparameter, future work could explore adaptive computation times to handle varying input complexities. This generic framework shows great promise for a wide range of sequence generation tasks beyond captioning, including machine translation and text summarization.
Summary updated