Temporal models

0.0(0)
Studied by 0 people
call kaiCall Kai
Locked
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/167

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 10:56 AM on 9/6/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

168 Terms

1
New cards

Why does sequential recurrence limit parallel computation over a trajectory?

A recurrent model must compute step t from an earlier hidden state before computing step t+1, creating a serial dependency chain across time.

2
New cards

Why can recurrent models struggle with very long-range dependencies?

Information and gradients must pass through many sequential transitions, so distant signals can be weakened, distorted, or hard to optimize.

3
New cards

What core mechanism lets a Transformer model dependencies without recurrence?

Attention directly relates sequence elements by computing content-dependent interactions between queries and keys and aggregating values.

4
New cards

What training-time parallelism advantage does a Transformer have over a recurrent model?

All positions in an unmasked encoder, and all causally masked positions during teacher-forced decoder training, can be processed in parallel within a layer.

5
New cards

How does the computational path between two distant tokens differ in self-attention and recurrence?

A self-attention layer can connect the tokens directly, whereas a recurrent model normally passes information through a chain whose length grows with temporal distance.

6
New cards

What sequence mapping was the original encoder-decoder Transformer designed to learn?

It maps an input sequence (x₁, x₂, …, x_T) to an output sequence, originally for sequence-to-sequence tasks such as machine translation.

7
New cards

Which two main sublayers does each encoder layer contain in the supplied description?

A multi-head self-attention sublayer and a two-layer position-wise feed-forward network.

8
New cards

What additional sublayer distinguishes the original Transformer decoder from the encoder?

Encoder-decoder cross-attention, which lets decoder states attend to encoder outputs.

9
New cards

What does self-attention mean in a Transformer encoder?

Queries, keys, and values are all derived from the same sequence representation, so each position aggregates information from positions in that sequence.

10
New cards

What is the difference between modeling a trajectory in observation space and in latent space?

Observation-space modeling operates on observed states or sensory tokens; latent-space modeling operates on learned compressed representations.

11
New cards

Why is an embedding layer used before Transformer processing?

It maps each discrete or raw input token into a continuous d_model-dimensional representation on which learned projections and neural transformations can operate.

12
New cards

Why must a non-recurrent Transformer receive positional information?

Content attention alone does not encode sequence order, so the model needs positional signals to distinguish where otherwise similar tokens occur.

13
New cards

What are the two decoder modifications emphasized in the supplied text?

Its self-attention is causally masked to hide future tokens, and it adds encoder-decoder attention over encoder outputs.

14
New cards

What temporal capability do the reviewed deep models provide to reinforcement-learning agents?

By predicting or encoding temporal regularities, they can support anticipation, planning, and generalization across environments.

15
New cards

What empirical information is absent from the supplied passage?

It gives no datasets, quantitative results, evaluation metrics, baselines, uncertainty estimates, or ablation outcomes, so it motivates mechanisms but does not empirically establish superiority.

16
New cards

For X ∈ ℝ^(T×d_model), how are the query, key, and value matrices formed?

Q = XW^Q, K = XW^K, and V = XW^V, using learned linear projections.

17
New cards

If W^Q and W^K are in ℝ^(d_model×d_k), what are the shapes of Q and K?

Both Q and K have shape T×d_k.

18
New cards

What is the general shape of W^V and why is the supplied notation slightly restrictive?

Generally W^V ∈ ℝ^(d_model×d_v), giving V ∈ ℝ^(T×d_v); the passage writes d_k for all three projections even though it later distinguishes d_v.

19
New cards

In attention, what functional role does a query vector q_t play?

It represents what position t is seeking from the available tokens and is compared with their keys to form relevance scores.

20
New cards

In attention, what functional role does a key vector k_j play?

It represents the features by which token j can be matched against a query.

21
New cards

In attention, what functional role does a value vector v_j play?

It carries the information from token j that will be aggregated into an output if the corresponding attention weight is large.

22
New cards

What does the unscaled dot product q_t·k_j represent?

It is a learned compatibility score measuring how relevant token j is to the information sought at position t.

23
New cards

Given Q,K ∈ ℝ^(T×d_k), what is the shape and meaning of QKᵀ?

It is T×T; entry (t,j) is the query-key compatibility score from target position t to source position j.

24
New cards

State the scaled dot-product attention equation.

Attention(Q,K,V) = softmax(QKᵀ/√d_k)V.

25
New cards

Why divide attention logits by √d_k?

