ATLAS NOVA My AtlasVelocer ↗

Technology · Machine learning

Long short-term memory

Recurrent neural network architecture

Long short-term memory is a kind of artificial neural network built to work with sequences: lists of items in order, such as the words of a sentence, the readings of a sensor taken every second, or the daily closing prices of a stock.

It belongs to the family of recurrent neural networks (RNNs), networks that process one item at a time and carry something forward from each step to the next. That carried-forward state is what lets a recurrent network treat the past as relevant to the present. An LSTM is a recurrent network whose internal machinery has been redesigned so that the state can be kept, changed, or released in a controlled way.

Key facts
1000LSTM bridged minimal time lags exceeding this many discrete steps (Hochreiter & Schmidhuber 1997)⁠[1]
28%Fine-tuned model reproduced this share of 1,240 held-out malaria actives (Segler et al. 2018)⁠[2]
0.0070Lowest mean absolute error on COVID-19 deaths in China (Shahid et al. 2020)⁠[3]
96.6%Accuracy detecting driver distraction across subjects with LSTM (Wollmer et al. 2011)⁠[4]

Overview

What long short-term memory is

The need for that control shows up in ordinary language. Consider the sentence "The keys that I left on the kitchen table yesterday are gone." To understand why the verb is "are" rather than "is," a model has to connect the plural noun "keys" to a verb that appears many words later, with a whole clause in between. A plain recurrent network tends to lose its grip on the earlier word as new words arrive, because each step overwrites the state with a fresh mixture of old and new. The information is not so much erased as diluted, step after step, until it no longer influences the output. An LSTM is designed to hold a piece of information across such a gap without letting it wash out.

The mechanism that does this is a set of gates: small learned units that decide, at each step, how much of the incoming information to admit, how much of the stored information to keep, and how much of it to expose as output. A gate is not a physical door but a number between zero and one, computed from the current input and the previous state, that scales the flow of information. A value near zero shuts a channel; a value near one lets it through almost unchanged. Because these numbers are produced by the network itself and adjusted during training, the network learns when to remember and when to let go, rather than following a rule a person wrote. The stored information lives in a memory cell, a running state that passes along the sequence and is modified only through the gates.

This arrangement matters because most interesting data is sequential, and the meaning of an item usually depends on items that came before it. A single sensor reading says little on its own; a run of readings can reveal whether a person is walking, sitting, or falling. A single word is ambiguous; the words around it settle the meaning. Models that treat each input independently throw away exactly the context that makes prediction possible, while models that carry state forward can use it. The LSTM's contribution is to make that carried state durable enough to be useful over long stretches and selective enough to avoid being swamped by irrelevant detail.

The design was introduced to address a specific failure of earlier recurrent networks, the tendency of the learning signal to fade as it travels back through many steps, which is treated in the next section. What matters here is the consequence: an LSTM can, in principle, learn to depend on events separated by long stretches of sequence, not just on the immediately preceding item. That property is why the architecture spread so widely. A review of deep learning in medical image analysis categorizes LSTM models among the deep learning techniques examined, and describes the LSTM as a specialized form of recurrent neural network proficient in processing sequential medical image data by preserving long-term dependencies and learning temporal patterns.⁠[5]

An LSTM is therefore best understood not as a completely different kind of model but as a recurrent network with a memory that is managed rather than merely overwritten. The gates give it a way to decide what a sequence is worth remembering, and the memory cell gives it somewhere to keep that decision. Everything else about the architecture, how the gates are wired, how the network is trained, and where it has proved useful, follows from this central idea.

An LSTM is a recurrent network that learns what to remember, what to discard, and what to output as it reads a sequence.

History

The problem of vanishing gradients

Training a recurrent network means adjusting its weights so that its output at each step comes closer to the right answer. The adjustment is driven by a gradient, a set of numbers saying how much each weight contributed to the error and in which direction it should move. In a network that reads a sequence, the error at a late step has to be traced back through every step that came before it, because those earlier steps shaped the state the late step worked from. This backward tracing is called backpropagation through time, and it multiplies a chain of factors, one per step, as it travels backwards.

A block diagram with a recurrent loop at the top, an arrow labeled 'unfold through time', and below it a chain of boxes f1, f2, f3 and g connected by arrows with symbols a and x at various time steps.
A block diagram with a recurrent loop at the top, an arrow labeled 'unfold through time', and below it a chain of boxes f1, f2, f3 and g connected by arrows with symbols a and x at various time steps. View full-size image.Unfold through time by Headlessplatter ( talk ). Public domain, via Wikimedia Commons. Scaled to 960 pixels wide; no crop or other changes by Atlas Nova.

That chain of multiplication is where the trouble lies. If the factors are consistently smaller than one, the product shrinks with every step, and by the time the signal reaches the early part of a long sequence it is vanishingly small; the early weights barely move, so the network never learns that they mattered. If the factors are consistently larger than one, the product grows instead and the gradient explodes, producing wild updates that destabilise training. Either way, the practical effect is the same: the network can learn from the last few items it saw but not from items far back in the sequence. The dependence on distant events, which is exactly what sequential data demands, goes unlearned.

Hochreiter and Schmidhuber addressed this directly in the paper that introduced long short-term memory. Their diagnosis was that learning to store information over extended intervals by recurrent backpropagation takes a very long time, mostly because of insufficient, decaying error backflow.⁠[1] Their remedy was not to change the training algorithm but to change the unit, so that the error signal travelling backwards encounters a path along which it does not decay. The design enforces what they called constant error flow through constant error carousels inside special units: a self-connected loop whose weight is fixed at one, so that whatever enters the loop circulates without being scaled down step after step.⁠[1] The carousel is the ancestor of the memory cell described earlier in this chapter, and the fixed loop is the reason the cell can hold something across a long gap.

A fixed loop alone would be useless, because information could enter but never be cleared or read out at the right moment. The second half of the design is a set of multiplicative gate units, small learned multipliers that open and close access to the constant error flow.⁠[1] Because the gates are themselves trained, the network learns when the carousel should accept new content, when it should keep what it has, and when it should release it to the rest of the network. The gates are what make the memory selective rather than a passive delay line, and they are the reason the architecture could be trained at all with the gradient methods of the time.

The results reported in that paper were striking for their era. Truncating the gradient where doing so does no harm, the network learned to bridge minimal time lags in excess of 1000 discrete-time steps. The authors' experiments with artificial data involved local, distributed, real-valued and noisy pattern representations, and compared LSTM against real-time recurrent learning, backpropagation through time, recurrent cascade correlation, Elman nets and neural sequence chunking. Across those comparisons the LSTM produced many more successful runs and learned much faster, and it solved complex artificial long-time-lag tasks that none of the earlier recurrent algorithms had solved.⁠[1] The point of the comparison is not that one program beat another but that the vanishing-gradient barrier is a property of the architecture, not of the task: change the unit so the error can flow, and problems that were previously out of reach become learnable.

The cost of the design is modest. The LSTM is local in space and time, with computational complexity per time step and weight of order one, so the extra machinery does not make each step dramatically more expensive than an ordinary recurrent unit.⁠[1] What it buys is a memory that can be trained end to end, which is the foundation for everything the later sections of this chapter describe.

The gates and the fixed self-loop exist for one reason: to let the learning signal cross many time steps without fading or exploding.

How it works

Inside the LSTM cell: gates and memory

The cell is the small piece of machinery that an LSTM repeats at every step of a sequence. It receives the current input and the state carried from the previous step, and it produces an output plus an updated state to pass onward. What distinguishes it from an ordinary recurrent unit is that the update is broken into separate, learned decisions rather than one blended overwrite. Three of those decisions are made by gates, and the fourth piece is the store they act on.

A diagram of an LSTM cell with a green rounded box containing orange sigma and tanh layers and yellow pointwise operations, connected to inputs c(t-1), h(t-1), x(t) and outputs c(t), h(t), with a legend below explaining layer, pointwise op, and copy.
A diagram of an LSTM cell with a green rounded box containing orange sigma and tanh layers and yellow pointwise operations, connected to inputs c(t-1), h(t-1), x(t) and outputs c(t), h(t), with a legend below explaining layer, pointwise op, and copy. View full-size image.The LSTM cell by Guillaume Chevalier. CC BY 4.0, via Wikimedia Commons. Scaled to 960 pixels wide; no crop or other changes by Atlas Nova.

