Bidirectional long short term memory
What Is Bidirectional Long Short Term Memory?
Bidirectional long short term memory, usually abbreviated BiLSTM, is a recurrent neural network architecture that processes a sequence twice, once from beginning to end and once from end to beginning, and combines the two resulting hidden states at every time step. It pairs two innovations: the long short term memory cell, which uses gated internal state to carry information across long spans without the gradient vanishing, and bidirectional training, which removes the constraint that a prediction at position t may depend only on positions up to t. The result is a representation of each element that is conditioned on the entire sequence rather than on its prefix alone.
The bidirectional idea was formalized by Mike Schuster and Kuldip Paliwal in a 1997 IEEE Transactions on Signal Processing paper on bidirectional recurrent neural networks, which trained a network simultaneously in positive and negative time directions and evaluated it on phoneme classification with the TIMIT corpus. Alex Graves and Jürgen Schmidhuber combined that scheme with LSTM cells in 2005, reporting in a study of framewise phoneme classification with bidirectional LSTM that gated cells outperformed plain recurrent units and that bidirectional variants outperformed unidirectional ones on the same task.
Architecture
A BiLSTM layer holds two independent LSTM sub-networks with separate weight matrices. The forward network reads the input sequence in its natural order and produces hidden states h1 through hT. The backward network reads the reversed sequence and produces its own states, which are then re-aligned to the original index. The layer output at position t is a function of both, most commonly the concatenation of the forward and backward hidden vectors, which doubles the output dimensionality. Summation, averaging, and learned projection are also used where dimensionality must be preserved. Because the two directions never exchange information within a layer, they can be evaluated in parallel, and stacking several BiLSTM layers lets higher layers see context that lower layers have already summarized in both directions.
Training and Practical Constraints
Training uses backpropagation through time applied to the unrolled graph, with the backward-direction network unrolled in reverse. The gating structure of the LSTM cell, comprising input, forget, and output gates around a linear memory carousel, keeps gradient magnitudes stable over sequences of hundreds of steps, a property analyzed in a widely cited review of recurrent network architectures for sequence learning. Two constraints follow from the design. The complete sequence must be available before any output can be computed, which rules out streaming and online inference. Parameter count and memory footprint roughly double relative to a unidirectional layer of the same width, and the recurrence itself remains sequential, so training time scales with sequence length rather than parallelizing across it.
Relation to Attention-Based Models
Transformer encoders provide bidirectional context through self-attention and compute all positions in parallel, and they have displaced BiLSTM as the default in large-scale language modeling. BiLSTM layers remain common where sequences are short to moderate, training data is limited, or inference must run on constrained hardware, since they carry far fewer parameters than a transformer of comparable accuracy. Hybrid designs are also frequent, with a BiLSTM layer feeding a conditional random field for structured tagging, or serving as the temporal encoder above a convolutional feature extractor.
Applications
Bidirectional long short term memory has applications in a range of fields, including:
- Speech recognition and phoneme classification
- Named entity recognition, part-of-speech tagging, and sequence labeling
- Machine translation and text summarization encoders
- Sentiment analysis and document classification
- Protein secondary structure and gene sequence prediction
- Electrocardiogram and electroencephalogram signal classification
- Time series forecasting for load, traffic, and financial data