THE COMPARISON3 models

One text pipeline, three recurrent architectures, and trade-offs between accuracy, model size and training time.

What I was investigating

Movie reviews often contain long sentences, mixed opinions and sentiment that changes through a paragraph. I compared recurrent architectures to understand whether gating and bidirectional context improved sentiment classification compared with a basic RNN.

This page draws from my coursework report and its original training-loss figure. Final accuracy figures are intentionally withheld until I reconcile conflicting values in the report.

01 / PREPROCESSING

Different-length reviews, consistent inputs

The dataset contains labelled positive and negative IMDb reviews. I used lowercase tokenisation, a vocabulary capped at 20,000 common words, and sequences limited to 500 tokens. PyTorch data loaders assembled variable-length reviews into padded batches, while their true lengths were retained for the recurrent layers.

Passing true sequence lengths was important: otherwise a model might keep processing padding after the review text ended and create misleading final representations.

Dataset
IMDb movie reviews · binary sentiment
Stack
Python · PyTorch · text tokenisation
Training
Adam · 0.001 learning rate · batch size 64 · 5 epochs
Evaluation
Training loss, test classification and manual error inspection
02 / MODEL DESIGN

Memory comes at a computational cost

All three implementations used word embeddings, a recurrent layer, dropout and a final linear classifier. The vanilla RNN processed text left to right. The LSTM added gated memory; the bidirectional LSTM read the review in both directions and joined the two final hidden representations.

Model complexity and mean time per epoch, as reported in the assignment table
ArchitectureParametersEpoch time
Vanilla RNN2,659,58613.62 s
LSTM3,482,37031.75 s
Bidirectional LSTM4,928,77062.54 s

These figures illustrate the practical cost of richer sequence representations. I would not interpret a model as better from its complexity alone.

03 / ORIGINAL FIGURE

Comparing loss curves, not just final predictions

The report's training-loss curves show how the three architectures changed across the five training epochs. The vanilla RNN remained relatively high on this plot, while the LSTM and bidirectional LSTM decreased more sharply.

Original coursework training-loss graph comparing vanilla RNN, LSTM and bidirectional LSTM across five epochs
Figure 1. Training-loss comparison from the original submitted report. Select to enlarge.

The report contains two incompatible sets of test-accuracy figures—one in the comparison table and another in the discussion. Without the executed notebook or training logs, I cannot reliably identify which is final. Those numbers should not be published as settled results yet.

04 / ERROR ANALYSIS

Positive words do not always mean positive reviews

I also evaluated manually entered reviews and examined five misclassified IMDb examples. The report describes negative reviews that started positively or contained approving words before shifting to criticism. Those cases illustrate why sentiment classification needs context rather than isolated keywords.

Some examples also contained noisy HTML-like fragments. A future iteration could refine text cleaning, analyse per-class precision and recall, and test newer sequence architectures under the same resource budget.

05 / EVIDENCE STATUS

What is documented, and what remains unverified

The report documents architecture choices, preprocessing, parameter counts, an original training figure, a live prediction function and error-analysis observations. I have not yet been given the executed RNN notebook, so the reported accuracy disagreement remains unresolved.

Notebooks, model checkpoints and the original coursework report are not automatically available for public download. This is an evidence-backed draft, with metrics requiring final verification before deployment.