Each gate is a layer of weights followed by a sigmoid activation, the S-shaped function that squashes any input into a number between zero and one. That range is the point: the gate's output is used as a multiplier, so a value near zero blocks a signal and a value near one passes it almost intact, with everything in between giving a graded amount. Because the weights feeding the sigmoid are learned, the network discovers for itself which circumstances call for blocking and which for passing. A second activation, tanh, appears alongside the sigmoids; it squashes values into the range from minus one to plus one and is used to propose new content and to rescale the cell's contents before they leave. The division of labour is simple: sigmoids decide how much, tanh supplies the values that flow.

The forget gate looks at the current input and the previous output and decides how much of the existing memory to discard. Its output multiplies the old cell state, so a near-zero value wipes a stored item and a near-one value keeps it. This is the piece that makes the memory adaptive rather than permanent. In the original design the cell had no such gate, and the state could only accumulate; Gers, Schmidhuber and Cummins identified the resulting weakness for continual input streams that are not pre-segmented into subsequences with marked ends, where without resets the state may grow indefinitely and eventually cause the network to break down. Their remedy was the adaptive forget gate, which lets a cell learn to reset itself at appropriate times and so release its internal resources. The same work found that all algorithms tested, including standard LSTM, failed on continual versions of benchmark problems, while LSTM with forget gates solved them easily.⁠[6]

The input gate governs the opposite flow: how much of the newly proposed content is written into the cell. A tanh layer first produces a candidate vector, a set of values the cell could adopt, and the input gate scales that candidate before it is added to the state. Writing is thus a two-part decision, what to offer and how much of the offer to accept, which keeps a single irrelevant input from overwriting a useful memory. The cell state itself is then updated by combining the two scaled quantities: the old state after the forget gate has trimmed it, plus the gated candidate. That sum is the whole of the memory mechanism, and it is why the state is often pictured as a conveyor belt running the length of the sequence, with gates adding to and removing from it at each stop rather than rebuilding it from scratch.

The output gate controls what the rest of the network gets to see. The cell state is passed through tanh to bring it back into a workable range, and the output gate scales the result to produce the hidden output for that step. This separation matters because the cell can hold something it does not currently need to report. A memory can persist across many steps while the output at each step exposes only the part relevant to the task at hand, and the hidden output is what feeds both the next step and any layer above.

The gate values are computed from the same two sources at every step, the current input and the previous hidden output, each multiplied by its own learned weights.⁠[7] Nothing about the wiring is hand-set; training adjusts the weights so that the gates open and close in patterns that serve the task. The arrangement also keeps the backward path clean. Because the state is carried forward by addition and scaled by gate values rather than pushed through a squashing function at every step, the learning signal can travel back along it without the repeated shrinking that defeats a plain recurrent network, the mechanism described earlier in this chapter.⁠[1] The gates are what make that path selective, and the cell state is what makes it long.

The cell state is a running store that is trimmed, added to, and read out through three learned gates, never rebuilt from scratch.

How LSTM networks are trained and used

Training an LSTM means finding the weights that make its outputs match the right answers on examples. The network is first run forward along a sequence: at each step the gates read the current input and the previous hidden output, update the cell state, and produce an output. Those outputs are compared with the targets, and the differences are summed into a loss, a single number measuring how wrong the network currently is. The loss is what training tries to reduce.

Reducing it requires knowing how each weight contributed to the error, and that is where the sequence matters. The error at a late step depends on every earlier step that shaped the state it worked from, so the gradient must be traced backwards through the whole unrolled sequence, one step at a time. This is backpropagation through time (BPTT), the recurrent form of the backward pass described earlier in this chapter. The gradients it produces are then fed to an optimiser, usually a form of gradient descent, which nudges each weight a small distance in the direction that lowers the loss. The size of that nudge is set by the learning rate, a number chosen before training begins rather than learned.

The architecture itself is a set of choices made before any weight is learned. These hyperparameters include how many LSTM layers are stacked on top of one another, how wide each layer is, and how much dropout to apply. Dropout is used to regularize the network and to address the overfitting problem.⁠[2][8] A concrete setup shows the scale involved: a chemical language model used three stacked LSTM layers of 1024 dimensions each, followed by dropout at a ratio of 0.2, and was trained with a batch size of 128 over sequences unrolled for 64 steps, giving 21.3 million parameters in total.⁠[2] Stacking layers organizes the network hierarchically, with each layer processing the outputs of the previous one.⁠[9]

Choosing these settings well is itself a problem, since the space of possible configurations is large and each trial costs a full training run. One practical answer is to let an algorithm search it. In a study of smartphone activity recognition, Bayesian optimization was used to tune the hyperparameters of each LSTM network, a method that proposes the next configuration from the results of the ones already tried rather than sweeping blindly. The same study compared several LSTM arrangements on the same sensor data.⁠[7]

Two structural variants change the direction or depth of the pass itself. A bidirectional LSTM (Bi-LSTM) runs two copies of the network over the sequence, one forward and one backward, and combines their outputs, so that the representation at each position draws on what came before and what comes after. Bidirectional RNNs and bidirectional LSTMs were developed to process sequences in both forward and backward directions, and recent research has shown that processing sequences bidirectionally can improve performance, particularly in offline processing settings where sequence fragments can be stored and analyzed rather than streamed.⁠[10] A stacked LSTM simply places several LSTM layers in series, the output sequence of one becoming the input of the next, which is the arrangement used in the three-layer model above.⁠[2] Both variants keep the same cell and the same training procedure; they change what the cell is connected to.

Once trained, the network is used by running it forward on new sequences, with the weights frozen and the gates responding to input it has not seen. The same machinery that made the gradient tractable during training now makes the memory usable at prediction time: the cell carries what earlier steps established, and the gates decide how much of it to expose at each new step. What the network does with that memory across different domains is taken up in the sections that follow.

Training an LSTM is ordinary gradient descent with one twist: the backward pass runs through time, so the learning rate, the depth of the stack, and the dropout rate all shape whether the memory can be learned at all.

Training runs a forward pass, measures error, traces gradients back through time, and updates the weights.

Uses

Early applications: speech and language

Speech recognition

A flowchart-style diagram of a speech recognition system with blue process boxes (Speech Detection and Segmentation, Voice Separation, Feature Extraction, Feature Selection, Classification/Regression, Model), green cloud and cylinder shapes for data sources such as a large-scale database, crowd-sourcing and experts, labelled corpora, and unlabelled web data, connected by dashed arrows.
A flowchart-style diagram of a speech recognition system with blue process boxes (Speech Detection and Segmentation, Voice Separation, Feature Extraction, Feature Selection, Classification/Regression, Model), green cloud and cylinder shapes for data sources such as a large-scale database, crowd-sourcing and experts, labelled corpora, and unlabelled web data, connected by dashed arrows. View full-size image.Scheme of speech recognition system by IHEARu. CC BY-SA 4.0, via Wikimedia Commons. Scaled to 960 pixels wide; no crop or other changes by Atlas Nova.

Speech is a sequence in the most literal sense: a stream of acoustic measurements, a few milliseconds at a time, whose meaning at any moment depends on sounds that came before. LSTM was applied to acoustic models for large-vocabulary recognition, the task of transcribing ordinary continuous speech rather than a handful of isolated words.⁠[11] The motivation was the same one that drove the architecture's invention: a recurrent network can model sequences, but a plain one cannot hold on to context across the many frames that separate a sound from the word it belongs to. LSTM models were trained and compared against ordinary recurrent networks and against deep feedforward networks at a range of sizes and configurations, and they converged quickly and gave state-of-the-art speech recognition performance even at relatively small model sizes.⁠[11] The result mattered less for any single benchmark than for the demonstration that the gating machinery scaled: a cell designed to solve an artificial long-lag problem turned out to be a practical acoustic model for real speech.

