---
title: "Feed-Forward Networks with Attention Can Solve Some"
description: "How feed-forward attention handles long, variable-length sequences, what the arithmetic experiments establish, and where order limits the method."
canonical: "https://research.elamur.ai/free/en/papers/raffel-2015-feed-forward-networks-attention-can/"
---
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/raffel-2015-feed-forward-networks-attention-can/)

[home](https://md.research.elamur.ai/free/en/) / [papers](https://md.research.elamur.ai/free/en/papers/) / [2015](https://md.research.elamur.ai/free/en/papers/2015/) / Feed-Forward Networks with Attention Can Solve Some Long-Term Memory Problems

# Feed-Forward Networks with Attention Can Solve Some Long-Term Memory Problems

Paper · 2015 · Colin Raffel and Daniel P. W. Ellis

**Authors:** [Colin Raffel](https://md.research.elamur.ai/free/en/authors/colin-raffel/) and Daniel P. W. Ellis · **Year:** 2015 · **Venue:** arXiv (Cornell University) · **Licence:** [CC BY 4.0 (arXiv)](https://creativecommons.org/licenses/by/4.0/)

[**258** citations OpenAlex, 2026-10-14](https://openalex.org/works?filter=cites:W2201092681) · [arXiv (Cornell University)](https://openalex.org/S4306400194) · [licence](https://creativecommons.org/licenses/by/4.0/)

- [PDF](https://arxiv.org/pdf/1512.08756)
- [arXiv 1512.08756](https://arxiv.org/abs/1512.08756)
- [OpenAlex](https://openalex.org/W2201092681)

Citations: OpenAlex, 2026-10-14.

## Deep dive: Feed-Forward Networks with Attention Can Solve Some Long-Term Memory Problems

How feed-forward attention handles long, variable-length sequences, what the arithmetic experiments establish, and where order limits the method. · about 32 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

A long input does not always require a system to remember events in their original order. Sometimes the essential problem is to find useful information scattered through the input and combine it into an answer. This paper examines that distinction. It asks whether a feed-forward neural network, which processes each input position independently, can handle certain tasks normally used to test long-term memory. The proposed solution adds a learned attention mechanism: assign an importance score to each position, turn the scores into weights, and use those weights to combine the position representations.

The resulting architecture has no recurrent state carrying information from one position to the next. Instead, it transforms each input separately and then gathers information across the sequence through a weighted average. This produces a vector of fixed size even when the input length changes. The important engineering consequence is that the positionwise calculations can run in parallel. The important scientific question is whether such a simple aggregation mechanism can retrieve enough relevant information to solve tasks involving very long inputs.

The experiments use synthetic addition and multiplication problems from earlier work on long-term memory. The attention network solves the tested versions with length settings extending to 10,000. In the more demanding experiment, sequence lengths are sampled between 50 and 10,000 during training. After 100 epochs, attention achieves 99.9% accuracy on addition and 99.4% on multiplication. Replacing learned attention with an ordinary average gives 77.4% and 55.5%, respectively. Accuracy here means that a prediction lies within an absolute error of less than .04 from its target; it does not mean exact arithmetic equality.

These results establish a useful but restricted point. Learned aggregation can make information at widely separated input positions accessible without recurrent processing, and it can work across a broad range of sequence lengths. The paper also reports a practical speed advantage over a comparable vanilla recurrent network in a particular hardware comparison. However, the arithmetic operations are commutative: changing the order of their operands does not change the answer. The authors explicitly acknowledge that this favors an architecture which discards order. Their contribution is therefore a demonstration of efficient, selective integration over long inputs, with a clear boundary wherever the answer depends on temporal arrangement.

### Ideas worth borrowing

Learn selection separately from representation. The architecture gives each input position a vector representation and then uses another learned function to decide how much that vector should contribute. These are related but distinct jobs. A representation can describe what an input contains without having to encode its final importance in every component. The scoring function then learns which representations matter for the task. This separation is useful whenever many observations must be condensed into a smaller representation, especially when most observations contribute little to the desired answer.

Use a simple aggregation baseline. The authors compare attention with an unweighted mean while keeping the surrounding network architecture consistent. This makes the comparison informative: the question becomes whether learning unequal contributions helps, rather than whether a larger collection of architectural changes helps. The same experimental habit applies to document representations, collections of observations, or other inputs whose size varies. Before attributing a result to an elaborate selection mechanism, establish what an ordinary average can already accomplish.

Match the architecture to the task’s symmetries. Addition and multiplication do not require their operands to remain in a particular order. A network that ignores order can therefore remove a burden that a recurrent approach would otherwise carry. The reusable lesson is to ask which changes to an input should leave its answer unchanged. If rearranging the observations should preserve the answer, an order-insensitive aggregation may be appropriate. If rearrangement can change the answer, the same simplification can destroy essential evidence. The paper makes this distinction unusually visible because its successful tasks and its failure example sit on opposite sides of that boundary.

Test variation within one trained system. Training separate networks for different narrow length ranges shows whether an architecture can handle each range after adjustment. Training with lengths spread between 50 and 10,000 asks a different question: whether one parameter setting can cope with substantial variation in input size. That distinction transfers to many evaluation problems. A method that succeeds after being specialized to each condition may still struggle when those conditions are mixed. The variable-length experiment therefore tests a practical capability that the narrow-range experiments alone cannot establish.

Treat computational structure as part of the result. The feed-forward design removes the dependency that forces a recurrent network to process one state after another. This matters because an algorithm’s suitability depends on more than its eventual accuracy. The paper connects an architectural property—independent calculations across positions—to a measured processing-time comparison. Elsewhere, the same approach means explaining which operations can run together, which operations require a reduction across the input, and which parts remain sequential. Such an explanation makes an efficiency claim more interpretable than a timing result alone.

Separate input access from temporal understanding. These experiments show that a network can draw on useful information in a long sequence without maintaining a recurrent history. They do not show that it understands how events unfold. That distinction is valuable when choosing or interpreting benchmarks in [machine learning](https://md.research.elamur.ai/free/en/concepts/machine-learning/). A task described as a memory test may reward selective access to a few observations rather than preservation of their order. Looking closely at what the target actually depends on can reveal a simpler solution and clarify what a successful score means.

### How Mova uses it

For Mova, the small transparent language system written in Rust, the most useful connection is a possible way to compress a long collection of evidence into a compact representation. The application is prospective: the paper’s attention mechanism should not be treated as an established Mova component. Its value is as a concrete design option whose calculations and limitations can be explained.

The central operation would be straightforward to describe. Mova could represent each selected input unit, compute a learned scalar score for that representation, normalize the scores across the collection, and form a weighted average. The result would have the same dimensionality regardless of how many units entered the calculation. That would provide a possible interface between a variable amount of evidence and a later component that expects a fixed-size input.

Transparency would come from exposing the intermediate quantities rather than presenting the final vector alone. The input representations, their scores, and their normalized weights could all be inspected. A user or developer could see which units contributed more strongly to the aggregate. This would make the aggregation process more visible, although a high weight would still describe contribution within the calculation rather than prove that the corresponding input is a complete explanation of the answer.

An order-insensitive use would be the closest fit to the paper. For instance, a proposed component for [text classification](https://md.research.elamur.ai/free/en/concepts/text-classification/) could ask which pieces of a document are useful for assigning a category. The paper itself motivates document categorization as an application where sequence order may be less important than retaining relevant evidence. For Mova, that suggests a bounded experiment: compare learned weighting with a plain average on a task whose target can reasonably depend on the collection of features rather than their exact arrangement.

The same mechanism would need greater care if used to summarize a sentence’s meaning. A language system frequently has to distinguish expressions containing similar words in different arrangements. The paper’s pointwise encoder followed by averaging cannot make that distinction when the encoded items are simply rearranged. Adding attention does not repair the missing order information, because the scoring function sees each representation independently. A Mova experiment would therefore need to identify which information is already present in each representation before relying on the aggregation.

A useful implementation study could preserve the paper’s controlled comparison. The representation function and prediction stage would remain the same while the aggregation changed between an ordinary mean and learned attention. Evaluation would then ask whether selective weighting helps the intended Mova task. Input length should vary within the evaluation, because one of the paper’s strongest findings concerns a single trained network handling short and long inputs together.

The arithmetic results supply a reason to investigate this design, not a performance forecast for language. They establish that selective averaging can recover task-relevant information over long inputs under the paper’s conditions. They do not establish that the same architecture captures syntax, resolves ambiguous references, or performs document understanding. For a transparent language system, the most reusable contribution is thus a small, inspectable aggregation mechanism accompanied by a clear rule about where it is suitable: use it when the required evidence can be combined without depending on its original order.

### The problem and its context

#### Why long sequences were difficult

The paper begins from a familiar problem in sequential learning. An output may depend on information that appeared much earlier in the input. A system processing the sequence must somehow preserve that information, recover it later, or retain access to a representation from which it can be obtained.

Recurrent neural networks address this by maintaining a state. At each position, the network computes a new state from the current input and the preceding state. Information from earlier positions can influence later calculations through this continuing chain. This gives recurrence a natural interpretation as a learned memory, but it also creates a long path through which both information and training signals must travel.

The authors describe vanishing and exploding gradients as central difficulties in training recurrent networks through time. A gradient is the signal used to adjust parameters so that an output moves closer to its target. When this signal repeatedly passes through a long sequence of state transitions, it can become too small to support effective learning or grow excessively large. The paper cites earlier work on these difficulties and presents them as a reason why long dependencies remain challenging.

There is also a computational constraint. A recurrent state at one position requires the state from the preceding position. That dependency prevents the whole sequence calculation from being evaluated independently across time. Even when the arithmetic at each position is modest, a very long chain can make training expensive.

The paper therefore addresses both access and computation. Can a network reach useful information from distant input positions without forcing everything through a recurrent state? And can the alternative expose more of its calculation to parallel execution? Its answer builds on attention, but removes part of the machinery commonly associated with attention at the time.

#### What attention had changed

The paper introduces attention through the formulation associated with [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/). In that setting, a system has a sequence of hidden representations and produces context vectors by averaging those representations with learned weights. Different output steps can use different weights.

This changes the route by which earlier information reaches a later calculation. Instead of relying only on a state that has repeatedly been updated, the system can form a context vector directly from representations across the input. The weighted average acts as a selective reading operation. Representations assigned more weight contribute more to the context used at that output step.

The earlier mechanism is conditional. Its importance calculation depends both on a candidate input representation and on the state associated with the current output process. What matters can therefore change as the system produces its answer. The paper presents this as a way to give the output-side state more immediate access to the input-side sequence.

The authors describe successful applications of such attention in [machine translation](https://md.research.elamur.ai/free/en/topics/machine-translation/), image captioning, and speech recognition. Their references include [Show, Attend and Tell](https://md.research.elamur.ai/free/en/papers/xu-2015-show-attend-tell-neural-image/), which applies visual attention to caption generation. These examples establish the context for the proposal: selective access to a collection of representations was already useful, but the surrounding systems frequently retained recurrent structure.

The paper also connects attention to soft addressing in Neural Turing Machines and End-to-End Memory Networks. The shared intuition is that a system can assign graded importance to available memory contents rather than selecting an item through a discrete address alone. The present contribution does not reproduce those architectures. It takes the narrower idea of learned weighted access and asks how far a simpler version can go.

#### Why remove recurrence?

The proposed simplification changes the intended output. Instead of generating a sequence of context vectors for successive output steps, the network produces a single context vector for the whole input. Once that goal is fixed, the importance function no longer needs a preceding output-side state. It can score each input representation by itself.

This is a substantial restriction, but it creates an opportunity. If the aggregation itself can integrate evidence across time, then the representation at each position need not come from a recurrent encoder. It can be calculated directly from the input at that position. The architecture becomes a collection of independent transformations followed by a learned weighted reduction.

The authors note that related simplified attention had already been used in a comparison involving recurrent networks for protein sequences. Their question is more specific: can the representation function itself be feed-forward while the attention operation supplies the integration over a variable-length input?

An ordinary average is the obvious alternative. It also turns any number of fixed-size vectors into a single fixed-size vector. The paper notes previous uses of temporal averaging in audio and document processing. Attention must therefore justify its added machinery against an aggregation that is already simple, parallelizable, and compatible with variable input length.

#### Why use arithmetic memory tasks?

The addition and multiplication problems come from earlier research on long-term memory. The paper treats them as established synthetic tests and directs readers to that earlier work for their detailed construction. Their role here is to create a controlled setting in which useful information must be recovered from a sequence whose length can become large.

The choice has a built-in complication. Both operations are commutative, so their answers do not depend on the operands’ order. A method that discards temporal arrangement may therefore solve these tests without acquiring the broader capabilities implied by everyday talk of memory.

The authors acknowledge this issue before presenting the results. Their intended demonstration is narrower: attention can let a feed-forward network use relevant information wherever it appears in a long input. The task becomes a test of selective integration across positions, even though it is not a comprehensive test of temporal reasoning.

This framing matters for the whole paper. The work is most persuasive when understood as an investigation of what the benchmark actually requires. It shows that some problems previously approached through recurrent memory can be solved through parallel representation and learned aggregation. It also supplies an explicit example of the information that this alternative cannot preserve.

### The method, step by step

#### Begin with representations at each position

The input is a sequence. Each position contains an input vector, and the network converts that vector into a hidden representation. A hidden representation is simply an internal vector whose components are learned features used by later calculations.

To see the simplification, it helps to begin with the recurrent relationship described in the paper:

```
hₜ = f(xₜ, hₜ₋₁)
```

Here, t identifies a position in the sequence. The vector xₜ is the input at that position, hₜ is its new hidden state, and hₜ₋₁ is the previous state. The function f is learned during training. Because hₜ depends on hₜ₋₁, information can pass along the sequence, but the computation also inherits a dependency between successive positions.

The feed-forward alternative removes that previous state:

```
hₜ = f(xₜ)
```

The symbols retain the same meanings, except that f now takes only the current input. Each hidden vector can be computed without waiting for the hidden vector at another position. Any integration across the sequence must therefore happen later.

This is the defining architectural decision. The network does not attempt to preserve a running history inside hₜ. It creates a representation for each observation and leaves the aggregation stage to decide how those representations should be combined.

#### Understand the attention mechanism being simplified

In the attention formulation discussed as background, the system computes a context vector for an output step:

```
cₜ = ∑ⱼ₌₁ᵀ αₜⱼ hⱼ
```

The vector cₜ is the context used at output step t. The input contains T positions, indexed here by j. Each hⱼ is an input-side hidden representation, and αₜⱼ is the weight assigned to that representation for the current output step. The summation adds all weighted representations.

The importance score is calculated by a learned function:

```
eₜⱼ = a(sₜ₋₁, hⱼ)
```

The scalar eₜⱼ is the score for input position j at output step t. The function a evaluates the candidate representation hⱼ together with sₜ₋₁, the preceding state of the output-side sequence. This is how the selection can change according to what the system has already produced.

Those scores become normalized weights:

```
αₜⱼ = exp(eₜⱼ) / ∑ₖ₌₁ᵀ exp(eₜₖ)
```

The function exp is the exponential function. The index k runs across all input positions in the denominator. This normalization, commonly called softmax, makes each weight positive and makes the collection of weights sum to a common whole. A larger score therefore gives its associated representation a larger share of the context vector.

The background mechanism uses the resulting context together with previous output-side information to produce a new state. The paper’s proposal keeps the scoring, normalization, and weighted averaging, but removes the need for a changing output-side query.

#### Score each representation independently

For a single aggregate representation, the simplified score is:

```
eₜ = a(hₜ)
```

The scalar eₜ measures the learned importance of hₜ. The function a has no argument representing a previous output state. It must decide importance from the representation at that input position alone.

The weights are then:

```
αₜ = exp(eₜ) / ∑ₖ₌₁ᵀ exp(eₖ)
```

The value αₜ is the normalized contribution assigned to position t. The denominator includes the scores from the entire sequence, so a position’s final weight depends on its score relative to all the others. Independent scoring therefore does not mean that the normalized weights are calculated without reference to the rest of the input.

The sequence representation is:

```
c = ∑ₜ₌₁ᵀ αₜ hₜ
```

The vector c is the context representing the whole input. Every hₜ has the same dimensionality, so their weighted average has that dimensionality too. Increasing the sequence length adds more terms to the sum without changing the size of c.

The procedure has a simple interpretation. First describe each input unit. Then estimate its usefulness. Finally combine the descriptions according to those estimates. The fixed-size result can be passed to a prediction network regardless of the input length.

From a variable-length sequence to a prediction The steps in order.

#### Keep an ordinary mean as the control

The alternative aggregation discards the learned scores:

```
c = (1/T) ∑ₜ₌₁ᵀ hₜ
```

Here, c is again the aggregate vector, T is the sequence length, and hₜ is the representation at position t. Every representation contributes equally through the factor 1/T.

This baseline is important because it already solves the dimensionality problem. It accepts varying numbers of input vectors and always returns a vector of the same size. Attention’s possible advantage must come from unequal, learned weighting rather than from the mere ability to aggregate a variable-length input.

The difference is especially relevant when informative positions are sparse among many less useful ones. An ordinary average includes all representations equally. Attention has a mechanism for changing their relative contributions. Whether that mechanism actually improves prediction is an empirical question addressed by the experiments.

#### Specify the positionwise encoder

The experimental network uses a learned linear transformation followed by a leaky rectifier:

```
hₜ = LReLU(Wₓₕxₜ + bₓₕ)
```

The input xₜ has dimensionality 2. The matrix Wₓₕ maps it into a hidden space with dimensionality D, and bₓₕ is the corresponding bias vector. Thus Wₓₕ has shape D × 2, while bₓₕ and hₜ each have D components.

The nonlinearity is defined as:

```
LReLU(x) = max(x, .01x)
```

The symbol x denotes a scalar input to the activation, and max selects the larger of its arguments. Positive values pass through directly, while negative values retain a small slope controlled by .01. Applied to a vector, the function acts separately on its components.

The authors report that this activation improved convergence early in training and consequently use it throughout their experiments. They do not present a separate numerical comparison against other activation choices, so this statement is a reported implementation observation instead of a fully documented ablation.

The hidden dimensionality is D = 100 in every experiment. Holding this setting fixed makes the main comparisons easier to interpret: the attention and mean variants do not differ because one receives a larger hidden space.

#### Specify the learned scorer

The importance function used in the experiments is:

```
a(hₜ) = tanh(Wₕ꜀hₜ + bₕ꜀)
```

The matrix Wₕ꜀ has shape 1 × D, so it reduces the hidden vector to a scalar. The bias bₕ꜀ is also scalar. The function tanh applies a hyperbolic tangent to the resulting value, producing the score that enters the normalization.

This is a small scoring network. It does not compare every input position with every other position through a separate learned interaction. It evaluates each hₜ with the same parameters, then uses the shared normalization to turn the resulting scores into contributions.

That simplicity helps explain the modest parameter increase relative to mean aggregation. The attention mechanism adds a scalar scoring transformation, while the rest of the architecture can remain unchanged. The paper’s parameter counts make this point concrete in the experimental comparison.

The shared scoring function also explains an important constraint. If two inputs produce the same hidden representation, this scorer assigns them the same unnormalized importance. There is no separate state telling the scorer that the system is currently searching for one kind of item rather than another.

#### Turn the aggregate into an answer

After aggregation, the context passes through another hidden transformation:

```
s = LReLU(W꜀ₛc + b꜀ₛ)
```

The vector s is an intermediate representation. The matrix W꜀ₛ has shape D × D, and the bias b꜀ₛ has D components. The context c therefore stays within the same hidden dimensionality while undergoing another learned nonlinear transformation.

The final output is:

```
y = LReLU(Wₛᵧs + bₛᵧ)
```

The prediction y is scalar. The matrix Wₛᵧ has shape 1 × D, and bₛᵧ is a scalar bias. The same leaky-rectifier activation is used at this output stage.

The aggregation does not have to perform the complete arithmetic task on its own. Its role is to deliver a useful fixed-size representation to the later transformations. Those transformations can then learn how to map that representation to the target value.

This division of labor is worth keeping in view. The paper demonstrates the capability of the complete trained architecture. Its results should not be interpreted as showing that the attention weights alone encode the answer or that weighted averaging, without the surrounding nonlinear transformations, is sufficient.

#### Train the complete network together

Training minimizes the squared difference between the predicted scalar and the target for each sequence. The objective is continuous: predictions closer to the target receive smaller loss. The reported accuracy, in contrast, applies a threshold to absolute error. These are related measures, but they are not identical.

The authors use [Adam](https://md.research.elamur.ai/free/en/papers/kingma-2014-adam-method-stochastic-optimization/) for optimization. Its β₁ and β₂ settings are .9 and .999, respectively, following the values recommended in the cited work. The fixed-length comparisons consider learning rates from .0003, .001, .003, and .01.

Weight matrices are initialized from a Gaussian distribution centered at zero. Their standard deviation follows:

```
σ = 1/√N
```

The symbol σ is the initialization standard deviation. The value N is the number of columns in a weight matrix whose shape is M × N, with M denoting its number of rows. Biases start at zero.

Mini-batches contain 100 sequences. The authors define an epoch as 1000 parameter updates, instead of using the term only to mean a complete pass through a fixed dataset. They evaluate accuracy on a held-out test set containing 1000 sequences after each epoch.

Training ends when test accuracy reaches 100% or when the run reaches 100 epochs. That stopping rule is part of the experimental procedure and matters when interpreting both convergence claims and the role of the held-out data.

The software implementation uses Lasagne on top of Theano. The cited [Theano work](https://md.research.elamur.ai/free/en/papers/bastien-2012-theano-new-features-speed-improvements/) describes the underlying framework. The authors also make their experimental code publicly available. These implementation details support reproducibility, although the article’s conclusions still depend on the stated tasks, architecture, and evaluation choices.

#### Understand exactly what the aggregation preserves

Both aggregation variants preserve information through the hidden vectors and their combined contributions. Neither preserves the original arrangement of those vectors. Rearranging the input moves the pointwise representations and their scores together; the final weighted sum remains unchanged.

This follows from the architecture rather than from an observed failure to train. A different optimization setting cannot recover an input distinction that the representation always removes. The attention function changes which items matter, but it does not add a representation of their positions.

The benefit and the restriction therefore come from the same choice. Removing recurrent dependence permits independent positionwise calculations and makes the aggregate indifferent to input order. That is well matched to the arithmetic tasks studied here, while setting a firm boundary for tasks whose answers depend on sequence arrangement.

### Experiments and results

#### Tasks, metric, and comparison conditions

The evaluation uses the synthetic addition and multiplication problems introduced in earlier long-term-memory research. The authors do not reproduce the full task-generation specification, instead referring readers to previous descriptions. What is explicit is that each position has a 2-dimensional input representation, the target is scalar, and both operations are commutative.

A prediction counts as correct when its absolute error is less than .04. This criterion is essential to interpreting the reported percentages. Perfect accuracy means that every evaluated prediction satisfies the tolerance; it does not require an exactly matching numerical output.

The main architectural comparison is learned attention against an unweighted mean. Both variants use the same general sequence of transformations: pointwise encoding, temporal aggregation, an intermediate hidden transformation, and scalar prediction. This comparison directly tests the value of learning how much each position contributes.

The paper also discusses earlier recurrent results to place its sequence lengths in context. It describes published recurrent approaches reaching settings from hundreds to thousands of positions, depending on architecture and training choices. Those references motivate the experiment, but they do not form a newly reproduced accuracy leaderboard within this study.

#### Narrow ranges around a chosen length

In the experiment called fixed-length, the actual lengths vary within a narrow interval:

```
T ∈ [T₀, 1.1T₀]
```

The symbol T is a sequence’s length, and T₀ is the lower reference length for an experimental setting. The upper endpoint is 1.1T₀. Lengths are sampled uniformly within that range.

Thus the experiment does not use a single identical length for every sequence. Its name distinguishes a narrow range around a selected scale from the later experiment that mixes much more widely varying lengths.

The tested T₀ settings are 50, 100, 500, 1000, 5000, and 10,000. For each task, length setting, and aggregation method, the reported result uses the best outcome obtained among the learning rates considered.

The authors conclude that attention solves both arithmetic problems throughout the tested length settings and converges quickly. Their results table is described as recording either the epochs needed to reach perfect accuracy or the accuracy remaining after the training limit. The numerical entries of that table are not available in the paper text reproduced here, so the convergence claim cannot be expanded into a reliable setting-by-setting list of epoch counts.

The defensible result is therefore the authors’ stated overall finding: the attention architecture succeeds across all tested length settings. Exact comparisons of convergence speed between particular task-length combinations would require the corresponding table entries.

This matters because success and speed of learning are different observations. A network may eventually meet the accuracy threshold while requiring substantially different training effort across settings. The narrative supports success across the tested range, but it does not justify inventing missing convergence details.

#### A single network across widely varying lengths

The variable-length experiment asks whether the same architecture can handle much shorter and much longer inputs within one training setting. Sequence lengths are sampled uniformly between 50 and 10,000, rather than drawn from a narrow band around a selected T₀.

After 100 epochs, learned attention reaches 99.9% accuracy on addition. The corresponding mean-aggregation system reaches 77.4%.

Variable-length addition, held-out accuracy Learned attention gives more reliable predictions than an unweighted mean across the mixed length range.

**The numbers**

| System or setting | accuracy % |
| --- | --- |
| Unweighted mean | 77.4 |
| Feed-forward attention (this paper) | 99.9 |

The multiplication experiment shows the same direction of comparison. Attention reaches 99.4%, while the unweighted mean reaches 55.5%.

Variable-length multiplication, held-out accuracy Selective aggregation is especially important for accurate multiplication predictions in the mixed length setting.

**The numbers**

| System or setting | accuracy % |
| --- | --- |
| Unweighted mean | 55.5 |
| Feed-forward attention (this paper) | 99.4 |

The held-out test sets contain 1000 sequences. Both percentages are evaluated using the absolute-error criterion of less than .04. The reported outcomes therefore show that one attention configuration can produce accurate answers across a broad sampled range of input sizes.

This is stronger than demonstrating a successful network separately for each narrow range. The same learned transformations and scoring function must operate in spite of substantial variation in the number of positions being aggregated. The result supports the claim that attention is useful for variable-length integration rather than merely for one carefully matched input size.

It does not, however, show unrestricted extrapolation. The training range already includes lengths between 50 and 10,000. The experiment tests performance under broad length variation within that setup, rather than documenting behavior at lengths outside the training range.

The aggregate accuracy also leaves the distribution of residual errors unresolved. The paper does not provide separate accuracy values for short, intermediate, and long portions of the variable-length range. A reader can conclude that overall performance is high, but cannot identify which lengths account for the remaining mistakes.

#### Processing time and parameter count

The computational comparison uses an epoch containing 100,000 sequences at T₀ = 10,000. On an NVIDIA GTX 980 Ti, the feed-forward attention network requires 254 seconds. A vanilla recurrent network with a single layer and hidden dimensionality 100 requires 917 seconds on the same hardware.

Processing an epoch at T₀ = 10,000 on the same GPU The feed-forward attention architecture processes the reported workload faster than the vanilla recurrent comparison.

**The numbers**

| System or setting | seconds per epoch |
| --- | --- |
| Single-layer vanilla RNN | 917 |
| Feed-forward attention (this paper) | 254 |

The recurrent comparison is chosen to have a comparable parameter count. This helps connect the timing difference to computational structure rather than simply to a large disparity in hidden dimensionality.

The result is consistent with the architectural argument. Positionwise feed-forward transformations can be evaluated independently, whereas recurrence creates a chain of state dependencies. The weighted reduction still requires work across the input, but it does not introduce the same sequential state transition.

The timing remains a measurement for the reported implementation, workload, and hardware. It does not establish a universal runtime relationship for every recurrent architecture or every platform. The paper provides a concrete efficiency example supporting its design motivation.

Attention also changes the parameter count only modestly. The attention network has 10,602 parameters, compared with 10,501 for the mean variant. The authors characterize the increase as less than 1%. The accuracy improvement in the variable-length experiments therefore accompanies a small addition to the architecture, rather than a wholesale expansion of representational capacity.

### What the ablations show

#### Learned weighting contributes beyond averaging

The clearest controlled comparison replaces adaptive weighting with an ordinary average. Both choices aggregate a variable number of hidden vectors into a fixed-size context. Both can be used with the same pointwise encoder and the same prediction stages. Their difference is whether the network learns unequal contributions across positions.

The variable-length results make the value of that choice visible. Attention achieves high accuracy on both tasks, while mean aggregation performs substantially worse. This supports a specific interpretation: the benefit is not explained merely by having a mechanism that accepts variable-length input. The manner of integration matters.

An ordinary average gives every hidden vector the same direct coefficient. The encoder can still learn useful representations, and the later network can still apply nonlinear transformations, but the aggregation does not explicitly distinguish more useful positions from less useful ones. Attention introduces that distinction through the learned scoring function.

The experiment does not reveal the exact internal strategy learned by the successful network. There are no displayed attention distributions, no position-by-position contribution analyses, and no intervention that removes particular weighted inputs. The comparison shows that the learned weighting mechanism helps the complete architecture; it does not establish a uniquely identified explanation of every prediction.

#### The extra parameters are a limited alternative explanation

The attention variant has more parameters than the mean variant, so the comparison is not perfectly parameter-matched. That is a legitimate qualification. A controlled architectural change often also changes the number of trainable values.

Here, however, the additional machinery is small and directly associated with scoring the hidden representations. The reported counts, 10,602 and 10,501, clarify the scale of the change. The paper’s argument is that a lightweight selection function produces a meaningful benefit.

A separate experiment adding unrelated parameters to the mean network would have strengthened the causal interpretation. Such a comparison is not reported. The evidence therefore favors the usefulness of learned aggregation in this design, while stopping short of excluding every possible benefit from a small capacity increase.

#### Length variation tests a different capability

The narrow-range and broad-range experiments are not simply repetitions at different settings. They distinguish adaptation to a particular length scale from simultaneous operation across many scales.

Within a narrow interval, a network may learn a mapping suited to a relatively predictable amount of aggregation. The broad-range setting removes much of that predictability. The successful attention network must produce useful context vectors in spite of substantial changes in how many representations enter the weighted average.

The mean baseline’s weaker broad-range results show that accepting an arbitrary number of input vectors is not the same as maintaining accurate behavior as their number changes. A fixed-size output interface alone does not guarantee robustness to input size.

The paper does not isolate every reason for that difference. It does not report controlled changes to score normalization, alternative pooling functions, or detailed analyses of hidden-vector magnitudes. Its result identifies the successful architectural choice without fully decomposing the learned computation behind it.

#### The order example is a structural test

The discussion supplies an especially clear analysis using a task involving symbols X and Y. Which target distinctions are possible depends on whether the relevant appearances occur as X then X, Y then Y, X then Y, or Y then X.

The architecture can distinguish the repeated-symbol cases because their contents differ. But it cannot separate X, Y from Y, X when those inputs differ only in arrangement. Independent encoding followed by weighted averaging produces the same aggregate for a reordered collection of otherwise identical inputs.

This is not presented as a numerical training ablation. It is a consequence of the computation. It gives the reader a stronger explanation of the limitation than a failed run would: the missing distinction is removed before the prediction stage receives its input.

The analysis also sharpens the interpretation of the arithmetic results. Attention provides selective access to content. It does not, in this form, provide access to temporal relationships between that content.

#### Other implementation choices are not fully ablated

The authors state that leaky rectifiers improved early convergence, but they do not report a numerical activation comparison. Similarly, hidden dimensionality remains D = 100 instead of being varied in a capacity study.

There is no reported comparison among multiple scoring functions, no systematic study of the later hidden transformation, and no experiment adding explicit position information. These omissions do not negate the central mean-versus-attention result. They define its scope: the paper establishes a useful simple architecture and a targeted aggregation comparison, rather than a comprehensive search over all reasons that architecture might succeed.

### Limitations

#### The authors’ central limitation: order is lost

The authors explicitly state that their architecture cannot solve tasks requiring temporal order when the required distinction is absent from the individual input representations. The aggregation returns the same result after a rearrangement of those representations.

The X and Y example makes the consequence concrete. An answer that depends on which symbol came before the other cannot be recovered from a representation that retains the symbols’ contributions but discards their arrangement.

This restriction is broader than a weakness on one particular benchmark. It follows from combining a pointwise encoder with order-insensitive aggregation. Training longer, adjusting the learning rate, or increasing the amount of training data does not change that structural property.

A careful application must therefore ask what the input vectors already encode. In the paper’s experiments, the pointwise transformation does not receive a recurrent history. The architecture should not be assumed to preserve relations that are not represented in those inputs.

#### The authors’ benchmark qualification: arithmetic is favorable

The paper openly acknowledges that applying this architecture to the addition and multiplication tests gives it a favorable match. The operations are commutative, so temporal order is not part of the target.

This means that success on these tests does not demonstrate a general solution to long-term memory. It demonstrates that some tasks described in that vocabulary can be solved by selecting and combining relevant information without preserving sequence order.

The distinction does not make the result trivial. Handling very long inputs, learning useful contributions, and remaining accurate across varying lengths are substantive capabilities. But those capabilities should be named directly rather than expanded into a claim about unrestricted sequential reasoning.

The authors themselves defend the experiments on this narrower basis. Their point is that attention allows useful input positions to influence the output even when those positions lie far apart within a long sequence.

#### The authors’ application claim remains prospective

The discussion proposes that order-insensitive integration could help with real tasks where the collection of evidence matters more than its arrangement. Document categorization is the principal example.

The paper does not report a document-classification experiment within its own evaluation. Its arithmetic results therefore cannot establish language-task performance. The connection is motivated by earlier work and by the architecture’s properties, rather than directly verified in these experiments.

The authors also mention parallel work applying attention-based embeddings to prune searches over long, high-dimensional sequences. That is useful context for the broader research direction, but the present paper does not reproduce those retrieval experiments or their measurements.

#### A careful reader’s limit: task construction is not fully restated

The detailed generation procedure for the synthetic arithmetic problems is delegated to earlier publications. The text specifies the architecture, training settings, metric, and sequence-length conditions, but it does not provide a complete standalone account of how every input and target is constructed.

That matters for replication and interpretation. Details of synthetic generation can determine which cues are available and how difficult it is to identify useful positions. A reader should not fill in those details from an assumed version of the benchmark and then treat the assumption as part of this paper’s evidence.

The conclusions that can be stated directly concern the named tasks under the authors’ implementation and the explicit length and training settings. More detailed claims about particular input markers or sampling restrictions require the task specifications to which the authors refer.

#### A careful reader’s limit: reported test use affects interpretation

The held-out test set is evaluated after every epoch, and training can stop when its accuracy reaches 100%. The reported procedure therefore uses test performance as part of the stopping decision.

The paper also reports the best fixed-length outcome over the learning rates it considers. It does not describe a distinct validation process that would let a reader cleanly separate all tuning decisions from final evaluation.

These choices should be included when assessing the reported numbers. They do not make the architecture incapable of solving the tasks, but they mean the evaluation procedure is more involved than training once under predetermined settings and inspecting an untouched test set only at the end.

#### A careful reader’s limit: uncertainty is not quantified

The report does not provide distributions across repeated random initializations, confidence intervals, or another measure of run-to-run variation. Its high accuracies and convergence statements are therefore reported outcomes rather than a quantified account of reliability across independent training runs.

This is particularly relevant when comparing how quickly different settings reach the stopping threshold. Initialization and optimization can affect convergence, yet the available account does not show how variable that convergence is.

Similarly, the variable-length experiment provides overall accuracy instead of a breakdown by length. The result demonstrates strong aggregate performance across the sampled range, while leaving the location and consistency of the residual errors unspecified.

#### A careful reader’s limit: efficient does not mean length-independent

Parallel computation changes the structure of the work; it does not remove the need to process the input. Each additional position still requires a representation and a score, and the aggregation must include contributions from the sequence.

The timing comparison supports an efficiency advantage for the reported workload. It should not be interpreted as showing that long inputs carry no computational cost or that the same time relationship must hold across implementations and hardware.

The fixed-size context is also a compression. Regardless of input length, the later prediction stages receive a vector of dimensionality D = 100. This is useful for the scalar arithmetic targets studied here, but the paper does not show that such a representation preserves every kind of information a more demanding task might require.

#### A careful reader’s limit: attention weights are not a full explanation

The architecture makes its aggregation weights available in principle, which can help inspect how the context is formed. But the paper does not establish that these weights alone explain the full prediction.

Each contribution depends both on its weight and on the contents of the hidden vector. The later nonlinear transformations also influence the output. A position with a large normalized weight is strongly represented in the aggregate calculation, but that fact is not equivalent to proving that it is the decisive cause of the final answer.

For [interpretability](https://md.research.elamur.ai/free/en/topics/interpretability/), the method offers visible intermediate quantities instead of a complete account of reasoning. Keeping that distinction clear preserves the paper’s practical appeal without assigning it an explanatory result it does not report.

### What came after

The later citation record connects this paper with work on sentiment analysis and document tagging. That is a natural thematic direction because the original discussion already identifies categorization as a setting where an order-insensitive aggregate may be useful. The available descriptions, however, establish citation relationships and research topics instead of the exact technical contribution borrowed from this paper.

[DataStories at SemEval-2017 Task 4](https://md.research.elamur.ai/free/en/papers/baziotis-2017-datastories-semeval-2017-task-4/) is a 2017 study of deep LSTM systems with attention for message-level and topic-based [sentiment analysis](https://md.research.elamur.ai/free/en/topics/sentiment-emotion/). Its title places attention within a language task that produces judgments about messages and topics.

The connection should be read at that level of specificity. The later study cites this paper and combines attention with recurrent processing. That does not by itself establish that it uses the same scalar scorer, the same normalization arrangement, or the same feed-forward encoder. In particular, an LSTM-based system retains a recurrent component, whereas the distinctive experiment in the earlier paper removes recurrence from the positionwise representation calculation.

What carries across conceptually is the separation between representing input content and weighting its contribution to a prediction. The earlier paper makes that separation explicit and tests it in a minimal arithmetic setting. The later title shows attention appearing alongside a richer sequence-processing architecture in a sentiment task. The citation alone does not identify which particular implementation decision followed from the earlier work.

[Automatic Text Tagging of Arabic News Articles](https://md.research.elamur.ai/free/en/papers/elnagar-2019-automatic-text-tagging-arabic-news/) is a 2019 study whose title identifies ensemble deep learning for tagging Arabic news. It also cites the feed-forward attention paper. Its application is closer to the document-categorization motivation discussed by the original authors than to the synthetic arithmetic experiments.

Here too, the available information does not establish a particular attention equation or a measured benefit attributable to this citation. The title supports a description of the task and the use of an ensemble approach; it does not support a detailed reconstruction of the architecture. It would therefore be unwarranted to claim that the news-tagging system reproduced the feed-forward design or demonstrated the same behavior on long inputs.

These later works show that the paper was cited beyond its original synthetic setting. They do not, by themselves, extend its experimental conclusions. The established result remains specific: a small learned weighting mechanism can make a feed-forward architecture effective on long, variable-length arithmetic inputs when the target does not depend on their order. The broader research idea is a reusable division of labor—represent observations independently where appropriate, learn their relative contributions, and evaluate carefully which relationships the aggregation preserves.

## Cite

Cite as Colin Raffel and Daniel P. W. Ellis. 2015. Feed-Forward Networks with Attention Can Solve Some Long-Term Memory Problems. arXiv (Cornell University).

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

```bibtex
@misc{raffel2015feed,
  title = {{Feed-Forward Networks with Attention Can Solve Some Long-Term Memory Problems}},
  author = {Colin Raffel and Daniel P. W. Ellis},
  year = {2015},
  doi = {10.48550/arxiv.1512.08756},
  eprint = {1512.08756},
  archivePrefix = {arXiv},
  url = {https://doi.org/10.48550/arxiv.1512.08756}
}
```

> 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)
