ArticleslgStudy

computer science

Backpropagation through time

Backpropagation through time is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Backpropagation through time rather than just read about it. In short: Backpropagation through time (BPTT) is a gradient-based technique for training certain types of recurrent neural networks, such as Elman networks. The algorithm was independently derived by numerous researchers.

Backpropagation through time — main illustration
Backpropagation through time — illustration

Key takeaways

  • Backpropagation through time belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Backpropagation through time to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Backpropagation through time from memory before moving on to harder problems.

Reference excerpt

Backpropagation through time (BPTT) is a gradient-based technique for training certain types of recurrent neural networks, such as Elman networks. The algorithm was independently derived by numerous researchers.

Algorithm

The training data for a recurrent neural network is an ordered sequence of k input-output pairs, ⟨𝐚0,𝐲0⟩,⟨𝐚1,𝐲1⟩,⟨𝐚2,𝐲2⟩,...,⟨𝐚k−1,𝐲k−1⟩. An initial value must be specified for the hidden state 𝐱0, typically chosen to be a zero vector. BPTT begins by unfolding a recurrent neural network in time. The unfolded network contains k inputs and outputs, but every copy of the network shares the same parameters. Then, the backpropagation algorithm is used to find the gradient of the loss function with respect to all the network parameters. Consider an example of a neural network that contains a recurrent layer f and a feedforward layer g. There are different ways to define the training cost, but the aggregated cost is always the average of the costs of each of the time steps. The cost of each time step can be computed separately. The figure above shows how the cost at time t+3 can be computed, by unfolding the recurrent layer f for three time steps and adding the feedforward layer g. Each instance of f in the unfolded network shares the same parameters. Thus, the weight updates in each instance (f1,f2,f3) are summed together.

Pseudocode Below is pseudocode for a truncated version of BPTT, where the training data contains n input-output pairs, and the network is unfolded for k time steps:

Back_Propagation_Through_Time(a, y) // a[t] is the input at time t. y[t] is the output Unfold the network to contain k instances of f do until stopping criterion is met: x := the zero-magnitude vector // x is the current context for t from 0 to n − k do // t is time. n is the length of the training sequence Set the network inputs to x, a[t], a[t+1], ..., a[t+k−1] p := forward-propagate the inputs over the whole unfolded network e := y[t+k] − p; // error = target − prediction Back-propagate the error, e, back across the whole unfolded network Sum the weight changes in the k instances of f together. Update all the weights in f and g. x := f(x, a[t]); // compute the context for the next time-step

Advantages BPTT tends to be significantly faster for training recurrent neural networks than general-purpose optimization techniques such as evolutionary optimization.

Disadvantages BPTT has difficulty with local optima. With recurrent neural networks, local optima are a much more significant problem than with feed-forward neural networks. The recurrent feedback in such networks tends to create chaotic responses in the error surface which cause local optima to occur frequently, and in poor locations on the error surface.

See also Backpropagation through structure

References

Worked examples

Example 1 — a first encounter with Backpropagation through time

Start with the simplest possible case. Write down what Backpropagation through time claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Backpropagation through time before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Backpropagation through time ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Backpropagation through time

In research
Backpropagation through time appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Backpropagation through time in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Backpropagation through time is common in secondary-school and first-year university syllabi. It links to neighbouring topics Artificial neural networks, so understanding it makes those chapters shorter.
In everyday life
Look for Backpropagation through time outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Backpropagation through time” →

How to study Backpropagation through time in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Backpropagation through time means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Backpropagation through time out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Backpropagation through time in simple terms?

Backpropagation through time (BPTT) is a gradient-based technique for training certain types of recurrent neural networks, such as Elman networks. The algorithm was independently derived by numerous researchers.

Why does Backpropagation through time matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Backpropagation through time?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Backpropagation through time.

Tags

  • Artificial neural networks

Keep exploring