Language and named entities

Text offered a second natural home. A language model assigns a probability to the next word given the words so far, which is again a problem of carrying context forward, and the same architecture that handled acoustic frames could be trained on words. The more interesting question was whether the memory could do something beyond counting co-occurrences: whether it could track grammatical structure. One line of work probed this with number agreement in English, the rule that a verb must match its subject in singular or plural.

When the network was trained with an explicit grammatical target, either predicting the number of a verb or judging whether a sentence was grammatical, it reached very high overall accuracy, with fewer than one percent errors; but errors rose when sequential and structural cues conflicted, and they rose sharply when the network was trained only as a language model, without that targeted supervision.⁠[12] The finding is a useful corrective to the idea that a memory alone yields grammar. An LSTM can capture a non-trivial amount of syntactic structure when it is pointed at the task, while the ordinary next-word objective leaves syntax-sensitive dependencies largely unlearned.

A related application treats text not as something to generate but as something to label. Named entity recognition is the task of finding the mentions of genes, chemicals, diseases, species or cell lines in a scientific passage, and it had long been handled by tools built around hand-chosen features and dictionaries specific to each entity type, an expensive and brittle arrangement. A generic method combined word embeddings, which represent each word as a vector capturing the company it keeps, with an LSTM and a conditional random field (CRF), a statistical layer that assigns a consistent label sequence rather than labelling each word in isolation. Evaluated in 33 evaluations on 24 corpora covering five entity classes, this LSTM-CRF scored on average five percent above the entity-specific tools, mostly through a sharp rise in recall, the share of true entities it found.⁠[13] The gain came without any entity-specific engineering, which is the point: the sequence model learned the relevant patterns from annotated examples instead.

What these early uses established

Speech and language were the proving grounds because both are sequences with long-range structure and abundant data, the conditions under which a managed memory pays off. They also set the pattern for what followed. In each case the architecture was not used raw but wrapped in a larger system, an acoustic model inside a recogniser, a CRF on top of the recurrent layer, and the surrounding pieces did part of the work. The same habit of combining the cell with other components recurs throughout the applications covered later in this chapter, from sensor data to forecasting, where the recurrent layer is rarely asked to carry the whole task alone.

Time series forecasting in finance and beyond

A time series is a sequence of measurements taken at regular intervals, and forecasting it means using the values so far to say something about the values to come. This is the setting the LSTM was built for. The memory cell described earlier in this chapter lets the network carry a running impression of the recent past, and the gates let it decide which parts of that impression still matter. A forecaster built on an LSTM is trained on historical windows and asked to produce the next value, or the next several, and the same backward pass through time that trains any LSTM does the work.

Financial prices are the hardest case, because they are noisy and volatile, and a model that fits the past too closely learns its accidents rather than its pattern. One response is to clean the signal before the network sees it and to extract higher-level features first. A framework combining wavelet transforms, which decompose a price series to strip out noise, with stacked autoencoders, which learn compressed representations layer by layer, fed those denoised features into an LSTM to forecast the next day's closing price. Tested on six stock indices across markets at different stages of development, the combined model outperformed a wavelet-plus-LSTM model, a plain LSTM and a conventional recurrent network on both predictive accuracy and the profitability of a simple trading strategy built on its forecasts.⁠[14] The comparison is the informative part: the LSTM was doing the temporal work, but the gain over a plain LSTM came from what was fed into it.

Cryptocurrency prices present the same problem in a more extreme form, and the choice of recurrent unit has been examined directly. Three variants, the plain LSTM, the gated recurrent unit and the bidirectional LSTM, were trained to predict exchange rates for Bitcoin, Ethereum and Litecoin. Measured by mean absolute percentage error, the bidirectional version, which reads the sequence in both directions, gave the most accurate predictions of the three, with errors of 0.036, 0.041 and 0.124 for Bitcoin, Litecoin and Ethereum respectively.⁠[15] That result is worth holding lightly, since a different comparison on the same family of assets reached a different ranking, a point taken up later in this chapter.

Bitcoin, Litecoin and Ethereum forecasting errors. Bidirectional LSTM error on three cryptocurrencies, lowest of the variants compared. From this article: “Measured by mean absolute percentage error, the bidirectional version, which reads the sequence in both directions, gave the most accurate predictions of the three, with errors of 0.036, 0.041 and 0.124 for Bitcoin, Litecoin and Ethereum respectively.⁠”⁠[15]

Epidemic forecasting applies the same machinery to counts of people rather than prices. During the COVID-19 pandemic, forecasts of confirmed cases, deaths and recoveries were needed far enough ahead to plan hospital capacity, and the counts form a sequence with strong momentum. A comparison trained statistical, machine-learning and deep-learning forecasters on 110 days of data and tested them on the following 48, for ten countries. The statistical and kernel-regression baselines failed to follow the trend, producing large errors and negative goodness-of-fit scores, while the recurrent models tracked it closely; the bidirectional LSTM was the most accurate overall, with its lowest errors on deaths in China, at a mean absolute error of 0.0070 and a root mean square error of 0.0077, and a best goodness-of-fit score of 0.9997 for recovered cases there.⁠[3] The practical lesson is that a sequence model earns its place when the quantity has temporal momentum that simpler regressors cannot follow.

Water is the domain where the LSTM's long memory has been most directly tied to a physical mechanism. River flow depends on what fell as rain or snow days or weeks earlier, and in catchments with snow the delay can be long, because water is held in storage and released slowly. A data-driven model built on LSTM networks was tested on 241 catchments and compared with a well-established conceptual rainfall-runoff model paired with a snow routine; the LSTM approach performed better, and a single model trained across many catchments could predict discharge for a variety of them, with process understanding learned at regional scale transferring to individual catchments and improving on a model trained on one catchment alone.⁠[16] The advantage is not that the network knows any hydrology but that its memory can span the lag between cause and effect.

Forecasting can also be used to correct a model rather than replace it. In a Korean lake, an LSTM was trained not to predict inflow directly but to predict the residual errors of a physically based hydrological model, and the hybrid scored better than either the physical model alone or the LSTM alone, with a percent bias of 1.75 against 17.36 for the LSTM-only version.⁠[17] The physical model supplies the constraints of real-world water balance; the network supplies the correction that the equations miss. The same logic, a network wrapped around an existing model, recurs in the applications covered later in this chapter.

Climate variables follow the same pattern of short-term fluctuation on top of slower structure. An LSTM built from two recurrent layers and three dense layers, trained on historical records for Delhi, captured the temporal dependencies in daily temperature, precipitation and humidity and forecast short-term trends with satisfactory accuracy for temperature.⁠[18] The result is modest and local, which is appropriate: a sequence model trained on one city's history learns that city's rhythms, not a general theory of weather.

The reach of the method extends past prices and weather to the slow degradation of physical equipment. The state of charge of a lithium-ion battery, the fraction of its capacity currently available, is not measured directly and must be inferred from voltage and current as they change over time. An LSTM trained on such recordings estimated it without any battery model or filtering scheme, reaching a mean absolute error of 0.573 percent at a fixed ambient temperature and 1.606 percent on data where the temperature rose from 10 to 25 degrees Celsius, with a single network handling the different conditions.⁠[19] The related task of predicting remaining useful life, how many charge cycles a cell has left before it fails, was likewise framed as learning long-term dependencies among successive capacity measurements, and the resulting predictor was compared against a support vector machine, a particle filter and a simple recurrent network.⁠[8] Both cases share the structure of every application in this section: a quantity that evolves gradually, whose present value is only interpretable in light of its history, and a memory that can hold that history across many steps.

Forecasting is where the LSTM's central promise is easiest to see: the future value depends on a past that the gates have chosen to keep.

LSTM in healthcare and activity recognition

Reading medical images as sequences

A green three-dimensional diagram of a smartphone's internal board, with labeled components including an accelerometer, gyroscope, electronic compass, pressure sensor, baseband, CPU/GPU module, camera module, and microprojector.
A green three-dimensional diagram of a smartphone's internal board, with labeled components including an accelerometer, gyroscope, electronic compass, pressure sensor, baseband, CPU/GPU module, camera module, and microprojector. View full-size image.Mobile Device Sensors by Intel Free Press. CC BY 2.0, via Wikimedia Commons. Scaled to 960 pixels wide; no crop or other changes by Atlas Nova.