If query and key components have roughly unit variance, their dot product variance grows like d_k; division by √d_k keeps logit scale roughly stable and reduces softmax saturation.

26
New cards

Along which axis is softmax normally applied to QKᵀ in self-attention?

Across the key positions for each query row, so every query obtains a distribution over the tokens it may attend to.

27
New cards

What property does each row of an unmasked attention-weight matrix have after softmax?

Its entries are nonnegative and sum to 1.

28
New cards

Write the output for a single query position t as a sum over values.

o_t = Σ_j α_tj v_j, where α_tj = exp(q_t·k_j/√d_k) divided by Σ_m exp(q_t·k_m/√d_k).

29
New cards

If V ∈ ℝ^(T×d_v), what is the shape of a single-head attention output?

T×d_v, because a T×T attention matrix multiplies the T×d_v value matrix.

30
New cards

Why is a head output described as context dependent?

The weights on the values change with the current query and all available keys, so the representation of a token depends on the surrounding sequence.

31
New cards

If all allowed attention logits for a query are equal, what weights result?

A uniform distribution over the allowed keys, so the output is their arithmetic mean in value space.

32
New cards

If one allowed attention logit is much larger than all others, what happens to the output?

Softmax places nearly all weight on that key, so the output approaches its associated value vector.

33
New cards

If every value vector in a head is identical, can changing the attention weights change that head’s output?

No. Any normalized weighted average of identical values equals that same value vector.

34
New cards

Without positional information, what ordering property does self-attention have?

It is permutation equivariant: permuting input tokens permutes the outputs in the same way, rather than revealing an intrinsic order.

35
New cards

How do positional encodings change content-only self-attention?

They alter each token representation as a function of position, allowing the learned queries, keys, and values to depend on both content and location.

36
New cards

Why can attention help with distant temporal dependencies?

A token can place weight directly on any visible earlier position instead of relying only on repeated step-to-step state transitions.

37
New cards

What is the leading time complexity of dense self-attention in sequence length T?

Forming and using the T×T attention matrix costs O(T²d) up to projection terms, where d is a head or model width.

38
New cards

What is the leading memory issue of dense self-attention?

Storing attention logits or weights requires O(T²) memory per layer and head group, which can dominate for long trajectories.

39
New cards

For q = (1,0), k₁ = (1,0), k₂ = (0,1), d_k = 2, and scalar values v₁ = 2, v₂ = 0, what is the attention output?

The logits are (1/√2, 0), giving weights about (0.67, 0.33); the output is about 0.67·2 + 0.33·0 = 1.34.

40
New cards

What happens if the same vector c is added to every key for a fixed set of queries?

For each query, q·c adds the same scalar to every logit; row-wise softmax cancels that common shift, so the attention weights are unchanged.

41
New cards

What happens to attention sharpness if a query is multiplied by a large positive scalar while keys are fixed?

Its logits spread farther apart, usually making softmax more peaked around the largest compatibility score.

42
New cards

How can the attention scale be interpreted as a softmax temperature?

Dividing logits by √d_k is equivalent to using temperature √d_k; a higher temperature produces flatter weights, while a lower temperature produces sharper weights.

43
New cards

How is a causal attention mask applied mathematically?

Disallowed future logits are set to −∞, or a sufficiently negative value, before softmax so their resulting weights are zero.

44
New cards

Why must masking occur before softmax rather than zeroing logits before softmax?

A zero logit still receives positive probability; setting a disallowed logit to −∞ makes its softmax probability exactly zero in theory.

45
New cards

What is the purpose of a padding mask in attention?

It prevents real tokens from assigning weight to padded sequence positions that contain no valid data.

46
New cards

For cross-attention with U decoder positions and T encoder positions, what is the score-matrix shape?

U×T, because U decoder queries are compared with T encoder keys.

47
New cards

In encoder-decoder cross-attention, where do Q, K, and V normally come from?

Queries come from the decoder stream, while keys and values come from encoder outputs.

48
New cards

Why is scaled dot-product attention not identical to cosine-similarity attention?

The dot product depends on vector magnitudes as well as angle, whereas cosine similarity explicitly normalizes vector norms.

49
New cards

What optimization problem can occur if unscaled dot products grow very large?

Softmax can saturate near one-hot probabilities, producing small gradients for most alternatives and making learning less stable.

50
New cards

Are attention weights fixed after training for a given position index?

