lstm-imdb-256

⚠️ DEPRECATED — kept for legacy compatibility. This model was trained with max_seq_length=256 and an unconverged 50-epoch / 5e-5 schedule. For new work, use jongador/lstm-imdb-512, which covers ~95–98% of IMDB reviews (vs. ~85–90%), uses a tuned schedule (30 epochs, 1e-4 LR, early stopping), and achieves higher accuracy (86.47% vs. 85.42%).

BiLSTM trained on the IMDB sentiment classification dataset with max_seq_length=256. Trained as a victim model for adversarial NLP research (TextBugger / TextFooler / DeepWordBug-style attacks).

Model Details

  • Architecture: 1-layer BiLSTM with hidden size 150
  • Embeddings: GloVe 200d (pretrained)
  • Dropout: 0.3
  • Max sequence length: 256 tokens (words)
  • Task: Binary sentiment classification (positive / negative)

Training

Trained from scratch on the IMDB train split (25,000 examples) using TextAttack 0.3.x.

Hyperparameter Value
Epochs 50 (no early stopping)
Batch size 64
Learning rate 5e-5
Weight decay 0.01
Warmup steps 500
Random seed 786
Hardware NVIDIA RTX 3050 Laptop (4 GB VRAM)

Eval accuracy peaked around mid-training (85.42%) and degraded over the remaining epochs due to overfitting. The newer jongador/lstm-imdb-512 variant uses a higher learning rate (1e-4), fewer epochs (30), and early stopping (5-epoch patience) to avoid this regime.

Evaluation

Best epoch checkpoint on the IMDB test split (25,000 examples):

Metric Value
Accuracy 85.42%

How to Use

This model uses the TextAttack custom format and requires the textattack library. TextAttack's from_pretrained does not currently resolve Hugging Face Hub IDs — download the snapshot first via huggingface_hub, then pass the local path:

from huggingface_hub import snapshot_download
from textattack.models.helpers import LSTMForClassification

local_dir = snapshot_download(repo_id="jongador/lstm-imdb-256")
model = LSTMForClassification.from_pretrained(local_dir)

References

  • Morris, J. et al. (2020). TextAttack: A Framework for Adversarial Attacks, Data Augmentation, and Adversarial Training in NLP. EMNLP.

License

MIT

Downloads last month
22
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Dataset used to train jongador/lstm-imdb-256