I'm working on image captioning problem, where I need to have an encoder for image and decoder for caption generation. Regarding the decoder, I've found a reference that uses Pytorch LSTM where bidirectional parameter is False. However, I know that bidirectional LSTM is more accurate. So, what do you think about this comparison?


Bidrectional LSTMs are still traditional and so I believe you refer to unidirectional LSTM models.


Unidirectional LSTM layers only preserve information of the past, as inputs are processed at each time point in a sequential forward pass. This means that, at each time-point the sequence model only reads information from the past. However bidirectional LSTM layers, are able to process inputs from the future in a backward pass, additional the the forward. In this way, the sequence model is able to preserve and "memorise" information from the past but also from the future.

Hidden state

The hidden state of a bidirectional LSTM layer is double in size (forward and backward pass) to enable allows at any point in time the alleged preservation of information the past and future.

In short

In essence, bidirectional LSTM models generally show better results as they can understand context better.


Not the answer you're looking for? Browse other questions tagged or ask your own question.