Module 5 Assignment: Sequence modeling design note

Module 5 Assignment: Sequence modeling design note#

Theme#

Sequence models: RNNs and LSTMs

Scenario#

An operations group wants to forecast event sequences where order matters and recent context may not be sufficient.

Exercises#

  1. Define a sequence prediction task and identify input/output alignment.

  2. Compare simple RNN, LSTM, GRU, and one-dimensional convolution choices.

  3. Run the starter LSTM on synthetic ordered data and inspect tensor shapes.

  4. Explain one long-range dependency risk and a mitigation strategy.

Evidence Requirements#

  • A short explanation of the data, tensors, objective, and evaluation signal used in the starter experiment.

  • At least one meaningful modification to the starter code, with the changed variable named explicitly.

  • A comparison against the unmodified starter result or another defensible baseline.

  • A limitation statement that separates what the toy experiment demonstrates from what a production model would require.

Submission#

Submit a 600-900 word technical memo plus code, plots, tables, or shape traces needed to support your claims. The memo should read like a review artifact for another AI practitioner: concise, reproducible, and honest about uncertainty.

Rubric Focus#

  • Technical correctness and appropriate neural-network vocabulary.

  • Evidence from the starter experiment or a documented extension.

  • Connection between design choices and data/problem structure.

  • Clear treatment of limitations, failure modes, or next experimental gates.

import torch
from torch import nn

torch.manual_seed(5)
X = torch.randn(12, 6, 3)  # batch, time, features
lstm = nn.LSTM(input_size=3, hidden_size=8, batch_first=True)
head = nn.Linear(8, 1)
sequence_output, (h_n, c_n) = lstm(X)
prediction = head(sequence_output[:, -1, :])
print("sequence output shape:", tuple(sequence_output.shape))
print("final prediction shape:", tuple(prediction.shape))
sequence output shape: (12, 6, 8)
final prediction shape: (12, 1)

Reflection Prompts#

  • What changed when you modified the starter experiment, and why should that change matter?

  • Which result surprised you, and what diagnostic would you run next?

  • What assumption would you document before handing this model to another practitioner?

  • Which failure mode from the module reading is most relevant to your result?