No. They are dynamically recomputed from the current input-derived queries and keys, so they vary with sequence content.

51
New cards

Before the output projection, where does a single attention output lie relative to its allowed value vectors?

Because softmax weights are nonnegative and sum to one, it is a convex combination of the allowed value vectors.

52
New cards

If Q = K, is the final attention-weight matrix necessarily symmetric?

No. QKᵀ is symmetric, but row-wise softmax uses a different normalizer for each row, which can break symmetry.

53
New cards

What is the maximum rank of the unnormalized score matrix QKᵀ before masking?

At most d_k, and also at most T, because it is the product of a T×d_k matrix and a d_k×T matrix.

54
New cards

Why does “attend across arbitrary time spans” require qualification?

A model can directly connect any positions inside its processed context, but finite context windows, memory cost, positional behavior, and training distribution still bound usable time spans.

55
New cards

Does a short attention path guarantee that the model will use a distant dependency?

No. It makes the interaction representable, but learning it still depends on data, optimization, capacity, positional signals, and whether the target rewards using it.

56
New cards

Why might a single attention head be insufficient?

One head has one set of projections and one attention pattern, which can limit its ability to represent several distinct relation types simultaneously.

57
New cards

State a standard per-head multi-head attention formula using a common input X.

head_i = Attention(XW_i^Q, XW_i^K, XW_i^V).

58
New cards

Why is the supplied formula head_i = Attention(QW_i^Q, KW_i^K, VW_i^V) potentially ambiguous?

The passage previously defines Q, K, and V as projected from X, so multiplying them by head projections can imply an unintended second projection unless Q, K, and V are instead generic inputs.

59
New cards

For h heads with per-head value width d_v, what is the shape after concatenating their outputs over T tokens?

T×(h d_v).

60
New cards

What does the multi-head output projection W^O do?

It maps the concatenated h d_v-dimensional head representation back to d_model and learns how to mix information across heads.

61
New cards

What shape must the multi-head output projection have?

W^O ∈ ℝ^((h d_v)×d_model).

62
New cards

If d_k = d_v = d_model/h, what width does concatenation produce?

h d_v = d_model, so concatenating all heads restores the model width before W^O.

63
New cards

Under the common split-head configuration and ignoring biases, roughly how many parameters do Q, K, V, and output projections contain together?

About 4d_model²: three d_model×d_model combined projections plus one d_model×d_model output projection.

64
New cards

Does using multiple heads guarantee that the heads learn distinct relations?

No. Heads can become redundant or unused; diversity is an empirical outcome, not a mathematical guarantee.

65
New cards

What ablation tests whether multiple heads are necessary rather than merely increasing parameter count?

Compare different head counts while matching total model width, parameter count, training budget, and downstream evaluation; optionally prune heads after training.

66
New cards

Why is W^O useful even when concatenated heads already have width d_model?

It lets the model learn arbitrary linear combinations across head subspaces instead of leaving them as permanently separated feature blocks.

67
New cards

State the two-layer feed-forward network used in the supplied text.

FFN(x) = ReLU(xW₁ + b₁)W₂ + b₂, where ReLU(a) = max(0,a) elementwise.

68
New cards

What are the FFN weight shapes in the supplied architecture?

W₁ ∈ ℝ^(d_model×d_ff) and W₂ ∈ ℝ^(d_ff×d_model).

69
New cards

What does “position-wise” mean for the Transformer FFN?

The same FFN is applied independently to every sequence position; it transforms features within a token but does not directly mix tokens.

70
New cards

Are different FFN parameters learned for different sequence positions?

No. The parameters are shared across positions within a layer, although different Transformer layers normally have different FFN parameters.

71
New cards

Why is d_ff often larger than d_model?

The expansion gives each token a higher-dimensional nonlinear feature space before projection back to d_model, increasing representational capacity.

72
New cards

What role does ReLU play in the supplied FFN?

It adds an elementwise nonlinearity between the two linear transformations, allowing the FFN to represent more than a single affine map.

73
New cards

Why is it imprecise to say that only the FFN introduces nonlinearity into a Transformer?

The FFN does add an explicit activation, but softmax attention and layer normalization are also nonlinear operations.

74
New cards

Ignoring biases, how many parameters does one FFN contain?

2d_model d_ff, from W₁ and W₂.

75
New cards

What behavior would an FFN-removal ablation test?

It would test whether attention-based token mixing alone provides enough per-token feature transformation; a drop would support the FFN’s contribution, though parameter-count changes must be controlled.