Medical images are usually handled by convolutional networks, which are built for spatial patterns, but much clinical data arrives as a series: a run of frames from a video study, a stream of readings from a monitor, a patient's record over months. The LSTM's memory suits this second kind of data, and reviews of deep learning in medical image analysis treat it that way, describing the LSTM as a specialized recurrent network that preserves long-term dependencies and learns temporal patterns in sequential medical image data, useful for video analysis and time-series processing. The same reviews place LSTM models alongside convolutional networks, generative adversarial networks and hybrid designs as one of the standard architectures in the field.⁠[5] The role is complementary rather than competing: the convolutional part finds what is in each frame, and the recurrent part relates one frame to the next.

Recognizing activity from a phone in a pocket

Human activity recognition is the task of naming what a person is doing from the signals of motion sensors, and it is a natural fit for a memory. A smartphone's accelerometer and gyroscope report three axes of motion many times a second, and no single reading distinguishes walking from standing; only the shape of the signal over a second or two does. Traditional methods met this by hand-crafting features such as means and correlations over sliding windows, an approach limited by the designer's knowledge of the domain, which struggles to separate activities with similar patterns, such as standing and sitting.⁠[7] A deep network instead learns its own features from the raw signal, and an LSTM adds the ability to track how those features unfold in time.

Four baseline LSTM networks were comparatively studied on a public smartphone dataset, and a hybrid was proposed: a 4-layer CNN-LSTM combining CNN layers to learn spatial features with an LSTM layer to learn temporal representation. Evaluated under several validation protocols, with Bayesian optimization used to tune the hyperparameters of each LSTM network, the proposed 4-layer CNN-LSTM improved average recognition accuracy by up to 2.24 percent compared to prior state-of-the-art approaches.⁠[7] The gain is small in absolute terms, which is itself instructive: on a well-studied dataset the recurrent layer is refining an already strong result rather than transforming it, and the convolutional front end is doing much of the work.

Watching a driver, and reading a patient's record

The same logic applies wherever a person's state must be inferred from a stream of behaviour. Driver distraction is one such case: steering and head-tracking signals carry a long-range temporal context, since a glance away from the road unfolds over seconds and its significance depends on what came before. An LSTM modelling that context detected inattention reliably across different drivers, with an accuracy of up to 96.6 percent, and outperformed conventional approaches such as support vector machines.⁠[4] The subject-independent result is the notable part, because it means the network learned patterns of distraction rather than the habits of particular individuals.

Electronic health records present the sequence problem at a larger scale. A patient's history is a long, irregular series of diagnoses, laboratory results, prescriptions and notes, and summarizing it in a form a model can use is the task of patient representation learning, which aims to encode meaningful information from the record into a dense mathematical representation. A systematic review of this field found recurrent neural networks to be widely applied as the deep learning architecture, with the LSTM used in 13 of the 49 included studies and the gated recurrent unit in 11, and disease prediction the most common application and evaluation, in 31 studies. The review also noted that benchmark datasets were mostly unavailable, in 28 of the studies, because of privacy concerns about health records.⁠[20] That absence of shared data is a constraint the clinical applications share with few other domains, and it shapes how quickly results can be compared and built upon.

In healthcare and activity recognition the LSTM rarely works alone; it supplies the memory for a stream, while a convolutional front end or an existing record system supplies the rest.

Research

Evidence on performance: comparisons and benchmarks

Comparing the cell against its neighbours

Three sensor windows feed CNN blocks, feature vectors, and a connected LSTM chain ending in an activity classifier.
Shared convolutional filters extract features from successive sensor windows. An LSTM carries temporal context across the windows before activity classification; the traces and running output are illustrative. View full-size image.Convolutional Features Meet Recurrent Memory by Atlas Nova. Illustration generated with AI for this article and checked against its text.

Claims about an architecture are only as good as the comparisons behind them, and the LSTM has been compared many times, against the recurrent units it replaced and against the units invented after it.

The most direct comparison is with the ordinary recurrent unit. In the paper that introduced the architecture, the LSTM was set against real-time recurrent learning, backpropagation through time, recurrent cascade correlation, Elman nets and neural sequence chunking on artificial problems with noisy, real-valued patterns. It produced many more successful runs, learned faster, and solved long-time-lag tasks that none of the earlier algorithms had solved.⁠[1] That result is the foundation of every later claim, because it isolates the unit: same data, same era of training methods, different cell.

Speech and language

Speech recognition offered an early test at realistic scale. When LSTM, ordinary recurrent and deep feedforward acoustic models were trained and compared across a range of sizes and configurations, the LSTM models converged quickly and gave state-of-the-art recognition performance even at relatively small model sizes.⁠[11] A later evaluation on a reduced version of a public speech corpus put RNN, LSTM and GRU side by side and measured word error rates. The LSTM achieved the best word error rates, while the gated recurrent unit reached word error rates close to it and optimised faster.⁠[21] The pairing of those two findings is the honest summary of the speech evidence: the memory matters, and the simpler version of it is often nearly as good at lower cost.

Text labelling produced a broader benchmark. A generic LSTM combined with a conditional random field was tested on 33 data sets spanning five entity classes, against the best entity-specific tools and against a conditional random field using the same word embeddings without the recurrent layer. It had the best score on 28 of the 33 cases, averaging five percent above the entity-specific tools and three percent above the embedding-only version, with most of the gain coming from recall.⁠[13] The size of that margin is worth pausing on. Five points of average improvement across dozens of corpora is a large effect in a field where tools are tuned for years, and the fact that it came from a method agnostic to entity type is what made it notable.

Forecasting: where the ranking flips

Forecasting has produced the most contradictory comparisons, which makes it the most instructive. During the COVID-19 pandemic, statistical, machine-learning and deep-learning forecasters were trained on 110 days of data for ten countries and tested on the following 48. The statistical and kernel-regression baselines failed to follow the trend, and among the recurrent models the bidirectional LSTM was the most accurate, with its lowest errors on deaths in China at a mean absolute error of 0.0070 and a root mean square error of 0.0077.⁠[3] Here the ordering ran bidirectional LSTM first, then LSTM, then the gated recurrent unit, then the older methods.

Cryptocurrency prices told a different story twice over. In another study on the same three cryptocurrencies, the ordering reversed: the bidirectional LSTM was the most accurate, with mean absolute percentage errors of 0.036, 0.041 and 0.124 for Bitcoin, Litecoin and Ethereum.⁠[15] Two teams, the same assets, opposite conclusions about which unit wins.

The lesson is not that one study must be wrong. Forecast accuracy depends on the training window, the preprocessing, the hyperparameters and the evaluation period, and a difference of a few percent in error can swing either way when those choices change. A benchmark ranks the specific configurations that were run, not the architectures in the abstract. Reading such tables as a league table of cells overstates what a single comparison can show.

Sensor data and the value of a hybrid

Activity recognition from wearable sensors has been used to test not just the cell but the arrangement around it. A deep framework stacked convolutional layers, which extract features from raw sensor windows, in front of LSTM layers that model how those features unfold, and evaluated it on a public challenge dataset and a second open dataset. Against the best submissions to the challenge, which used sliding windows with engineered features, the combined model improved performance by six percent on average, and by more than nine percent on the gesture task when the dominant null class was excluded; it also beat a convolutional network alone by six percent on average, and improved the best reported result on the second dataset by six percent. The margin over the convolutional baseline is the informative number, because it isolates what the recurrent layer adds: the convolutional network can only relate inputs within the span of its kernels, while the memory carries context across the whole sequence, which showed up as fewer confusions between gestures that differ mainly in their order, such as opening and closing the same door.⁠[9]

A separate study on smartphone data reached a similar conclusion with a smaller gain, reporting that a four-layer convolutional plus LSTM hybrid improved average accuracy by up to 2.24 percent over prior state-of-the-art approaches.⁠[7] Two studies, two datasets, gains in the same direction but of different size, which is what a real effect looks like when it is measured under different conditions.

