cnn-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/cnn-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.09% vs. 84.34%).

WordCNN (Kim, 2014) 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: WordCNN (Kim, 2014) with kernel sizes 3, 4, 5; 100 filters per kernel
  • 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 epoch 14 (84.34%) and degraded over the remaining ~36 epochs due to overfitting. The newer jongador/cnn-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 84.34%

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 WordCNNForClassification

local_dir = snapshot_download(repo_id="jongador/cnn-imdb-256")
model = WordCNNForClassification.from_pretrained(local_dir)

References

  • Kim, Y. (2014). Convolutional Neural Networks for Sentence Classification. EMNLP.
  • Morris, J. et al. (2020). TextAttack: A Framework for Adversarial Attacks, Data Augmentation, and Adversarial Training in NLP. EMNLP.

License

MIT

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

Dataset used to train jongador/cnn-imdb-256