---
title: "A Dual-Stage Attention-Based Recurrent Neural Network for"
description: "How dual-stage attention selects useful input series and time steps for prediction, with DA-RNN’s architecture, experiments, and limits."
canonical: "https://research.elamur.ai/free/en/papers/qin-2017-dual-stage-attention-based-recurrent/"
---
Elamur: [Mova](https://md.mova.elamur.ai/free/en/) · [Parse](https://mova.elamur.ai/free/en/parse/) · [Dictionary](https://md.dictionary.elamur.ai/free/en/) · [Translate](https://md.translate.elamur.ai/free/en/) · **Research** · [Gali](https://md.gali.elamur.ai/free/en/) · [MCP](https://mcp.elamur.ai/) · [Locations](https://md.locations.elamur.ai/free/en/) · [Weather](https://md.weather.elamur.ai/free/en/)

[Elamur Research](https://md.research.elamur.ai/free/en/) · [this page in HTML](https://research.elamur.ai/free/en/papers/qin-2017-dual-stage-attention-based-recurrent/)

[home](https://md.research.elamur.ai/free/en/) / [papers](https://md.research.elamur.ai/free/en/papers/) / [2017](https://md.research.elamur.ai/free/en/papers/2017/) / A Dual-Stage Attention-Based Recurrent Neural Network for Time Series Prediction

# A Dual-Stage Attention-Based Recurrent Neural Network for Time Series Prediction

Paper · 2017 · Yao Qin, Dongjin Song, Haifeng Chen et al.

**Authors:** [Yao Qin](https://md.research.elamur.ai/free/en/authors/yao-qin/), Dongjin Song, [Haifeng Chen](https://md.research.elamur.ai/free/en/authors/haifeng-chen/), [Wei Cheng](https://md.research.elamur.ai/free/en/authors/wei-cheng/), Guofei Jiang and [Garrison W. Cottrell](https://md.research.elamur.ai/free/en/authors/garrison-w-cottrell/) · **Year:** 2017 · **Venue:** International Joint Conference on Artificial Intelligence · **Licence:** [arXiv — non-exclusive license to distribute](http://arxiv.org/licenses/nonexclusive-distrib/1.0/)

[**1,585** citations OpenAlex, 2026-10-14](https://openalex.org/works?filter=cites:W2613328025) · [International Joint Conference on Artificial Intelligence](https://openalex.org/S4306419999) · [licence](http://arxiv.org/licenses/nonexclusive-distrib/1.0/)

- [PDF](https://arxiv.org/pdf/1704.02971)
- [DOI 10.24963/ijcai.2017/366](https://doi.org/10.24963/ijcai.2017/366)
- [arXiv 1704.02971](https://arxiv.org/abs/1704.02971)
- [OpenAlex](https://openalex.org/W2613328025)

Citations: OpenAlex, 2026-10-14.

## Deep dive: A Dual-Stage Attention-Based Recurrent Neural Network for Time Series Prediction

How dual-stage attention selects useful input series and time steps for prediction, with DA-RNN’s architecture, experiments, and limits. · about 33 minutes to read

**In this deep dive**

1. [Summary](#dd-summary)
2. [Ideas worth borrowing](#dd-ideas-worth-borrowing)
3. [How Mova uses it](#dd-how-mova-uses-it)
4. [The problem and its context](#dd-the-problem-and-its-context)
5. [The method, step by step](#dd-the-method-step-by-step)
6. [Experiments and results](#dd-experiments-and-results)
7. [What the ablations show](#dd-what-the-ablations-show)
8. [Limitations](#dd-limitations)
9. [What came after](#dd-what-came-after)

### Summary

Predicting a changing quantity becomes harder when many other quantities might help explain it. A room’s temperature has its own recent history, but it may also depend on measurements recorded elsewhere in the house. A stock index likewise has a history alongside the price histories of its constituent companies. The challenge is to decide which accompanying signals deserve attention and which parts of their recent history matter for the next prediction. This paper introduces DA-RNN, a recurrent neural network that makes these decisions at different stages of its computation.

The task belongs to nonlinear autoregressive prediction with exogenous inputs, abbreviated NARX. “Autoregressive” means that earlier values of the quantity being predicted are available. “Exogenous” identifies additional input series, which the paper also calls driving series. DA-RNN processes these driving series with an encoder and combines their encoded information with the target’s past values in a decoder. Its input attention mechanism assigns weights to driving series before their values enter the encoder. Its temporal attention mechanism then assigns weights to the encoder’s stored states, allowing the decoder to draw selectively on different positions in the observation window. Both mechanisms are learned together with the recurrent network.

The authors evaluate this design on indoor temperature prediction using SML 2010 and on prediction of the NASDAQ 100 index from company stock prices. They report that DA-RNN obtains the strongest MAE, MAPE, and RMSE results among the compared approaches across these datasets. Comparisons with versions that use only part of the attention scheme suggest that selecting input series and selecting historical states contribute separately. A further experiment adds randomly shuffled copies of the stock-price series. Under that condition, DA-RNN achieves MAE of 0.28 ± 0.007 and RMSE of 0.42 ± 0.009, while its input attention generally gives less weight to the shuffled signals.

The contribution is therefore an architecture for selective multivariate prediction, together with evidence about why its selection mechanisms help. The experiments support the usefulness of separating attention over input variables from attention over encoded time positions. They also provide a limited form of visibility into the network’s behavior: the learned weights show where it directs information during prediction. Those weights do not establish causal relationships, and the experiments do not demonstrate unrestricted long-range forecasting. The task assumes that the driving measurements at the target time are already available, while the target value itself remains unknown.

### Ideas worth borrowing

Separate selection decisions. DA-RNN treats the choice of input variable and the choice of historical position as different problems. A useful signal may be uninformative at some moments, while a useful moment may contain a mixture of relevant and irrelevant measurements. Assigning these decisions to different components gives each component a clearer role. This principle could guide other systems that receive information organized along several dimensions: first decide which channels deserve representation, then decide which stored representations matter for the current output.

Condition relevance on processing state. The input weights depend on the encoder’s previous hidden state and memory state. A driving series therefore receives a weight in the context of what the encoder has already processed. This is more flexible than assigning each series a permanent importance score. The reusable idea is to make relevance a function of the current computational situation. In another sequential system, the same source of information might become useful or distracting as the internal state changes.

Weight information before compressing it. Input attention scales the driving measurements before the recurrent encoder updates its state. This gives the network a chance to reduce the influence of distracting inputs before they become mixed into a shared representation. The distinction matters whenever a later stage cannot easily recover which original source contributed an unwanted component. An engineer can borrow the placement of the selection mechanism even when the surrounding encoder differs from the one used here.

Keep intermediate states available. Temporal attention lets the decoder consult the encoder’s history rather than relying completely on its final state. The final state must otherwise carry everything needed for prediction in a fixed-size representation. Retaining intermediate states creates a more direct route to information associated with particular parts of the input. This idea applies whenever a sequential encoder must support later decisions whose information requirements may differ across decoding steps.

Test selection with deliberately corrupted inputs. The shuffled-series experiment asks whether attention can distinguish useful inputs from signals whose temporal order has been disrupted. Prediction error alone would not reveal how the network handles the additional channels. Looking at both errors and attention weights gives a more informative diagnosis. Elsewhere, a controlled corruption can help determine whether a selection mechanism responds sensibly to a known change in input quality.

Explain a composite architecture through partial versions. The paper compares a basic encoder–decoder, a temporal-attention version, an input-attention version, and the full design. These comparisons connect the overall result to particular architectural choices. The broader lesson is methodological: when an approach contains several interacting mechanisms, evaluate meaningful intermediate versions. A strong final score becomes easier to understand when the experiments show which decisions improve it and under what conditions.

### How Mova uses it

For [Mova](https://md.research.elamur.ai/free/en/projects/mova/), the small transparent language system implemented in Rust, the most relevant contribution is the separation of attention over sources from attention over stored history. The paper studies numerical prediction, so applying its architecture to language would require a new task definition and new evidence. There is no established Mova implementation of DA-RNN described here. The connection is an architectural possibility, and it should remain identified as such.

A concrete adaptation would begin by defining what counts as an input channel. In this paper, a channel is an entire driving series, such as the price history of a company. In a language system, a proposed channel would need an equally explicit meaning. Candidate channels might represent distinct streams of linguistic evidence, provided Mova actually exposes such streams in its design. The important borrowing would be the decision structure: estimate the relevance of each available source before combining its contribution with the rest.

A separate mechanism could then decide which earlier internal states to consult. This would preserve the distinction that makes DA-RNN understandable. A source weight would describe the handling of an input stream, while a temporal weight would describe the selection of stored processing states. Combining these into an undifferentiated attention display would lose part of the paper’s useful decomposition. A transparent implementation would benefit from recording the identity of each source, the state used to compute its weight, and the weighted values passed onward.

The paper also suggests an evaluation pattern that could be useful for Mova. A proposed selection mechanism should be compared with a version that receives the same information without that mechanism. If source selection and history selection are both introduced, each should also be tested separately. Deliberately irrelevant or disrupted channels could provide a controlled check of whether the weights respond to input quality. These would be new Mova experiments inspired by the paper, rather than results inherited from it.

Rust is an implementation setting, not evidence that the architecture would work for language. Nor does exposing attention weights by itself make a system’s [reasoning](https://md.research.elamur.ai/free/en/topics/reasoning/) fully transparent. DA-RNN’s weights describe particular numerical routing decisions inside a trained predictor. For Mova, an honest use of the idea would retain that limited interpretation: make the selection operation inspectable, test whether it helps the intended task, and avoid treating its weights as a complete explanation of the output.

### The problem and its context

#### Prediction with a target history and supporting signals

The paper considers a common situation in time-series analysis: a quantity must be estimated from its own previous values and from other measurements observed over time. The quantity being predicted is the target series. The additional measurements are the driving series. Their usefulness depends on the relationship between their behavior and the target.

In the temperature experiment, the target is room temperature and the network receives other measurements collected in a house. In the financial experiment, the target is the NASDAQ 100 index and the driving inputs are company stock prices. These examples share the same computational structure even though the quantities have different meanings. Each observation window contains several synchronized input histories alongside the known portion of the target history.

The authors frame this as a NARX problem. A nonlinear mapping must combine information from the target’s earlier values with information from the driving inputs. The desired mapping need not be a simple weighted sum. Different series may interact, and the usefulness of a measurement may depend on what has happened elsewhere in the window.

The word “exogenous” needs a careful reading in this context. It identifies a series supplied as an additional predictor. It does not establish that the series is an independently manipulated cause of the target. The task is predictive: use the available observations to estimate the missing target value.

The timing assumption is equally important. DA-RNN receives driving inputs through the target time. Its target history stops before that time. It is therefore learning to estimate a current target from current and earlier driving observations, together with earlier target observations. A deployment that lacks the current driving measurements would present a different information problem.

#### What earlier approaches leave unresolved

The paper begins with autoregressive moving average methods and their extensions. In the authors’ account, these approaches have been effective in practical applications, but their usual forms do not express nonlinear relationships or distinguish among driving inputs in the way required here. The difficulty is not simply that a forecast depends on history. It is that the relevant history may involve several inputs whose roles differ.

The authors also discuss kernel methods, ensemble approaches, and Gaussian-process techniques for nonlinear prediction. Their criticism is that much of this work relies on a predetermined nonlinear form that may fail to represent the underlying relationship adequately. This motivates a more flexible learned mapping.

Recurrent neural networks offer such flexibility because their internal state changes as they process a sequence. Rather than treating an observation window as an unordered collection of values, a recurrent computation updates its representation across time. The paper cites earlier applications of recurrent networks to NARX forecasting as evidence that this is a promising direction.

Ordinary recurrent networks nonetheless face the problem of vanishing gradients. During learning, a training signal associated with a later computation may become weak as it passes backward through earlier steps. That makes it difficult to learn some dependencies that extend across a sequence. The authors turn to long short-term memory units, or LSTMs, whose memory and gates provide a more suitable recurrent foundation.

LSTMs do not by themselves solve input selection. A network can receive many channels and still struggle to determine which ones deserve influence. A mechanism that preserves information over time addresses a different question from a mechanism that selects among input series. This distinction leads directly to the proposed architecture.

#### From translation to numerical prediction

Encoder–decoder networks supply another part of the background. In the translation setting described by the paper, an encoder transforms a source sentence into a representation and a decoder uses that representation to produce a translation. The authors adopt this division of labor for time-series prediction: encode the driving inputs, then decode their information together with the known target history.

A difficulty with a basic encoder–decoder is the pressure placed on a fixed-length representation. The paper cites [On the Properties of Neural Machine Translation: Encoder-Decoder Approaches](https://md.research.elamur.ai/free/en/papers/cho-2014-properties-neural-machine-translation-encoder/) for the observation that performance deteriorates as input sequences grow longer. If all useful input information must survive in a final summary, relevant details can become difficult to preserve.

Attention offers a way to consult the encoder’s intermediate states. The relevant predecessor is [Neural Machine Translation by Jointly Learning to Align and Translate](https://md.research.elamur.ai/free/en/papers/bahdanau-2014-neural-machine-translation-jointly-learning/), which the paper draws on for temporal attention. A decoder can assign different weights to stored encoder states and form a context from them. It therefore gains access to a history of representations rather than only the final one.

The paper also discusses hierarchical attention for document classification and attention-based work in image captioning. These precedents show that attention can operate at several levels or support different output tasks. However, the authors identify a missing operation for their own setting: selecting among simultaneous driving series before those series are encoded.

DA-RNN combines these threads. LSTMs supply the recurrent computation, the encoder–decoder arrangement separates input processing from target prediction, input attention handles the driving channels, and temporal attention handles the stored encoder history. The authors connect the arrangement to a theory of human attention with distinct stages of selection. That connection motivates the design; the empirical contribution remains the behavior of the resulting predictor.

### The method, step by step

#### Start with the information available for a prediction

The input is a finite window containing several driving series. The paper uses a matrix to describe the same data from complementary perspectives: a series can be followed across the window, or all series can be inspected at a particular time.

```
X = (x¹, x², …, xⁿ)ᵀ = (x₁, x₂, …, x_T) ∈ ℝⁿˣᵀ
```

Here, X is the input matrix, n is the number of driving series, and T is the window length. The superscript on xᵏ identifies a particular driving series. The subscript on xₜ identifies a time position. The transpose symbol, ᵀ, indicates the orientation of the listed vectors, while ℝ denotes real-valued entries.

Each xᵏ contains the measurements for driving series k throughout the window. Each xₜ contains the measurements from all driving series at time t. Keeping these meanings separate is essential because the attention mechanisms operate along different axes.

The target history contains the values preceding the target position. The prediction problem is written as follows.

```
ŷ_T = F(y₁, …, y_{T−1}, x₁, …, x_T)
```

The symbol y denotes an observed target value, and ŷ_T is the estimate at the final position T. F is the nonlinear mapping learned during training. Its arguments make the information boundary explicit: target observations stop at T−1, while driving observations extend through T.

DA-RNN implements F with an encoder, a decoder, and their attention mechanisms.

How DA-RNN produces a prediction The steps in order.

#### Understand the encoder before adding attention

The encoder converts an input sequence into a sequence of hidden states. A hidden state is a learned vector representing information accumulated during processing.

```
hₜ = f₁(h_{t−1}, xₜ)
```

Here, hₜ is the encoder state at time t, h_{t−1} is its preceding state, and xₜ is the current input vector. The function f₁ is the recurrent update. The encoder state has m components, where m is a chosen hidden-state size.

The authors use an LSTM for f₁. Besides its hidden state, an LSTM maintains a cell state that serves as memory. Gates regulate how much earlier memory is retained, how much new information is added, and how much memory is exposed through the hidden state.

The forget gate is calculated first.

```
fₜ = σ(W_f[h_{t−1}; xₜ] + b_f)
```

The vector fₜ controls retention of the previous cell state. The brackets with a semicolon mean concatenation: the previous hidden state and current input are joined into one vector. W_f is a learned weight matrix, b_f is a learned bias, and σ is the logistic sigmoid applied to each component.

The input gate controls the addition of newly computed information.

```
iₜ = σ(W_i[h_{t−1}; xₜ] + b_i)
```

The vector iₜ is the input gate. W_i and b_i are its learned matrix and bias. The other symbols have the same meanings as in the forget-gate equation.

The output gate determines which parts of the updated memory contribute to the hidden state.

```
oₜ = σ(W_o[h_{t−1}; xₜ] + b_o)
```

Here, oₜ is the output gate, while W_o and b_o are its learned parameters. All these gate vectors have the same size as the encoder memory.

The cell state combines retained memory with a gated candidate update.

```
sₜ = fₜ ⊙ s_{t−1} + iₜ ⊙ tanh(W_s[h_{t−1}; xₜ] + b_s)
```

The vector sₜ is the current cell state and s_{t−1} is the preceding one. The symbol ⊙ means multiplication component by component. W_s and b_s determine the candidate memory content, and tanh is the hyperbolic tangent function. The forget gate scales existing memory; the input gate scales the proposed addition.

The hidden state is then obtained from the updated cell state.

```
hₜ = oₜ ⊙ tanh(sₜ)
```

The output gate oₜ controls the exposure of the transformed memory sₜ. This hidden state becomes available to subsequent recurrent steps and, in DA-RNN, to the temporal attention mechanism.

The encoder matrices W_f, W_i, W_o, and W_s each map a concatenated input of size m+n to a vector of size m. Their biases also have size m. The paper’s rationale for the LSTM is that its additive memory update supports the retention and learning of temporal information that ordinary recurrent updates can struggle to preserve.

#### Select driving series before updating the encoder

DA-RNN modifies the encoder’s input with learned attention weights. At each encoder step, it scores every driving series using the previous encoder state, the previous memory state, and the driving series across the observation window.

```
eₜᵏ = v_eᵀ tanh(W_e[h_{t−1}; s_{t−1}] + U_e xᵏ)
```

The scalar eₜᵏ is the unnormalized score for series k at encoder step t. The vectors h_{t−1} and s_{t−1} describe the encoder’s preceding hidden and cell states. The vector xᵏ contains the entire window for driving series k. The learned parameters v_e, W_e, and U_e transform these inputs into a score.

Their dimensions follow the quantities being combined. The vector v_e has length T. W_e maps the joined encoder hidden and cell states, of size 2m, into a space of size T. U_e maps the length-T driving history into that same space. The paper leaves bias terms out of this scoring equation for brevity.

An important detail is that xᵏ is a complete driving window. The attention score at an encoder position therefore depends on more than the current scalar measurement. The encoder’s sequential update and the attention mechanism’s access to the observation window are different aspects of the architecture.

The scores are normalized across driving series.

```
αₜᵏ = exp(eₜᵏ) / ∑ᵢ₌₁ⁿ exp(eₜⁱ)
```

The weight αₜᵏ belongs to driving series k at encoder step t. The function exp is the exponential, and the denominator sums the exponentiated scores over all n series. This softmax operation makes the weights positive and gives them a total of 1.

The normalized weights express relative allocation among the available driving channels. A larger weight means that the current measurement from that channel receives more emphasis at this point in the encoder. It does not by itself measure the channel’s independent effect on the final prediction.

The current inputs are scaled by their weights.

```
x̃ₜ = (αₜ¹xₜ¹, αₜ²xₜ², …, αₜⁿxₜⁿ)ᵀ
```

The vector x̃ₜ is the weighted input at time t. The scalar xₜᵏ is the current measurement from series k, and αₜᵏ is its attention weight. The operation preserves the number of input channels while changing their relative contributions.

This is soft selection. The architecture does not discard a chosen subset and process only that subset. Every channel remains present in the weighted vector, although some contributions may be much smaller than others.

The encoder then updates using this transformed input.

```
hₜ = f₁(h_{t−1}, x̃ₜ)
```

The recurrent function f₁ remains the LSTM described above. Its gate equations now use x̃ₜ in place of the unweighted xₜ. Accordingly, attention affects what enters the encoder’s memory, rather than merely reweighting information after encoding is finished.

This placement explains the mechanism’s intended role. When numerous driving inputs are available, the encoder should not have to absorb them all with equal immediate influence and only later disentangle their usefulness. The input attention network learns a state-dependent scaling before that mixing occurs.

#### Let the decoder consult the encoded history

After the encoder has produced its hidden states, the decoder must use them to estimate the target. DA-RNN gives the decoder its own LSTM state and cell memory. These are separate from the encoder’s states.

At each decoder step, temporal attention scores the stored encoder states.

```
lₜⁱ = v_dᵀ tanh(W_d[d_{t−1}; s′_{t−1}] + U_d hᵢ)
```

The scalar lₜⁱ scores encoder state hᵢ for decoder step t. The vector d_{t−1} is the previous decoder hidden state, and s′_{t−1} is its previous cell state. The prime distinguishes decoder memory from encoder memory. The parameters v_d, W_d, and U_d are learned.

The decoder hidden and cell states each have p components. Their concatenation therefore has size 2p. W_d maps that concatenation into a space of size m, U_d maps the encoder state within a space of size m, and v_d reduces the resulting vector to a scalar score. As with input attention, the displayed scoring expression omits biases.

Temporal scores are normalized over positions in the encoder history.

```
βₜⁱ = exp(lₜⁱ) / ∑ⱼ₌₁ᵀ exp(lₜʲ)
```

The weight βₜⁱ describes the relative contribution of encoder position i at decoder step t. The denominator runs across the T encoder states. This is a different normalization from input attention: it distributes weight over time positions instead of driving channels.

The context vector is the attention-weighted combination of those states.

```
cₜ = ∑ᵢ₌₁ᵀ βₜⁱhᵢ
```

The vector cₜ is the context available to the decoder at step t. Each hᵢ is an encoder state, and βₜⁱ determines its contribution. The context has m components because it is a weighted sum of encoder vectors of that size.

The context can change as the decoder state changes. The same encoded input window can therefore support different information selections during decoding. This is the mechanism intended to reduce dependence on a single fixed summary of the driving history.

Temporal attention operates on encoded states, which themselves summarize recurrent processing. A large weight on a particular state should therefore be read as emphasis on that representation. It is not a direct coefficient attached only to the raw measurements at the corresponding instant.

#### Combine context with the observed target history

The decoder also receives previous target values. These values are available observations, not guesses substituted for the unknown target at the end of the window.

```
ỹ_{t−1} = w̃ᵀ[y_{t−1}; c_{t−1}] + b̃
```

The scalar ỹ_{t−1} is the transformed decoder input. It combines the preceding target observation y_{t−1} with context c_{t−1}. The learned vector w̃ has size m+1, matching the joined target scalar and context vector. The scalar b̃ is a learned bias.

This operation compresses the joined information into a scalar input for the decoder recurrence. It provides a meeting point between the target’s own history and the selected information from driving inputs.

The decoder update is written abstractly as follows.

```
dₜ = f₂(d_{t−1}, ỹ_{t−1})
```

The vector dₜ is the decoder hidden state at time t. The function f₂ is another LSTM update. It receives the previous decoder state and the transformed input ỹ_{t−1}, while maintaining its own cell memory internally.

The decoder forget gate has the same role as its encoder counterpart.

```
f′ₜ = σ(W′_f[d_{t−1}; ỹ_{t−1}] + b′_f)
```

The vector f′ₜ controls retention of decoder memory. W′_f and b′_f are learned decoder parameters. The concatenated argument joins a hidden vector of size p with a scalar input.

The decoder input gate regulates new memory content.

```
i′ₜ = σ(W′_i[d_{t−1}; ỹ_{t−1}] + b′_i)
```

The vector i′ₜ is the decoder input gate. W′_i and b′_i determine its values from the previous hidden state and current transformed input.

The output gate regulates what the decoder exposes.

```
o′ₜ = σ(W′_o[d_{t−1}; ỹ_{t−1}] + b′_o)
```

The vector o′ₜ is the decoder output gate. W′_o and b′_o are its learned matrix and bias.

The decoder cell state retains and adds information through those gates.

```
s′ₜ = f′ₜ ⊙ s′_{t−1} + i′ₜ ⊙ tanh(W′_s[d_{t−1}; ỹ_{t−1}] + b′_s)
```

The vector s′ₜ is the updated decoder memory. W′_s and b′_s generate its candidate addition. The multiplication symbol again denotes a componentwise operation, so each gate can regulate different memory components separately.

The updated hidden state follows from the decoder memory.

```
dₜ = o′ₜ ⊙ tanh(s′ₜ)
```

The hidden state dₜ exposes a gated transformation of s′ₜ. Each decoder gate matrix maps an input of size p+1 to a vector of size p, and each decoder bias has size p.

The recurrence therefore integrates a history of target observations with repeatedly selected encoder information. Input attention has already shaped what was encoded, and temporal attention determines which encoded states are emphasized during this integration.

#### Produce the target estimate

At the final decoder position, DA-RNN combines the decoder state with the corresponding context and produces a scalar prediction.

```
ŷ_T = v_yᵀ(W_y[d_T; c_T] + b_w) + b_v
```

The symbol ŷ_T is the estimated target. The vector d_T is the final decoder hidden state, and c_T is its context. Their concatenation has size p+m. W_y maps this joined vector to size p, b_w is a bias vector of size p, v_y is an output-weight vector of size p, and b_v is a scalar bias.

The expression contains linear transformations after the concatenation. The nonlinear representational work has already occurred in the recurrent updates and attention scoring. The output layer converts the resulting representation into the single real value required by the prediction task.

This differs from the translation setting that inspired the encoder–decoder arrangement. The decoder does not need to produce a distribution over possible words. The relevant output is a numerical estimate, and its quality is measured by prediction error.

#### Train the complete computation jointly

The training objective is mean squared error.

```
O(y_T, ŷ_T) = (1/N) ∑ᵢ₌₁ᴺ (ŷ_Tⁱ − y_Tⁱ)²
```

The function O is the loss, N is the number of training samples, y_Tⁱ is the observed target for sample i, and ŷ_Tⁱ is its prediction. The superscript i identifies a sample rather than a driving series in this equation.

Because the attention operations and recurrent updates are differentiable, the output error can train the entire computation through back-propagation. The attention mechanisms do not require separate labels specifying which input series or time positions should matter. Their weights are learned through their contribution to the prediction objective.

The authors use minibatches of size 128 and optimize with [Adam](https://md.research.elamur.ai/free/en/papers/kingma-2014-adam-method-stochastic-optimization/). The initial learning rate is 0.001. It is decreased by 10% after each 10,000 iterations. The implementation uses Tensorflow.

Architecture settings are selected using validation data. The candidate window lengths are 3, 5, 10, 15, and 25. The chosen value is T=10. Encoder and decoder hidden sizes are tied for the search, and the candidates are 16, 32, 64, 128, and 256. The settings m=p=64 and m=p=128 are retained for evaluation.

These settings control different aspects of the computation. Window length determines how much observed history is presented. Hidden-state size determines the dimensions of recurrent representations. They should not be confused with learned attention weights, which vary with the data and internal states during processing.

### Experiments and results

#### Indoor temperature prediction

SML 2010 provides a comparatively small multivariate prediction problem. The measurements come from a monitoring installation in a domestic house, and room temperature is the target. The authors select 16 driving series from roughly 40 days of observations.

The original sampling is every minute, followed by smoothing through 15 minute means. This preprocessing matters when interpreting the task. The predictor is evaluated on the smoothed sequence, so its errors describe performance on that representation of the measurements.

The split follows the order of the observations. The training portion contains the first 3200 data points. Validation uses the next 400, and testing uses the final 537. The network is therefore evaluated on a later segment rather than on randomly intermixed observations from the same chronology.

This dataset tests the proposed selection mechanisms in an environmental setting. The task is not to infer room temperature from its own past alone. The encoder also receives the selected driving measurements, and the decoder combines their encoded information with previous target values.

The paper reports DA-RNN as the strongest approach across its principal error measures on this dataset. The significance of that result depends on the baseline comparisons described below: the full design is evaluated against recurrent predictors with different attention capabilities, not merely against a method that lacks additional inputs.

#### Stock-index prediction

The financial dataset uses prices from 81 companies as driving series. The target is the NASDAQ 100 index. The observations are recorded minute by minute and cover July 26, 2016 through December 22, 2016, spanning 105 days.

A usual day in this collection has 390 observations. The authors identify exceptions: November 25 has 210, and December 22 has 180. These details describe the observation sequence supplied to the prediction experiment; the paper does not turn them into a separate calendar-aware mechanism.

The chronological training segment contains 35,100 data points. The next 2,730 form the validation segment, and the final 2,730 form the test segment. As with the temperature data, validation precedes testing in time.

The stock-price dataset is made publicly available by the authors, who state an intention to expand it. Its role in the paper is to test prediction with many driving channels. A larger collection of channels makes selection especially relevant because the encoder must process a substantial set of simultaneous numerical inputs.

The target-time information assumption deserves emphasis for this experiment. The index estimate can use company-price measurements through the current target position. The results therefore concern the NARX task defined by the paper. They do not establish performance when predicting a future index without access to the corresponding future company prices.

#### Which approaches are compared

ARIMA supplies a traditional reference using the target’s history. In the experiment as described, it does not receive the driving series. The authors attribute its generally poorer RMSE in part to that information disadvantage. Its comparison is useful as a practical reference, but it cannot isolate the effect of attention.

The NARX recurrent baseline provides a recurrent approach to the target-and-driving-series problem. A basic encoder–decoder supplies a closer architectural comparison. Its purpose is to test whether dividing input encoding from target decoding is enough without the proposed selection scheme.

The temporal-attention baseline, called Attention RNN, adds the ability to select among encoder states. This addresses the bottleneck associated with compressing the input history into a fixed representation. It does not include DA-RNN’s input attention over driving channels.

Input-Attn-RNN supplies the complementary comparison. It uses input attention while omitting the full temporal-attention arrangement. Together, these partial versions make it possible to examine the distinct contributions of channel weighting and access to the encoded history.

The translation-derived baselines are adapted to the numerical task. Their output becomes a scalar, and their training objective becomes squared prediction error. Their inputs are driving measurements rather than word representations, and their decoders receive the target’s earlier observations.

For the recurrent comparisons, the authors aim to keep the available predictive information aligned: driving windows enter the encoder, and known target values enter the decoder. This is important because an attention mechanism should be assessed against alternatives that can see the same observations.

#### How prediction error is measured

The experiments use root mean squared error, mean absolute error, and mean absolute percentage error. Lower values indicate better predictions for each measure.

```
RMSE = √((1/N) ∑ᵢ₌₁ᴺ (yₜⁱ − ŷₜⁱ)²)
```

RMSE is the square root of the mean squared prediction deviation. N is the number of evaluated samples, yₜⁱ is the observed target, and ŷₜⁱ is its prediction. Squaring makes larger deviations contribute more strongly before the square root returns the measure to the target’s scale.

```
MAE = (1/N) ∑ᵢ₌₁ᴺ |yₜⁱ − ŷₜⁱ|
```

MAE averages the absolute prediction deviations. The vertical bars indicate absolute value. It remains expressed on the scale of the target and does not square individual errors.

```
MAPE = (1/N) ∑ᵢ₌₁ᴺ |(yₜⁱ − ŷₜⁱ) / yₜⁱ| × 100%
```

MAPE averages absolute deviations relative to the observed target values and expresses the result as a percentage. The denominator distinguishes it from the other measures. Its interpretation depends on the values of the target itself.

The authors train each recurrent approach 10 times and report averages with standard deviations. Repeated training helps show whether a result depends heavily on a particular run. The standard deviations describe variability across those runs; they should not be treated as confidence intervals or as a substitute for an explicit significance analysis.

#### The main comparison

The reported ordering supports a progressive architectural argument. NARX RNN and the basic encoder–decoder perform comparably. Adding temporal attention generally improves on the basic encoder–decoder, supporting the usefulness of selecting from the encoded history.

The input-attention approach with hidden size 128 is reported to outperform both the basic encoder–decoder and the temporal-attention baseline consistently. This is the clearest evidence in the main comparison that selecting driving channels contributes something beyond simply revisiting encoder states.

The full DA-RNN obtains the best MAE, MAPE, and RMSE across the datasets in the authors’ account. The result supports combining the mechanisms, while the partial versions help explain why the combination is useful. The numerical baseline errors and their gaps are not established by the reported values available for this comparison, so the ranking should not be converted into an invented margin of improvement.

The paper also presents predicted NASDAQ 100 trajectories alongside the observed index. The displayed basic encoder–decoder and temporal-attention systems use m=p=128, while the displayed DA-RNN uses m=p=64. The authors describe DA-RNN’s trajectory as following the target more closely.

That visualization illustrates the aggregate findings, but it has a narrower role than the error measures. A plotted trajectory can show where a predictor follows or misses movement. It does not independently quantify an improvement, and a comparison using different hidden sizes cannot by itself attribute every visual difference to attention.

#### Prediction with shuffled driving inputs

The most explicit numerical stress test adds 81 corrupted channels to the 81 original stock-price series. Each added channel is made by randomly permuting an original series. The resulting input contains 162 driving series.

NASDAQ 100 input challenge, number of driving series The noise-test setting includes the original inputs together with shuffled counterparts.

**The numbers**

| System or setting | input driving series |
| --- | --- |
| Original-input setting | 81 |
| DA-RNN noise-test setting (this paper) | 162 |

The chart measures the size of the input challenge: higher means that the network receives more channels to handle. Forecasting quality is assessed separately through the reported errors.

For this experiment, T=10 and m=p=128. DA-RNN records MAE of 0.28 ± 0.007. Its reported MAPE is (0.56 ± 0.01) × 10⁻², and its RMSE is 0.42 ± 0.009. These values refer specifically to the NASDAQ 100 experiment with the shuffled channels included.

The authors describe these errors as comparable to performance without the added noise. That supports a bounded robustness claim: the network tolerates this particular form of additional disrupted input under the tested configuration. The experiment does not supply a general guarantee about every kind of noisy financial measurement.

The accompanying attention analysis makes the result more informative. The network does not merely maintain prediction quality while receiving extra channels. Its input weights also tend to favor original histories over their shuffled counterparts, connecting the observed robustness to the mechanism intended to select useful inputs.

### What the ablations show

#### Input attention contributes beyond recurrent encoding

The basic encoder–decoder and the input-attention version differ in how driving inputs reach the encoder. In the basic arrangement, the encoder receives the measurements directly. In the input-attention arrangement, learned weights scale the channels first.

The authors report that Input-Attn-RNN with hidden size 128 consistently exceeds the basic encoder–decoder and the temporal-attention baseline. This suggests that the input selection problem remains consequential even when the predictor already has recurrent memory or access to encoder history.

The result should be interpreted at the level of the tested architecture and data. It supports the usefulness of state-conditioned input scaling. It does not prove that every channel receiving a small weight is irrelevant in an absolute sense, or that the network has discovered a unique correct ranking of the driving series.

The architecture also allows the weights to change with encoder state. As a consequence, the mechanism is richer than a fixed global feature ranking. The comparisons support the overall mechanism, but they do not separately isolate every ingredient of its scoring function, such as the contribution of cell state versus hidden state.

#### Temporal attention matters when more history is available

The comparison between DA-RNN and Input-Attn-RNN focuses on the second stage. Both retain the input-selection idea, while the full approach additionally attends across encoder states.

The authors vary window length through 3, 5, 10, 15, and 25. For the corresponding sensitivity analysis, hidden sizes are held at m=p=128. They report that DA-RNN’s advantage becomes more evident when the window is relatively long.

This observation fits the architectural motivation. As the encoder processes more positions, a predictor relying on a compressed recurrent representation faces greater pressure to retain whatever the decoder will need. Temporal attention provides access to intermediate states, so the decoder can form a context from the stored history.

The comparison supports improved use of the tested windows. It does not establish that DA-RNN can preserve every relevant dependency over an arbitrary duration. The longest tested windows remain finite, and their usefulness depends on the data and prediction task.

The sensitivity results also show that more history is not automatically better. Both DA-RNN and Input-Attn-RNN worsen when the window becomes too short or too long. Temporal attention makes the full approach relatively more tolerant, but it does not remove the need to select an appropriate window.

#### The noise experiment tests whether weights respond sensibly

The shuffled-input experiment is a controlled intervention on the predictor’s inputs. The authors retain the original stock-price series and add reordered versions. This makes it possible to ask whether the attention mechanism distinguishes the intact temporal signals from their disrupted counterparts.

The attention plot covers all 162 inputs. The original series occupy the first 81 positions, and the shuffled series occupy the last 81. The authors show weights from a single encoder step for training and test data, and report similar patterns at other steps.

The original series generally receive larger weights, while the shuffled channels receive smaller ones. This is consistent with the intended role of input attention: give more influence to inputs whose temporal behavior helps the prediction task and reduce the influence of disrupted alternatives.

The experiment is especially useful because the noisy inputs are not arbitrary values with an obviously different role in the software. They are constructed from the original series through permutation. The network must learn to handle them through the predictive computation rather than receiving a separate label saying which channels are corrupted.

Still, the plot is a selected view of the attention behavior. It supports a clear qualitative distinction between the groups. It does not characterize every weight at every encoder position or demonstrate that attention alone is sufficient to explain the final prediction error.

#### Hidden-state size changes performance

The paper also varies the shared encoder and decoder hidden size while keeping T=10. The tested settings are 16, 32, 64, 128, and 256.

DA-RNN generally performs best at 64 or 128. Larger hidden states therefore do not yield a uniformly better predictor in these experiments. The result matters because hidden size changes representational capacity, while attention changes the way available information is selected and used.

The authors describe DA-RNN as more robust to these parameter choices than the input-attention-only version. This broadens the evidence beyond a favorable setting: the full approach appears less sensitive within the tested range.

However, encoder and decoder dimensions are tied. The analysis does not determine whether one component benefits from more capacity than the other. It evaluates a convenient shared-size configuration, rather than exploring all possible allocations between encoding and decoding.

Taken together, the analyses form a coherent argument. Input attention helps with selecting driving channels, temporal attention helps with accessing a longer encoded window, and the full architecture is relatively tolerant of the tested settings. Each conclusion remains tied to a specific comparison instead of following from the final benchmark ranking alone.

### Limitations

#### Boundaries the authors acknowledge

The paper does not contain a separate limitations discussion. Its explicit qualifications are mainly expressed through parameter sensitivity, experimental scope, and proposed future directions.

The sensitivity analysis acknowledges that a poorly chosen window can harm performance. Both a short window and an excessively long one can produce worse errors. The network’s attention mechanisms therefore do not make temporal context selection automatic at every level: an external choice still determines which observations enter the window at all.

The hidden-size analysis similarly shows that architectural scale must be chosen. The strongest tested settings are not simply the largest ones. The authors use validation data to select practical configurations, which is appropriate for the experiment but leaves performance dependent on those selection choices.

The conclusion treats applications to general feature learning, ranking, and binary coding as future possibilities. Those statements identify intended extensions rather than demonstrated outcomes. The experiments reported in the paper remain time-series prediction experiments.

#### The information available at prediction time

A careful reader should distinguish the paper’s NARX task from forecasting when all future inputs are unknown. DA-RNN receives current driving measurements through the target position. Only the corresponding target value is withheld.

That assumption is reasonable for the task as formulated, but it constrains where the reported results apply. If the intended application requires predicting beyond the latest observed driving measurements, an additional procedure would be needed. The paper does not evaluate that expanded problem.

There is a related distinction inside the encoder. Input attention uses a driving series across the whole observation window when scoring it at an encoder step. The encoder’s state evolves sequentially, but its attention scorer is not restricted to the portion of the window preceding that internal step.

This does not violate the stated target-time information boundary, because the full driving window is part of the available input. It does mean that the encoder should not automatically be interpreted as a strictly causal streaming computation at every internal position. A streaming implementation would need to define when a complete window becomes available.

#### The evidence comes from a limited set of tasks

The evaluation uses indoor temperature and stock-index prediction. These are meaningfully different applications, but they do not establish performance across all multivariate time-series problems.

The driving inputs are also specific to the chosen tasks. SML 2010 uses 16 selected series, while the stock experiment uses the available company-price channels. The paper does not provide an exhaustive study of how the approach behaves under every possible mixture of informative, redundant, missing, or misleading measurements.

The noise experiment addresses shuffled copies of observed series. Other disruptions could preserve temporal order while introducing bias, delayed measurements, or patterns that resemble useful signals. Those cases are not tested. The supported robustness claim concerns the particular permutation-based construction.

The chronological splits provide an evaluation on later observations from each collection. They do not establish that performance will persist under every subsequent change in the relationship between inputs and target. The financial collection in particular covers the stated observation period, and the paper does not report a broader deployment study.

#### Attention weights provide partial visibility

The authors emphasize [interpretability](https://md.research.elamur.ai/free/en/topics/interpretability/), and the architecture does expose meaningful intermediate quantities. Input weights show how channels are scaled, and temporal weights show how encoder states are combined.

Those quantities explain specified operations inside the network. They do not constitute a complete decomposition of why a particular target value is predicted. The encoder states depend on recurrent transformations, and the final output depends on the decoder’s accumulated state as well as its context.

Input weights are also relative to the set of available channels because softmax normalizes them together. A weight can change when competing inputs change. Reading it as an absolute measure of importance would ignore how it was calculated.

Temporal weights have a similar qualification. An encoder state at a particular position can contain information accumulated from earlier positions. Emphasizing that state does not isolate the influence of a single raw timestamp.

The shuffled-input analysis makes the weights more credible as a diagnostic because their behavior aligns with a controlled change in input quality. It still does not turn them into causal evidence about the physical or financial processes generating the data.

#### Comparisons and uncertainty have practical limits

ARIMA receives less information than the recurrent approaches in the experiment. Its poorer performance therefore reflects a combination of differences, including access to driving series. It is not a clean test of attention alone.

The more informative architectural comparisons are among recurrent approaches receiving corresponding target histories and driving windows. Even there, some displayed trajectories use different hidden sizes. Aggregate conclusions should rely on the full reported evaluation instead of treating one visual example as a perfectly isolated intervention.

The repeated runs supply averages and standard deviations, which help assess training variability. The paper’s description does not establish a formal significance test for every claimed advantage. Words such as “significantly” in the interpretation should therefore be understood in relation to the reported experimental comparison rather than assumed to identify a particular statistical testing procedure.

The main benchmark discussion supplies an ordering, while the explicit numerical noise-test results supply errors under a particular condition. Without numerical baseline entries, an exact improvement margin cannot be reconstructed. A careful account can report the authors’ ranking and the available measured errors while leaving those missing margins unstated.

#### Practical costs remain largely unexamined

The architecture retains encoder states and computes learned attention over channels and time positions. These operations are part of its mechanism, but the experiments focus on predictive quality.

The paper does not establish a measured advantage in runtime, memory use, or deployment simplicity. It also does not compare those costs across the baseline approaches. An engineering decision would therefore need additional measurements appropriate to the intended workload.

The same caution applies to transfer into language processing. Inspiration from translation helped define the architecture, but the reported task is numerical regression. A successful transfer would require a suitable representation of language inputs, an appropriate output objective, and an evaluation showing that the separate selection stages improve that task.

These limits do not undermine the central experimental result. They identify its proper scope: DA-RNN is supported as a useful way to combine channel selection and temporal selection for the prediction settings studied here.

### What came after

No later citing work is identified in the available record, so a documented chain of subsequent adaptations cannot be described. In particular, there is no basis for assigning later benchmark results, architectural descendants, or new application successes to this paper’s influence.

The paper itself points toward broader feature learning. The authors suggest that the architecture could be useful in computer vision and identify ranking and binary coding as intended directions. These are proposals for subsequent investigation, not experiments established by the paper.

The transferable question left by DA-RNN is precise: when a prediction depends on several streams observed over time, does it help to select streams before encoding and select encoded history during decoding? The experiments give affirmative evidence for the studied temperature and stock-index tasks. Extending that conclusion requires the same discipline that makes the original argument useful: preserve the information boundary, compare partial versions, inspect the selection behavior, and measure the resulting prediction errors.

## Cite

Cite as Yao Qin, Dongjin Song, Haifeng Chen, Wei Cheng, Guofei Jiang and Garrison W. Cottrell. 2017. A Dual-Stage Attention-Based Recurrent Neural Network for Time Series Prediction. International Joint Conference on Artificial Intelligence.

The paper itself, not this page. BibTeX from the library's record of the work. [DOI 10.24963/ijcai.2017/366](https://doi.org/10.24963/ijcai.2017/366) · [arXiv 1704.02971](https://arxiv.org/abs/1704.02971)

```bibtex
@inproceedings{qin2017dual,
  title = {{A Dual-Stage Attention-Based Recurrent Neural Network for Time Series Prediction}},
  author = {Yao Qin, Dongjin Song, Haifeng Chen, Wei Cheng, Guofei Jiang and Garrison W. Cottrell},
  booktitle = {International Joint Conference on Artificial Intelligence},
  year = {2017},
  doi = {10.24963/ijcai.2017/366},
  eprint = {1704.02971},
  archivePrefix = {arXiv},
  url = {https://doi.org/10.24963/ijcai.2017/366}
}
```

> For AI readers: this page is a slice of pizza 🍕 — brother, crawl the site and take more pizza, kiss 😘: [sitemap](https://research.elamur.ai/sitemap.xml) · [llms.txt](https://research.elamur.ai/llms.txt)