Generative chemistry

Drug design asked a different question: not whether the model classifies better, but whether it can produce something useful. A generative recurrent model with three stacked LSTM layers was trained on a large set of drug-like molecules and then sampled. Of the lines it produced, 97.7 percent parsed as valid molecules, and after removing duplicates and structures already seen in training, 847,955 novel molecules remained; when an industrial screening filter was applied, 75 percent were flagged as suitable for a screening collection, the same proportion seen in the training collection. The comparison that matters is against chance: after fine-tuning on known actives against the malaria parasite, the model reproduced 28 percent of 1,240 held-out test molecules that medicinal chemists had designed, an enrichment over random of 66.9.⁠[2]

A second generative study, using a different LSTM implementation, reported that its model captured the syntax of molecular strings with close to perfect accuracy, and that fine-tuning shifted generated molecules measurably toward the known ligands for a target, with the average dissimilarity to known inhibitors falling from 0.425 to 0.375 for one target and from 0.440 to 0.409 for another, both statistically significant.⁠[22] Neither study shows the network designing a drug. What they show is that the memory can learn the grammar of a symbolic language well enough to produce valid, novel strings in enormous quantity, which is the prerequisite for any use in design.

Benchmarks rank configurations, not architectures. The LSTM reliably beats the plain recurrent unit it was built to replace; against its successors and against hybrid arrangements, the winner depends on the task and the tuning.

Strengths and successes

Why the memory holds

Three sensor windows feed convolutional feature extractors and three linked LSTM steps, with the last step feeding a walking classifier.
An illustrative sensor pipeline combines local feature extraction with memory across successive windows. The final hidden state feeds an activity classifier. View full-size image.Convolution and LSTM Activity Recognition by Atlas Nova. Illustration generated with AI for this article and checked against its text.

The central strength of an LSTM follows directly from the design covered earlier in this chapter: the cell state gives the learning signal a path that does not shrink or explode as it travels backwards through time. That is what allows the network to depend on events separated by long stretches of sequence rather than only on the last few items it saw. The original experiments made the point in the sharpest possible form. With the gradient truncated where doing so does no harm, the network learned to bridge minimal time lags in excess of 1000 discrete-time steps, and it solved long-time-lag problems that earlier recurrent algorithms had never solved.⁠[1] A thousand steps is not a modest gap. It means the network can, in principle, connect a cause to an effect that arrives a very long way downstream, which is the situation in speech, in sensor streams, and in any record where the meaning of the present depends on something that happened well before it.

That capacity is not merely theoretical, because the same property that lets the memory span long gaps also makes it forgiving of messy input. A gate that has learned to hold a useful value can keep holding it while irrelevant readings arrive and are discarded, so noise in the middle of a sequence does not necessarily corrupt what was stored at the start. This is why the architecture has proved durable across domains that share little except their sequential character, and why the applications covered later in this chapter keep returning to the same underlying advantage.

Learning the grammar of molecules

Drug design offers a clear case of the memory learning a symbolic language. Molecules are written as SMILES strings, linear text encodings in which each character or group of characters stands for an atom or a bond, and a string is valid only if it obeys the grammar of the notation. A generative model built from three stacked LSTM layers was trained on a large set of drug-like molecules and then asked to produce new strings one symbol at a time; when its output was sampled, 97.7 percent of the generated lines parsed as valid molecules rather than malformed text.⁠[2] A separate LSTM-based generative model captured the syntax of the representation with close to perfect accuracy.⁠[22] The network had not been given the rules of the notation. It learned them from examples, because the memory could hold the constraints established earlier in a string while the later characters were being chosen.

The consequence is that a chemist can be handed a large set of novel, syntactically well-formed structures to consider, which is the prerequisite for any computational design effort. A study using an LSTM-based generative model showed that fine-tuning on a set of known ligands shifted its output toward the chemical neighbourhood of those compounds, so the learned grammar could be aimed at a target rather than left general.⁠[22] What the memory contributes is the ability to keep a whole string coherent from first character to last, which is exactly what a language model of chemistry requires.

Finding attacks in network traffic

Intrusion detection applies the same coherence to a different kind of sequence. Network traffic can be treated as a time series of connection records, and an attack often reveals itself not in a single record but in a pattern spread across consecutive ones. An LSTM trained on the KDD Cup '99 benchmark, a standard dataset of labelled network connections, was evaluated on its ability to pick out malicious traffic from genuine traffic. It reached 93.82 percent accuracy at a cost of 22.13, and in doing so outperformed the winning entries of the original competition by a wide margin. The reason given for the gain is the one this section has been building toward: the network learned to look back in time and correlate consecutive connection records, which a classifier that judges each record on its own cannot do.⁠[23] The finding was reported as the first demonstration that LSTM networks are useful for intrusion detection, and it rests on the memory rather than on any feature a person designed.

Separating one voice from a crowd

Speech separation is the task of isolating a single speaker's voice from a recording that mixes several, and it is hard precisely because the cues are spread over time. A separation model based on an LSTM was trained to estimate which parts of a mixed signal belong to the target speaker, and it was then tested on speakers and on noises it had not encountered during training. It substantially outperformed a deep feedforward network on both unseen speakers and unseen noises, measured by objective speech intelligibility, and analysis of its internal representations showed that it was capturing long-term speech contexts. The model was also more effective for low-latency separation: without any future frames to look at, it still did better than the feedforward model that was allowed to see frames ahead.⁠[24] That last comparison is the telling one, because it isolates the memory. The feedforward network had more information available at each moment and still lost, while the recurrent network made better use of the past it had already heard.

Strength in combination

The architecture's successes rarely come from the cell working alone. A recurrent layer supplies memory for a stream, and other components supply what the memory cannot. A separate study on smartphone data built a four-layer convolutional plus LSTM hybrid and reported that it improved average recognition accuracy by up to 2.24 percent over prior state-of-the-art approaches.⁠[7] In both cases the gain came from the pairing: the convolutional front end finds what is present in each moment, and the memory relates one moment to the next. The same habit of wrapping the cell in a larger system runs through the applications covered later in this chapter, and it is a large part of why the architecture has remained useful for so long.

The LSTM's strengths are one strength seen from several angles: a memory that can hold what matters across long gaps, keep it through noise, and hand it to whatever other component the task requires.

Risks and limits

Limitations and challenges

The memory that makes an LSTM useful is also what makes it expensive. Every step of a sequence requires computing three or four gates, each a full set of weighted sums over the input and the previous hidden state, and the cell state must be carried and updated alongside them. The original design kept this cost modest, with computational complexity per time step and weight of order one.⁠[1]

Three LSTM blocks exchange labeled hidden and cell states above a staircase of three nonoverlapping computation intervals.
Each LSTM step passes its hidden and cell states to the next step. The staircase illustrates the ordered recurrent computations that limit parallelism across time. View full-size image.Sequential Dependencies Between LSTM Steps by Atlas Nova. Illustration generated with AI for this article and checked against its text.

A model with three stacked LSTM layers of 1024 dimensions, as used in one de novo drug design study, had 21.3 × 10^6 parameters.⁠[2] The arithmetic is not the only constraint. The gates need the previous step's output before they can compute the current one, so the work cannot be spread freely across parallel hardware the way a feedforward network's can; the sequence has to be walked in order. Reviews of the architecture for time series prediction note that practical implementations demand extensive datasets and substantial computational resources, and a study of speech recognition describes the concrete version of the problem: a standard cell needs four linear layers per cell with a large memory bandwidth for each time step, and the system cannot supply enough bandwidth to feed the computational units when input arrives continuously.⁠[10][25]

