NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Strawman: an Ensemble of Deep Bag-of-Ngrams for Sentiment Analysis

Kyunghyun ChoarXiv 2017

Abstract

This paper describes a builder entry, named "strawman", to the sentence-level sentiment analysis task of the "Build It, Break It" shared task of the First Workshop on Building Linguistically Generalizable NLP Systems. The goal of a builder is to provide an automated sentiment analyzer that would serve as a target for breakers whose goal is to find pairs of minimally-differing sentences that break the analyzer.

Introduction

In the contemporary landscape of Natural Language Processing (NLP), there is a persistent drive toward architectural complexity. Models often utilize deep transformers, recursive networks, or complex convolutional stacks to capture the nuances of human language. However, the "Strawman" model—an ensemble of deep bag-of-ngrams—serves as a critical reminder that well-executed, simple baselines can often outperform more sophisticated counterparts. Originally designed as a naive target for adversarial testing, Strawman demonstrated surprising resilience and performance in sentiment analysis.

The "Build It, Break It" Challenge

The model was developed for the "Build It, Break It" shared task at the First Workshop on Building Linguistically Generalizable NLP Systems. This competition features a unique adversarial structure: "builders" create sentiment analyzers, while "breakers" attempt to identify pairs of minimally-differing sentences (e.g., changing a single word) that cause the analyzer to fail.

The primary objective of this task is to evaluate robustness. While many high-performing NLP models achieve impressive accuracy on standard benchmarks, they are often "brittle" when faced with small, adversarial perturbations. Strawman was intended to be the most straightforward baseline possible to serve as a benchmark for these adversarial attacks.

Methodology: The Strawman Architecture

Strawman is intentionally designed for simplicity, utilizing an ensemble of five identical deep bag-of-ngrams classifiers.

Model Architecture

Each individual classifier in the ensemble follows a streamlined pipeline:

  1. Input: The model takes one-hot representations of words and bigrams (up to $n=2$).
  2. Embedding Layer: These discrete inputs are mapped into continuous vectors.
  3. Average Pooling: The vectors for all n-grams in a sentence are aggregated via averaging, providing a fixed-length representation regardless of sentence length.
  4. Hidden Layer: A single 32-dimensional hidden layer with a tanh activation function.
  5. Output: A binary softmax layer for positive/negative sentiment classification.

The Power of Ensembling

The "secret sauce" of the system is its ensemble nature. Cho trained five versions of this architecture, each initialized with a different random seed. The final prediction is the average of the output distributions from all five models. This approach was highly efficient; the model was trained using the Adam optimizer on a standard laptop CPU in approximately 10–20 minutes, requiring no GPU acceleration.

Data and Training

The model was trained on the dataset provided by the shared task organizers, which included:

  • Sentences: 6,920 examples.
  • Phrases: 166,737 examples.

During preprocessing, "neutral" labels and confidence scores were discarded to focus strictly on binary (+1/-1) classification. The final training set consisted of 160,000 examples, with 10,000 reserved for validation. The vocabulary was restricted to the 100,000 most frequent unigrams and bigrams found in the training data.

Results and Insights

Despite its self-deprecating name, the Strawman model proved remarkably difficult to defeat.

Performance Metrics

  • Ranked #1 in Average F1 Score: Strawman outperformed significantly more complex systems, including a recursive deep network (Builder Team 5) and a convolutional neural network (Builder Team 6).
  • Adversarial Resilience: In terms of the "broken case rate" (the frequency with which a breaker successfully fooled the system), Strawman ranked 4th out of 6.
  • Competitive Robustness: Even in the adversarial metric, Strawman was only approximately 1% behind the top-ranked system, suggesting that its simple architecture was nearly as robust as more specialized, structurally complex models.

Key Takeaways

  1. Ensembling Benefits: Even simple models gain significant resilience from ensembling. Averaging multiple "weak" learners helps mitigate the specific quirks or errors inherent in any single model initialization.
  2. Sufficiency of Local Cues: While deep learning often emphasizes long-range dependencies, many sentiment cues are local. Bigrams (word pairs) capture enough context to identify most sentiment shifts (e.g., "not good") without the overhead of recurrent or recursive structures.
  3. Complexity vs. Robustness: The results suggest that sophisticated models, such as Recursive Deep Networks, may actually be more vulnerable to adversarial attacks. Their complex structural assumptions may provide a larger "attack surface" for breakers to exploit.

Limitations and Future Work

Cho identifies several vulnerabilities in the Strawman approach:

  • Vocabulary Sensitivity: Reliance on a fixed n-gram vocabulary makes the model susceptible to unknown words or bigrams introduced by breakers.
  • Compositional Limits: The model cannot process non-compositional expressions longer than two words. If sentiment is determined by a three-word interaction, the model remains blind to it.
  • Data Sparsity: The limited number of full sentences in the training set restricts the model's ability to generalize to complex linguistic structures.

Future iterations could address these issues by incorporating character-level modeling to handle out-of-vocabulary terms or by developing hybrid models that combine n-gram simplicity with the structural awareness of more advanced neural architectures.

Summary updated

BibTeX
@misc{cho2017strawman,
  author = {Kyunghyun Cho},
  title = {{Strawman: an Ensemble of Deep Bag-of-Ngrams for Sentiment Analysis}},
  year = {2017},
  eprint = {1707.08939},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1707.08939},
}
Figure