liveBook · Manning

Encoder

As explained in Time Series Forecasting Using Foundation Models

An encoder is the sequence-processing component of a transformer that receives token representations and transforms them into contextual representations.

An encoder is the sequence-processing component of a transformer. It receives embedded, position-aware time-series tokens and transforms them into contextual representations for the decoder. section 1.2

Each encoder combines self-attention with a feed-forward layer, and transformers usually stack many such layers. Unmasked self-attention relates each token to the known historical sequence, while multiheaded attention lets different heads learn patterns such as trends or seasonality. section 1.2.2

In time-series forecasting, the encoder:

  • Learns importance weights and dependencies among historical tokens. section 1.2.2
  • Builds increasingly deep representations as embeddings pass through stacked encoding layers. section 1.2.2
  • Passes its output to the decoder, which uses that representation to generate predictions. section 1.2.3

Pattern-focused attention

Different attention heads can specialize in different properties of a time series: one may identify trends while another identifies seasonal patterns. A visualization may also show stronger attention to nearby time steps than distant history. section 1.2.2

Figure 1.5 The encoder is made of many encoders that have the same architecture. An encoder is made of a self-attention mechanism and a feed-forward layer.
A diagram of a process

Description automatically generated

Use the encoder diagram to see the repeated self-attention and feed-forward structure across stacked encoding layers. section 1.2.2

How Time Series Forecasting Using Foundation Models covers it

How deep it goes
Explains stacked layers, self-attention, and multiheaded attention, but defers their mathematical details.
Examples
Illustrates nearby-token attention and separate attention heads for trends and seasonal patterns in time series.
What it assumes
Assumes familiarity with sequences and embeddings while introducing transformer components and positional order.
What you can do after
Evaluate/understand how encoder representations support autoregressive time-series predictions.
How it connects
Connects embeddings and positional encoding to self-attention, feed-forward layers, multiheaded attention, and the decoder.

Also explained in

Compare how 21 books explain encoder →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Time Series Forecasting Using Foundation Models. The section links point to the parts of the book it draws on.