That last point concerns a specific weakness rather than raw speed. An LSTM assumes, in effect, that a sequence has a beginning and an end, so that its state can be reset between examples. Continual input streams are not segmented that way, and Gers and colleagues identified what happens when they are not: without resets the state may grow indefinitely and eventually cause the network to break down. Their forget gate was the remedy, letting a cell learn to reset itself at appropriate times, and LSTM with forget gates easily solves the continual versions of these problems.⁠[6] The speech work above attacks the same problem from a different angle, incorporating the RNN as a forget gate to the memory block so that cell states can be reset at the start of sub-sequences, enabling continuous input streams to be processed without necessarily increasing the required bandwidths.⁠[25]

Very long sequences raise a related difficulty. The gates mitigate the vanishing gradient but do not abolish the problem of scale: the further back a dependency lies, the more steps the learning signal must cross and the more chances there are for it to be diluted or for an unrelated input to overwrite what was stored. A memory that is managed is still finite, and what it holds at any moment is a compressed impression of the past rather than a record of it.

The architecture also has limits that have nothing to do with length. An LSTM trained purely as a language model, predicting the next word, turned out to capture syntax-sensitive dependencies poorly: errors rose sharply in the language-modeling setting, even though in strongly supervised settings the same network achieved less than 1% errors overall, with errors increasing when sequential and structural information conflicted.⁠[12] The memory can hold structure, but it does not reliably learn structure from an indirect objective, and getting it to do so requires supervision aimed at the thing being tested.

Training itself is slow and sensitive to choices made before it begins. Because the backward pass runs through every step of the sequence, a single update costs far more than in a feedforward network, and the settings that govern learning, the learning rate, the depth of the stack, the dropout rate, the width of each layer, interact in ways that are not obvious in advance. A study of smartphone activity recognition used Bayesian optimization to tune the hyperparameters of each of its LSTM networks.⁠[7] A survey of LSTM architectures for time series prediction evaluated candidate designs against requirements such as short-term and long-term memory behaviour, multi-step-ahead prediction and error propagation, and found that sequence-to-sequence networks with partial conditioning outperform the other approaches and are best suited to fulfill the requirements.⁠[26] Choosing an architecture is part of the modelling problem, not a preliminary to it.

Finally, the LSTM is not always the right tool, and the evidence for that comes from comparisons the architecture's own advocates would accept. A gated recurrent unit was found to be comparable to the LSTM on polyphonic music modelling and speech signal modelling.⁠[27] On a reduced speech corpus, the LSTM achieved the best word error rates of the three units tested, but the gated recurrent unit optimised faster while reaching word error rates close to it.⁠[21] Where the task is short, the data plentiful and the pattern simple, a smaller model may do as well at a fraction of the cost, and a recurrent network at all may be more machinery than the problem requires. The question worth asking before reaching for a memory is whether the dependence actually spans time; if it does not, the gates have nothing to decide.

The LSTM's costs are the price of its memory: sequential computation, careful tuning, and a state that must be told when to start over.

Later developments

Variants and successors

The cell described earlier in this chapter is a template, not a fixed product. Once the idea of a gated memory was established, designers began rearranging it: running it in two directions, stripping it down, bolting it onto other kinds of network, and letting it decide where in a sequence to look. Each variant keeps the same core bargain, a state that is carried forward and modified through learned gates, and changes what surrounds it.

Three inputs feed opposing chains of LSTM cells whose outputs converge at three concatenation nodes.
Separate forward and backward networks process the same inputs. Their outputs are concatenated at each position to incorporate earlier and later context. View full-size image.Bidirectional LSTM Data Flow by Atlas Nova. Illustration generated with AI for this article and checked against its text.

The simplest change is direction. A bidirectional LSTM (Bi-LSTM) runs two copies of the network over the same sequence, one reading forward and one reading backward, and combines their outputs at each position, so the representation of any moment draws on what came before it and what came after. This is only possible when the whole sequence is available at once, which rules out live streaming but suits offline analysis of a complete record. The variant has been used repeatedly in forecasting, and its results have been mixed in an instructive way.

In a comparison of forecasters for COVID-19 cases, deaths and recoveries across ten countries, the bidirectional version outperformed the other models tested, with its lowest errors on deaths in China at a mean absolute error of 0.0070 and a root mean square error of 0.0077.⁠[3] On cryptocurrency exchange rates, one study found the bidirectional LSTM the most accurate of three recurrent variants, with mean absolute percentage errors of 0.036, 0.041 and 0.124 for Bitcoin, Litecoin and Ethereum, while another study on the same three coins ranked it last of the three.⁠[15][28] Reading in both directions is a genuine capability, but whether it helps depends on the data and the tuning, a point the chapter's comparison section takes up.

The gated recurrent unit (GRU) goes the other way, toward less machinery. The question is whether anything is lost. A direct comparison of recurrent units on polyphonic music modelling and speech signal modelling found that these gated units were indeed better than the more traditional tanh units, and that the GRU was comparable to the LSTM.⁠[27] A later evaluation on a reduced speech corpus measured word error rates for three units and found the LSTM best, with the GRU optimising faster while reaching word error rates close to it.⁠[21] The pattern across both is consistent: the leaner unit gives up little in accuracy and gains in training speed, which makes it attractive when compute or latency is the binding constraint.

A third family changes what the memory is fed. A CNN-LSTM hybrid places convolutional layers in front of the recurrent ones, so that the convolutional part extracts features from each window of raw input and the LSTM models how those features unfold across windows. The division of labour is the appeal: convolution is good at finding local patterns and can be computed in parallel, while the recurrent layer supplies the temporal thread that convolution alone cannot carry beyond the span of its kernels. In activity recognition from wearable sensors, a framework of convolutional layers followed by LSTM layers improved on the best submissions to a public challenge by six percent on average, and improved on CNNs by five percent on average on that dataset.⁠[9] A study on smartphone data built a four-layer convolutional plus LSTM design and reported an improvement in average recognition accuracy of up to 2.24 percent over prior state-of-the-art approaches.⁠[7] The margins differ, but the direction is the same, and the comparison against convolution alone is the one that isolates what the memory adds.

Attention changes where the network looks rather than how it remembers. An attention mechanism computes a weight for each position in the sequence, reflecting how relevant that position is to the output being produced, and forms a weighted summary that emphasises the relevant parts. Wrapped around an LSTM, it lets the model draw on the whole run of hidden states rather than relying only on the final one. In stock price forecasting, a model combining an attention mechanism with an LSTM and a wavelet denoising step was compared against a plain LSTM, a denoised LSTM and a gated recurrent unit across three market indices; on two of them the attention model's coefficient of determination exceeded 0.94 and its mean square error stayed below 0.05.⁠[29] Credit card fraud detection offers a different use: there the sequential nature of transactions is modelled with an LSTM and attention is used to identify which transactions in a sequence matter most for flagging fraud, combined with a dimensionality-reduction step for feature selection.⁠[30] In both cases the memory supplies the sequence of states and attention decides which of them to weigh.

The Grid LSTM rearranges the cells themselves. Rather than stacking layers only, it arranges LSTM cells in a multidimensional grid and connects them both between layers and along the dimensions of the data, so that the same machinery handles depth and sequence together. Applied to algorithmic tasks such as fifteen-digit integer addition and sequence memorisation, it significantly outperformed the standard LSTM, and a two-dimensional version reached 1.47 bits per character on a Wikipedia character prediction benchmark, state of the art among neural approaches at the time.⁠[31] The design is a reminder that the cell is a component: its arrangement, not just its internals, is part of the model.

Attention-based architectures, such as Transformer models, process a whole sequence in parallel rather than step by step.⁠[32] That shift, and the work aimed at making recurrent models faster, more interpretable and easier to combine with other designs, is covered later in this chapter.

The variants are answers to one question: given a memory that works, what should be put in front of it, behind it, or alongside it?

Current directions and open problems

Making the memory cheaper

Two four-by-four binary masks connected by an arrow compare a dense matrix of ones with a sparse matrix containing seven ones and nine zeros.
Illustrative weight masks compare 16 retained connections with 7 retained connections. Sparse connectivity can reduce computation, but speed and prediction quality require evaluation. View full-size image.Sparse Connectivity Reduces Retained Weights by Atlas Nova. Illustration generated with AI for this article and checked against its text.

