Abstract
Most neural models for sentence representation rely on the principle of compositionality, assuming a sentence's meaning is strictly the sum of its constituent parts. However, non-compositional expressions like idioms (e.g., "go bananas") challenge this assumption. We present an adaptive compositional model that introduces a dynamic switch to decide whether a phrase should be treated as a literal combination of words or as a single idiomatic unit. Our approach significantly improves performance on sentiment analysis tasks involving idiomatic language while remaining competitive on standard benchmarks.
Introduction
In Natural Language Processing (NLP), recursive neural networks such as Tree-LSTMs typically build sentence representations by composing word vectors step-by-step according to a syntax tree. This relies on the principle of compositionality: the idea that the meaning of a complex expression is determined by the meanings of its constituent parts.
However, human language is replete with non-compositional phrases—idioms, metaphors, and fixed expressions—where the literal meaning of the words does not reflect the intended sense. Forcing a model to compose these words literally introduces semantic "noise," leading to errors in downstream tasks like sentiment analysis. The challenge lies in creating a model that knows when to "read between the lines" and when to take words at face value.
Methodology
To address this, we propose an extension to the Tree-structured Long Short-Term Memory (T-LSTM) network by introducing three novel components:
1. The Compositional Switch ($\alpha$)
We introduce a parameterized controller that outputs a scalar value $\alpha$ between 0 and 1. This value acts as a gate, determining the final representation $h$ by balancing the literal composition ($h^c$) against a non-compositional representation ($h^n$).
2. Non-compositional Encoders
We explore two methods for representing idiomatic meanings:
- Retrieval Model (RM): This model directly retrieves a pre-learned vector for a specific phrase from an external memory lookup table.
- Compositional Model (CM): This model uses a separate neural transformation to "re-compose" words in a dedicated "idiomatic space." This allows the model to generalize to morphological variations of an idiom, such as recognizing that "went bananas" shares the same idiomatic root as "go bananas."
3. Hybrid Tree-Sequence LSTM (HT-LSTM)
To resolve ambiguity (e.g., "around the corner" can be literal or figurative), we integrate a sequence-based LSTM. This provides tree nodes with global context, helping the switch decide if a phrase is being used idiomatically within a specific sentence.
Experimental Results
We evaluated our models on five sentiment classification datasets, including a specialized idiom-enriched corpus and standard benchmarks like SST-2 and SUBJ.
- Idiom Handling: On the idiom-enriched dataset, our AdaHT-LSTM-CM model achieved an F-measure of 62.1, significantly outperforming the standard T-LSTM (55.2) and BiLSTM (54.5).
- Standard Benchmarks: The model remained highly competitive, achieving 87.8% accuracy on SST-2 and 94.1% on SUBJ, outperforming several state-of-the-art recursive and convolutional architectures.
Analysis: The Role of Context
A critical insight from our work is that the "switch" is not a static lookup but a context-aware mechanism. By utilizing the HT-LSTM, the model can distinguish between literal and figurative uses of the same phrase.
As shown in the table above, the phrase "wooden spoon" receives a low non-compositionality score (0.21) when used literally to describe a kitchen utensil, but a very high score (0.95) when used idiomatically to refer to coming in last in a competition. This adaptability allows the model to correctly shift sentiment predictions; for instance, recognizing "at fever pitch" as a positive non-compositional unit where a standard T-LSTM might fail.
Conclusion and Future Work
Our adaptive semantic compositionality model demonstrates that explicitly handling non-compositional units improves sentence modelling. While the model currently relies on external parsers and has constraints on phrase length, it represents a significant step toward models that can truly understand the nuances of human language. Future work will focus on "joint identification," where models learn to identify collocations and their meanings simultaneously without relying on predefined phrase candidates.
Summary updated