EDA (Easy Data Augmentation) is a set of four simple, universal text augmentation operations — Synonym Replacement, Random Insertion, Random Swap, and Random Deletion — that require no pretrained models, no external APIs, and no GPU, yet deliver significant accuracy improvements on small text classification datasets (up to +3% on benchmarks with 500 training examples), proving that even trivially simple augmentation techniques can meaningfully reduce overfitting in NLP.
What Is EDA?
- Definition: A paper and technique (Wei & Zou, 2019) that proposes four dead-simple text augmentation operations that can be applied to any text classification dataset with a single line of code, using only a WordNet synonym dictionary.
- The Philosophy: Before reaching for BERT-based augmentation or back-translation, try the simplest thing first. EDA showed that naive word-level operations work surprisingly well — especially on small datasets where overfitting is the main bottleneck.
- Key Finding: On datasets with only 500 training examples, EDA improved accuracy by an average of 3.0%. On larger datasets (5,000+ examples), the improvement was smaller (~0.8%) because there's less overfitting to fix.
The Four Operations
| Operation | Process | Example |
|---|---|---|
| Synonym Replacement (SR) | Replace n random words with WordNet synonyms | "The quick brown fox" → "The fast brown fox" |
| Random Insertion (RI) | Insert a random synonym of a random word at a random position | "I love this movie" → "I love this fantastic movie" |
| Random Swap (RS) | Randomly swap two words in the sentence | "I love this movie" → "love I this movie" |
| Random Deletion (RD) | Delete each word with probability p | "I love this movie so much" → "I love movie much" |
Hyperparameters
| Parameter | Meaning | Recommended |
|---|---|---|
| α (alpha) | Fraction of words to change per operation | 0.1 (change ~10% of words) |
| n_aug | Number of augmented sentences per original | 1-4 for small datasets, 1 for large |
For a 10-word sentence with α=0.1: change ~1 word per operation.
Impact by Dataset Size
| Training Examples | Accuracy Without EDA | Accuracy With EDA | Improvement |
|---|---|---|---|
| 500 | 78.3% | 81.3% | +3.0% |
| 2,000 | 85.2% | 86.4% | +1.2% |
| 5,000 | 88.5% | 89.3% | +0.8% |
| Full dataset | 91.2% | 91.5% | +0.3% |
Implementation
import random
from nltk.corpus import wordnet
def synonym_replacement(sentence, n=1):
words = sentence.split()
for _ in range(n):
idx = random.randint(0, len(words) - 1)
synonyms = wordnet.synsets(words[idx])
if synonyms:
words[idx] = synonyms[0].lemmas()[0].name()
return ' '.join(words)
EDA vs Other NLP Augmentation
| Method | Quality | Speed | Requirements | Best For |
|---|---|---|---|---|
| EDA | Good | Instant | WordNet only | Quick baseline, small datasets |
| Back-Translation | Excellent | Slow (needs translation model) | GPU or API | Best paraphrases |
| Contextual (BERT) | Very good | Moderate (needs GPU) | Transformer model | Semantically coherent |
| nlpaug | Very good | Varies | pip install | Flexible multi-level |
| LLM Paraphrasing | Excellent | Slow + expensive | API access | Highest quality |
EDA is the proof that simple text augmentation works — demonstrating that four trivial word-level operations with nothing more than a WordNet dictionary can meaningfully improve text classification on small datasets, serving as the essential NLP augmentation baseline that more complex methods (back-translation, BERT-based) must justify their additional complexity against.
Explore 500+ Semiconductor & AI Topics
From EUV lithography to CUDA optimization — search the full knowledge base or chat with our AI assistant.