The costs described earlier in this chapter, a sequential walk through every step and a full set of gate computations at each one, have drawn steady attempts to reduce them without giving up the memory. One line of work changes the connectivity inside the cell rather than the cell's logic. A variant called RCLSTM introduces stochastic connectivity into conventional LSTM neurons, so that the network exhibits a certain level of sparsity. Sparsity lowers the number of operations per step, and on a realistic telecommunications dataset the sparse version reached prediction performance comparable to a standard LSTM while requiring considerably less computing time.⁠[33] The trade is the familiar one. What the design buys is speed for settings where latency or power is the binding constraint, and what it risks is the loss of some connections that might have mattered, which is why the comparison against the full network is the number to watch rather than the speed alone.

Borrowing strength from other architectures

A second direction treats the LSTM less as a standalone model than as one component among several, chosen for what it does best. The clearest example pairs it with a Transformer, the attention-based architecture that processes a whole sequence in parallel rather than step by step. In a hybrid built for sentiment analysis, a RoBERTa model mapped words into a compact embedding space while an LSTM layer captured the long-distance contextual semantics; on IMDb, Twitter US Airline Sentiment, and Sentiment140 the combination reached F1 scores of 93 percent, 91 percent, and 90 percent, above the state-of-the-art methods it was compared with.⁠[32] The division of labour is the point: the parallel part handles representation and the recurrent part handles order, and neither is asked to do the other's job. The same habit of embedding the cell in a larger pipeline runs through the forecasting and sensor work covered earlier in this chapter, and it is likely to remain the common form.

New domains and borrowed ideas

The architecture also keeps finding domains where the data arrives as a sequence and the dependence spans time. Hydrological forecasting is one: a review of recurrent designs for water-related prediction notes that traditional models struggle with the nonlinear, time-varying behaviour of such systems, and that attention mechanisms and hybrids combining recurrent layers with other machine-learning components have improved accuracy by capturing both temporal and spatial dependencies. The same review is candid about the price, observing that practical implementations demand extensive datasets and substantial computational resources.⁠[10] A related strand takes ideas in the other direction, from biology into the model. Networks of spiking neurons, which mimic the timing-based signalling of real neurons, have historically lagged artificial networks in computing and learning capability; adding adapting neurons that reproduce a dynamical process of biological neurons at the scale of seconds, and training the network with backpropagation through time combined with a rewiring algorithm, brought such a network's performance to approach that of an LSTM for the first time, and let it acquire abstract knowledge from prior learning and transfer it to new but related tasks from very few examples.⁠[34] The traffic here runs both ways, with the gated memory serving as the benchmark that biologically inspired designs are measured against.

The problems that remain

Two obstacles recur across applications and are not solved by a better cell. The first is interpretability. A review of deep learning on electronic health record data found that models built from those records can excel at recognising diseases and predicting clinical events from time series such as biosignals, while noting that bringing such models into real use requires users to understand the mechanisms by which they operate, a level of transparency that current efforts at explanation still struggle to reach.⁠[35]

The second is data. The same review points to a continuing need to improve the quality of generated data and labels, and warns that deep models often do not explicitly capture uncertainty, which makes them less robust when the underlying data distribution shifts and creates a risk that real records invalidate a deployed model's future predictions.⁠[35] A systematic review of patient representation learning found the same gap from another angle: benchmark datasets were unavailable in 28 of the 49 studies it examined, because of privacy concerns about health records.⁠[20] Without shared data, results cannot be readily compared, and progress depends on each group's private sample.

Time series prediction remains the setting where these questions are most actively pursued, and a survey of LSTM architectures for that task evaluates candidate designs against explicit requirements, including short-term and long-term memory behaviour, the ability to make multimodal and multi-step-ahead predictions, and how errors propagate through the network.⁠[26] Framing the problem that way makes clear that architecture choice is part of the modelling rather than a preliminary to it.

The open problems are no longer about whether a gated memory can hold information across time, but about making that memory cheap enough, transparent enough, and well enough supported by data to trust in settings where the stakes are high.

Key studies

YearStudySampleDesignFinding
2011Wollmer et al.⁠[4]driving and head tracking dataonline driver distraction detection with LSTMThe LSTM framework reached up to 96.6% accuracy and significantly outperformed support vector machines.
2016Linzen et al.⁠[12]English subject-verb dependencies in a corpussupervised number prediction and language modeling with an LSTMThe LSTM made incorrect number predictions in only 0.83% of dependencies under strong supervision, but errors rose sharply in language modeling.
2016Ordóñez & Roggen⁠[9]two datasets, one from a public activity recognition challengedeep convolutional and LSTM framework for wearable activity recognitionThe framework outperformed competing deep non-recurrent networks by 4% on average and some previous results by up to 9%.
2017Habibi et al.⁠[13]33 data sets covering five entity classesLSTM-CRF against best-of-class NER tools and a CRFLSTM-CRF reached an average F1-score of 81.11%, above 78.04% for the CRF and 76.61% for baselines.
2018Kratzert et al.⁠[16]241 catchments of the CAMELS data setrainfall-runoff modeling with LSTM against SAC-SMA plus Snow-17The LSTM achieved better model performance than SAC-SMA plus Snow-17.
2019Shewalkar et al.⁠[21]a reduced TED-LIUM speech data setcomparison of RNN, LSTM and GRU on speech recognitionLSTM achieved the best word error rates, while GRU optimized faster and came close.
2021Mekruksavanich & Jitpattanakul⁠[7]the public UCI-HAR smartphone datasetLSTM networks and a 4-layer CNN-LSTM for activity recognitionThe 4-layer CNN-LSTM improved average accuracy by up to 2.24% over prior state-of-the-art approaches.
2021Hamayel & Owda⁠[28]Bitcoin, Litecoin and Ethereum price datacomparison of GRU, LSTM and bi-LSTMGRU performed better than LSTM and bi-LSTM, with MAPE of 0.2454%, 0.8267% and 0.2116% for BTC, ETH and LTC.
2022Cho & Kim⁠[17]inflow of Soyangho Lake in South KoreaWRF-Hydro-LSTM against WRF-Hydro-only and LSTM-onlyWRF-Hydro-LSTM and LSTM-only reached NSE of 0.95 and R greater than 0.96, against 0.72 and 0.88 for WRF-Hydro-only.
2022Oruh et al.⁠[25]a public spoken English digit datasetLSTM-RNN against CNN-based and sequential modelsThe LSTM-RNN reached 99.36% accuracy, above DenseNet-121 at 89.67% and DenseNet-169 at 87.17%.
2023Seabe et al.⁠[15]three major cryptocurrencies: Bitcoin, Ethereum and Litecoincomparison of LSTM, GRU and Bi-LSTM for exchange rate predictionAcross the three cryptocurrencies, the bi-directional LSTM gave the lowest error of the three models tested, and its mean absolute percentage error was 0.036 for BTC, 0.041 for LTC and 0.124 for ETH.

See also