76
New cards

State the sinusoidal positional encoding for even and odd dimensions.

PE(pos,2i) = sin(pos/10000^(2i/d_model)) and PE(pos,2i+1) = cos(pos/10000^(2i/d_model)).

77
New cards

Why are sine and cosine paired at each positional frequency?

The pair provides two phases of the same frequency, yielding a smooth two-dimensional representation of position at that scale.

78
New cards

How do positional frequencies change as dimension index i increases in the supplied encoding?

The denominator grows with i, so the angle changes more slowly with position and the corresponding wavelength becomes longer.

79
New cards

How is a token embedding combined with its positional encoding?

z_pos = x_pos + PE_pos.

80
New cards

What shape must x_pos and PE_pos have for elementwise addition?

Both must have model width d_model, producing z_pos ∈ ℝ^d_model.

81
New cards

What is the shape of the stacked initial encoder representation h^(0) = Z?

T×d_model, with one combined token-plus-position vector per row.

82
New cards

What failure would be expected if positional encodings were removed from a task where order matters?

The model could still compare token content but would have no intrinsic way to distinguish permutations containing the same token multiset, so order-sensitive performance should degrade.

83
New cards

Why do sinusoidal encodings not automatically guarantee reliable extrapolation to longer sequences?

Although they can be evaluated at unseen positions, the model may not have learned how to interpret those phase patterns outside the training range.

84
New cards

What useful relative-position property do sinusoidal encodings have?

For a fixed offset, the sine-cosine vector at pos+offset can be expressed as a linear transformation of the vector at pos, which can make relative displacement accessible.

85
New cards

What is one tradeoff between learned absolute positions and fixed sinusoidal positions?

Learned positions can adapt to training data but have no native parameters beyond trained indices; sinusoids require no learned table and are evaluable beyond training length, though neither guarantees length generalization.

86
New cards

Write the supplied post-normalization encoder attention update.

h_tilde^(l) = LayerNorm(h^(l−1) + MultiHead(h^(l−1), h^(l−1), h^(l−1))).

87
New cards

Write the supplied post-normalization encoder FFN update.

h^(l) = LayerNorm(h_tilde^(l) + FFN(h_tilde^(l))).

88
New cards

What is the purpose of a residual connection around a Transformer sublayer?

It preserves a direct identity path for representations and gradients while allowing the sublayer to learn a refinement.

89
New cards

State the scalar feature update performed by layer normalization.

For feature i, x̂_i = (x_i−μ)/√(σ²+ε), then y_i = γ_i x̂_i + β_i.

90
New cards

Across which dimensions are μ and σ² computed in the supplied LayerNorm description?

Across the feature dimensions of each token’s vector, not across sequence positions or batch examples.

91
New cards

What are γ and β in layer normalization?

Learned per-feature scale and shift parameters that let the network adjust the normalized representation.

92
New cards

Why is ε included in layer normalization?

It prevents division by zero and improves numerical stability when the feature variance is very small.

93
New cards

Is the supplied encoder update pre-norm or post-norm?

Post-norm, because LayerNorm is applied after adding each sublayer output to its residual input.

94
New cards

How does a common pre-norm block differ from the supplied post-norm block?

Pre-norm applies LayerNorm before attention or the FFN and then adds the residual; it often improves optimization in deep Transformers, but it is not the equation shown in the passage.

95
New cards

Which encoder operations mix information across token positions?

Self-attention mixes positions; the FFN and standard LayerNorm act independently at each position.

96
New cards

Why can stacking Transformer layers help even though one self-attention layer has global visibility?

Depth allows repeated cycles of relation-dependent aggregation and nonlinear feature transformation, composing higher-order representations.

97
New cards

What exactly does causal masking prevent in a decoder?

At position t, it prevents attention to tokens at positions greater than t, blocking direct access to future outputs.

98
New cards

State the supplied autoregressive output distribution.

P(y_t | y_<t, X) = softmax(h_t W_vocab + b_vocab), where the projection maps the decoder state to vocabulary logits.

99
New cards

What are the shapes of the decoder vocabulary projection and its output logits?

W_vocab ∈ ℝ^(d_model×|V|), so h_t W_vocab + b_vocab has |V| logits.

100
New cards

What notation collision occurs in the supplied text?

W^O denotes both the multi-head output projection and the decoder-to-vocabulary projection, even though they have different roles and shapes.