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

TreeMix: Compositional Constituency-based Data Augmentation for Natural Language Understanding

Le Zhang, Zichao Yang, Diyi Yang

Introduction

Deep learning models for Natural Language Processing (NLP) often struggle with compositional generalization. While a model might correctly classify "This film is good" and "I do not like it," it may fail when these are combined into "This film is good and I do not like it." This highlights a fundamental gap in how models understand the way meaning is built from sub-parts, often relying on keyword heuristics rather than structural understanding.

The Limitations of Current Data Augmentation

Existing data augmentation (DA) methods generally fall into two categories, both with significant drawbacks:

  1. Rule-based methods (e.g., EDA): These often use random word deletions or swaps. Such operations frequently destroy the grammatical structure and semantic coherence of a sentence, leading to noisy training data.
  2. Mixup-based methods: These interpolate between data points, usually in a hidden vector space. While effective in computer vision, applying them to discrete text often loses explicit linguistic properties and makes the resulting "samples" uninterpretable.

The authors of TreeMix argue that for DA to be truly effective, it must respect the internal structure of language by swapping meaningful phrases—like noun phrases or verb phrases—rather than random tokens.

The TreeMix Method

TreeMix addresses these issues by combining constituency parsing with a Mixup strategy at the input level. The process is divided into four distinct stages:

  1. Decomposition: Using a constituency parser (such as Stanford CoreNLP), the system generates a syntax tree for a sentence, identifying meaningful sub-structures (subtrees) like "this poor film" or "little interest."
  2. Subtree Selection: Subtrees are selected based on a length constraint ($\lambda$) to ensure they are neither too short (lacking diversity) nor too long (introducing excessive noise).
  3. Composition (The Swap): A fragment from one sentence is replaced with a linguistically equivalent fragment from another. For instance, "They will find [little interest] in this poor film" might be transformed into "They will find [a touching love story] in this poor film."
  4. Soft Label Construction: TreeMix generates "weighted" labels based on the proportion of the sentence derived from each source. If 70% of the new sentence comes from a "Positive" sample and 30% from a "Negative" one, the label becomes 0.7 Positive / 0.3 Negative. This encourages the model to learn the specific contributions of different phrases to the overall meaning.
The TreeMix augmentation process: from constituency parsing to soft label construction.

Experimental Evaluation

TreeMix was evaluated across several benchmarks, including single-sentence classification (SST2, TREC, AG_NEWS, IMDb), pairwise sentence classification (RTE, MNLI, MRPC, QQP, QNLI), and the SCAN dataset, which specifically tests systematic compositionality.

Key Insights

  • Linguistic Structure vs. Random Spans: Comparisons with "RandMix" (swapping random spans) showed that TreeMix consistently performed better, proving that swapping valid constituents (NPs, VPs) provides a cleaner training signal.
  • Cross-Category Mixing: The method is most effective when mixing sentences from different classes, forcing the model to move beyond simple "keyword spotting" and instead analyze how different phrases interact to create meaning.
  • Granularity: Optimal results were found when swapped subtrees represented 10% to 30% of the total sentence length. Swapping more than 50% often introduced too much linguistic confusion.

Key Results and Performance

TreeMix achieved state-of-the-art (SOTA) performance, outperforming baselines like EDA, Back-Translation, and SSMix. On the SST2 sentiment dataset, it improved accuracy by nearly 1% over a standard BERT model.

One of the most significant findings was TreeMix's performance in low-resource settings. As shown in the figure below, the method acts as a powerful regularizer when training data is extremely limited (e.g., 1% or 2% of the original dataset), significantly outperforming standard BERT and RandMix.

Performance of TreeMix compared to baselines across different percentages of training data.

Furthermore, on the SCAN "jump" split, TreeMix achieved 72% accuracy, a massive improvement over the 0% baseline, confirming its ability to enhance systematic compositionality.

Limitations and Future Directions

Despite its success, TreeMix has some limitations:

  • Computational Overhead: Constituency parsing is more expensive than simple rule-based swaps, which may limit its application to massive real-time datasets.
  • Long-Form Text: The method was less effective on long documents (like IMDb reviews) where a single phrase swap has a negligible impact on overall sentiment.
  • Fluency: While better than random swaps, augmented sentences are not always perfectly grammatical. Future work may involve using generative models to "smooth" these sentences while preserving the compositional labels.

Summary updated

BibTeX
@inproceedings{zhang2022treemix,
  author = {Le Zhang and Zichao Yang and Diyi Yang},
  title = {{TreeMix: Compositional Constituency-based Data Augmentation for Natural Language Understanding}},
  booktitle = {Conference of the North American Chapter of the Association for Computational Linguistics},
  year = {2022},
  url = {https://openreview.net/forum?id=AS_4er_uWn6},
}
Figure