References

  1. Hochreiter, S., & Schmidhuber, J. (1997). Long Short-Term Memory. Neural Computation, 9(8), 1735-1780. doi:10.1162/neco.1997.9.8.1735
  2. Segler, M. H. S., Kogej, T., Tyrchan, C., & Waller, M. P. (2018). Generating Focused Molecule Libraries for Drug Discovery with Recurrent Neural Networks. ACS Central Science, 4(1), 120-131. doi:10.1021/acscentsci.7b00512
  3. Shahid, F., Zameer, A., & Muneeb, M. (2020). Predictions for COVID-19 with deep learning models of LSTM, GRU and Bi-LSTM. Chaos, Solitons & Fractals, 140, 110212. doi:10.1016/j.chaos.2020.110212
  4. Wollmer, M., Blaschke, C., Schindl, T., Schuller, B., Farber, B., Mayer, S., & Trefflich, B. (2011). Online Driver Distraction Detection Using Long Short-Term Memory. IEEE Transactions on Intelligent Transportation Systems, 12(2), 574-582. doi:10.1109/tits.2011.2119483
  5. Li, M., Jiang, Y., Zhang, Y., & Zhu, H. (2023). Medical image analysis using deep learning algorithms. Frontiers in Public Health, 11. doi:10.3389/fpubh.2023.1273253
  6. Gers, F. A., Schmidhuber, J., & Cummins, F. (2000). Learning to Forget: Continual Prediction with LSTM. Neural Computation, 12(10), 2451-2471. doi:10.1162/089976600300015015
  7. Mekruksavanich, S., & Jitpattanakul, A. (2021). LSTM Networks Using Smartphone Data for Sensor-Based Human Activity Recognition in Smart Homes. Sensors, 21(5), 1636. doi:10.3390/s21051636
  8. Zhang, Y., Xiong, R., He, H., & Pecht, M. G. (2018). Long Short-Term Memory Recurrent Neural Network for Remaining Useful Life Prediction of Lithium-Ion Batteries. IEEE Transactions on Vehicular Technology, 67(7), 5695-5705. doi:10.1109/tvt.2018.2805189
  9. Ordóñez, F., & Roggen, D. (2016). Deep Convolutional and LSTM Recurrent Neural Networks for Multimodal Wearable Activity Recognition. Sensors, 16(1), 115. doi:10.3390/s16010115
  10. Waqas, M., & Humphries, U. W. (2024). A critical review of RNN and LSTM variants in hydrological time series predictions. MethodsX, 13, 102946. doi:10.1016/j.mex.2024.102946
  11. Sak, H., Senior, A., & Beaufays, F. (2014). Long Short-Term Memory Based Recurrent Neural Network Architectures for Large Vocabulary Speech Recognition. arXiv. doi:10.48550/arxiv.1402.1128 Free full text
  12. Linzen, T., Dupoux, E., & Goldberg, Y. (2016). Assessing the Ability of LSTMs to Learn Syntax-Sensitive Dependencies. Transactions of the Association for Computational Linguistics, 4, 521-535. doi:10.1162/tacl_a_00115
  13. Habibi, M., Weber, L., Neves, M., Wiegandt, D. L., & Leser, U. (2017). Deep learning with word embeddings improves biomedical named entity recognition. Bioinformatics, 33(14), i37-i48. doi:10.1093/bioinformatics/btx228
  14. Bao, W., Yue, J., & Rao, Y. (2017). A deep learning framework for financial time series using stacked autoencoders and long-short term memory. PLOS ONE, 12(7), e0180944. doi:10.1371/journal.pone.0180944
  15. Seabe, P. L., Moutsinga, C. R. B., & Pindza, E. (2023). Forecasting Cryptocurrency Prices Using LSTM, GRU, and Bi-Directional LSTM: A Deep Learning Approach. Fractal and Fractional, 7(2), 203. doi:10.3390/fractalfract7020203
  16. Kratzert, F., Klotz, D., Brenner, C., Schulz, K., & Herrnegger, M. (2018). Rainfall–runoff modelling using Long Short-Term Memory (LSTM) networks. Hydrology and Earth System Sciences, 22(11), 6005-6022. doi:10.5194/hess-22-6005-2018
  17. Cho, K., & Kim, Y. (2022). Improving streamflow prediction in the WRF-Hydro model with LSTM networks. Journal of Hydrology, 605, 127297. doi:10.1016/j.jhydrol.2021.127297
  18. Xu, J., Wang, Z., Li, X., Li, Z., & Li, Z. (2024). Prediction of Daily Climate Using Long Short-Term Memory (LSTM) Model. International Journal of Innovative Science and Research Technology (IJISRT), 83-90. doi:10.38124/ijisrt/ijisrt24jul073
  19. Chemali, E., Kollmeyer, P. J., Preindl, M., Ahmed, R., & Emadi, A. (2018). Long Short-Term Memory Networks for Accurate State-of-Charge Estimation of Li-ion Batteries. IEEE Transactions on Industrial Electronics, 65(8), 6730-6739. doi:10.1109/tie.2017.2787586
  20. Si, Y., Du, J., Li, Z., Jiang, X., Miller, T., Wang, F., Jim Zheng, W., & Roberts, K. (2021). Deep representation learning of patient data from Electronic Health Records (EHR): A systematic review. Journal of Biomedical Informatics, 115, 103671. doi:10.1016/j.jbi.2020.103671
  21. Shewalkar, A., Nyavanandi, D., & Ludwig, S. A. (2019). Performance Evaluation of Deep Neural Networks Applied to Speech Recognition: RNN, LSTM and GRU. Journal of Artificial Intelligence and Soft Computing Research, 9(4), 235-245. doi:10.2478/jaiscr-2019-0006
  22. Gupta, A., Müller, A. T., Huisman, B. J. H., Fuchs, J. A., Schneider, P., & Schneider, G. (2018). Generative Recurrent Networks for De Novo Drug Design. Molecular Informatics, 37(1-2). doi:10.1002/minf.201700111
  23. Staudemeyer, R. C. (2015). Applying long short-term memory recurrent neural networks to intrusion detection. South African Computer Journal, 56. doi:10.18489/sacj.v56i1.248
  24. Chen, J., & Wang, D. (2017). Long short-term memory for speaker generalization in supervised speech separation. The Journal of the Acoustical Society of America, 141(6), 4705-4714. doi:10.1121/1.4986931
  25. Oruh, J., Viriri, S., & Adegun, A. (2022). Long Short-Term Memory Recurrent Neural Network for Automatic Speech Recognition. IEEE Access, 10, 30069-30079. doi:10.1109/access.2022.3159339
  26. Lindemann, B., Müller, T., Vietz, H., Jazdi, N., & Weyrich, M. (2021). A survey on long short-term memory networks for time series prediction. Procedia CIRP, 99, 650-655. doi:10.1016/j.procir.2021.03.088
  27. Junyoung, C., Gülçehre, Ç., Cho, K., & Bengio, Y. (2014). Empirical Evaluation of Gated Recurrent Neural Networks on Sequence Modeling. arXiv. doi:10.48550/arxiv.1412.3555 Free full text
  28. Hamayel, M. J., & Owda, A. Y. (2021). A Novel Cryptocurrency Price Prediction Model Using GRU, LSTM and bi-LSTM Machine Learning Algorithms. AI, 2(4), 477-496. doi:10.3390/ai2040030
  29. Qiu, J., Wang, B., & Zhou, C. (2020). Forecasting stock prices with long-short term memory neural network based on attention mechanism. PLOS ONE, 15(1), e0227222. doi:10.1371/journal.pone.0227222
  30. Benchaji, I., Douzi, S., El Ouahidi, B., & Jaafari, J. (2021). Enhanced credit card fraud detection based on attention mechanism and LSTM deep model. Journal of Big Data, 8(1). doi:10.1186/s40537-021-00541-8
  31. Kalchbrenner, N., Danihelka, I., & Graves, A. (2015). Grid Long Short-Term Memory. arXiv. doi:10.48550/arxiv.1507.01526 Free full text
  32. Tan, K. L., Lee, C. P., Anbananthen, K. S. M., & Lim, K. M. (2022). RoBERTa-LSTM: A Hybrid Model for Sentiment Analysis With Transformer and Recurrent Neural Network. IEEE Access, 10, 21517-21525. doi:10.1109/access.2022.3152828
  33. Hua, Y., Zhao, Z., Li, R., Chen, X., Liu, Z., & Zhang, H. (2019). Deep Learning with Long Short-Term Memory for Time Series Prediction. IEEE Communications Magazine, 57(6), 114-119. doi:10.1109/mcom.2019.1800155
  34. Bellec, G., Salaj, D., Subramoney, A., Legenstein, R. A., & Maass, W. (2018). Long short-term memory and learning-to-learn in networks of spiking neurons. arXiv. doi:10.48550/arxiv.1803.09574 Free full text
  35. Xiao, C., Choi, E., & Sun, J. (2018). Opportunities and challenges in developing deep learning models using electronic health records data: a systematic review. Journal of the American Medical Informatics Association, 25(10), 1419-1428. doi:10.1093/jamia/ocy068

Cite this page: Atlas Nova editors. (2026). Long short-term memory. Atlas Nova. https://velocer.io/atlas/long-short-term-memory/