Imagination-Augmented Natural Language Understanding
Abstract
Human brains integrate linguistic and perceptual information simultaneously to understand natural language, and hold the critical ability to render imaginations.
Such abilities enable us to construct new abstract concepts or concrete objects, and are essential in involving practical knowledge to solve problems in low-resource scenarios.
However, most existing methods for Natural Language
Understanding (NLU) are mainly focused on textual signals.
They do not simulate human visual imagination ability, which hinders models from inferring and learning efficiently from limited data samples.
Therefore, we introduce an
I magination-
A ugmented
C ross-modal E ncoder (iACE) to solve natural language understanding tasks from a novel learning perspective—imagination-augmented cross-modal understanding.
iACE enables visual imagination with external knowledge transferred from the powerful generative and pretrained vision-and-language models.
Extensive experiments on GLUE (Wang et al., 2018) and
SWAG (Zellers et al., 2018) show that iACE achieves consistent improvement over visuallysupervised pre-trained models.
More importantly, results in extreme and normal few-shot settings validate the effectiveness of iACE in low-resource natural language understanding circumstances.
Introduction
Cognitive neuroscience studies reveal neural activation in vision-related brain areas when reading text (Just et al., 2004) and show a tight relationship between brain areas processing linguistic and visual semantic information (Popham et al., 2021).
In addition, visual imagery improves comprehension during human language processing (Sadoski and Paivio, 1994).
Such imagination empowers hu- Premise: A senior is waiting at the window of a restaurant that serves sandwiches. Hypothesis: A man is waiting in line for the bus. Contradiction?
Entailment?
Neutral? man brains with generalization capability to solve problems with limited supervision or data samples.
However, the field of Natural language Understanding has mainly been focused on building machines based solely on language, ignoring the inherently grounded imagination from the external visual world.
These studies either learn text-only representations from language corpora (Devlin et al., 2019; Liu et al., 2019; Lan et al., 2020) or implicitly involve retrieved visual supervision in pre-trained language models (Tan and Bansal, 2020).
Thus, their approaches appear limited in transferring the connection between language understanding and visual imagination to downstream tasks, which are essential to solving low-resource circumstances.
In addition, these methods are limited to text-only augmentations, whereas visual imaginations leverage cross-modal augmentations to deal with lowresource situations.
Human brains are multi-modal, integrating linguistic and perceptual information simultaneously.
Intuitively, the machines could achieve a higherlevel understanding of natural language and better learning transference by imitating the procedure of human imagination behavior.
Inspired by this, we propose to understand lan- guage with the integration of linguistic and perceptual information via introducing imagination supervision into text-only NLU tasks.
To imitate the imagination-augmented understanding process as shown in Figure 1 with text-only data, we devise a procedure with two steps: 1) pre-train a visually-supervised Transformer over paired text and images retrieved from large-scale language corpus and image set, and 2) construct the imagination with a generative model and fine-tune on downstream NLU datasets by learning the paired imagination and natural language in a cross-modal embedding.
We show a detailed description of the cross-modal imagination process for a specific Natural Language Inference task in Figure 2.
In this way, we utilize machine imagination to improve the performance of natural language understanding.
We adopt the few-shot learning setting to study the potential of using less human effort of annotation for our proposed iACE to learn the natural language with the help of imagination.
Large margin performance gain in both extreme and normal few-shot settings demonstrate the effectiveness of iACE in solving problems with limited data samples.
In the full data setting of GLUE (Wang et al., 2018) and SWAG (Zellers et al., 2018), we observe the consistent performance gain of our proposed iACE over the visually-supervised approach (e.g.,
VOKEN (Tan and Bansal, 2020)) upon four language base models (e.g., BERT, RoBERTa).
In summary, the main contributions of our work are as follows:
• We propose to solve the text-only learning problem in natural language understanding tasks from a novel learning perspective: imagination-augmented cross-modal language understanding.
• To address the problem mentioned above, we devise iACE to generate imaginations in a cross-modal representation space to guide the fine-tuning of the visually supervised language models.
• Experimental results in the few-shot setting validate the consistent superiority of iACE over baselines in tackling the low-resource situation.
In full settings, iACE maintains the improvement in GLUE and SWAG.
[Figure]
Related Work Visually-aided Language Learning
Previous research attempt to introduce visual information to improve language learning on various Natural Language Processing (NLP) scenarios, including but not limited to machine translation (Grubinger et al., 2006; Elliott et al., 2016), information retrieval (Funaki and Nakayama, 2015; Gu et al., 2018), semantic parsing (Christie et al., 2016; Shi et al., 2019), natural language inference (Xie et al., 2019), bilingual lexicon learning (Kiela et al., 2015; Vulic et al., 2016), natural language generation evaluation (Zhu et al., 2021), spatial commonsense reasoning (Liu et al., 2022) and language representation learning (Lazaridou et al., 2015;
Collell et al., 2017;
Kiela et al., 2018; Zablocki et al., 2019;
Lu et al., 2019; Li et al., 2019; Sun et al., 2019; Huang et al., 2020; Luo et al., 2020; Chen et al., 2020; Li et al., 2020; Tan and Bansal, 2020;
Radford et al., 2021).
While most of these studies acquire visual information through retrieval from the web or large-scale image sets, a recent line of studies attempt to generate visual supervision from scratch.
The visual information can either be provided in the form of representation (Collell et al., 2017;
Long et al., 2021) or concrete images (Gu et al., 2018; Zhu et al., 2021).
Though previous studies generate machine imagination, they only tackle specific tasks, such as machine translation (Long et al., 2021) or information retrieval (Gu et al., 2018).
To the best of our knowledge, we are the first to utilize machine abstract imagination from large pretrained vision and language models to improve general NLU tasks.
Recently, VOKEN (Tan and Bansal, 2020) incorporate retrieved token-level visual information into existing transformer models and achieve consistent improvement.
iACE is different from this work for two aspects: 1) we explicitly encode visual imag
ination during fine-tuning.
2) we propose a novel model to borrow knowledge from imagination in both training and inference.
Few-shot Natural Language Understanding
Natural Language Understanding (NLU) is a subfield in NLP that involves a broad range of tasks such as question answering, sentiment analysis, and textual entailment.
Researchers have collected specific language corpus (Wang et al., 2018;
Zellers et al., 2018; McCann et al., 2018; Xu et al., 2020) to train the machines on NLU learning.
However, the general language understanding problem remains a challenge.
Few-shot learning is a learning paradigm that aims to predict the correct class of instances with a relatively small amount of labeled training examples (Fink, 2004; Fei-Fei et al., 2006).
It has been receiving increasing attention for its potential in reducing data collection effort and computational costs and extending to rare cases.
To deal with data-scarcity in NLU problems, previous research introduces external knowledge (Sui et al., 2021), utilizes meta-learning (Geng et al., 2019;
Bansal et al., 2020; Han et al., 2021) and adopts data augmentation to generate labeled utterances for few-shot classes (Murty et al., 2021; Wei et al., 2021).
Recent studies (Radford et al., 2019; Brown et al., 2020) have shown that large-scale pre-trained language models are able to perform NLU tasks in a few-shot learning manner.
The pre-trained multimodal models also display similar few-shot learning ability (Tsimpoukelli et al., 2021).
Unlike previous studies on pre-trained multimodal Transformers that target solving multimodal tasks, our study introduces imagination from the visual world into language models and aims to improve NLU.
Our Approach
We illustrate how we solve the existing text-only learning problem in natural language understanding tasks as the Imagination-augmented Cross-modal
Language Understanding (ICLU) problems in Section 3.1.
Then we give a detailed illustration of our proposed iACE’s architecture in Section 3.2.
Finally, we describe the procedure and training protocol of the perceptual-enhanced linguistic understanding paradigm in Section 3.3.
3. Problem Definition
NLU is concerned with understanding the semantic meaning of the given utterances.
Data pieces for NLU can be structured as ( x context , X , y ) , where x context represents the text context,
X = { x 1 , x 2 ,..., x m , m ∈ N } denote a set of text snippets, and m denotes the number of text samples for a specific task.
The model learns to predict the ground truth label y , which is either regression or a classification label.
While NLU is usually regarded as a language-only task, we attempt to solve it from a cross-modal perspective by introducing the novel
ICLU problem.
In our ICLU problem, data pieces are structured as ( x context , i context , X , I , y ) , in which i context represents the visual context related to the text context, and I = { i 1 , i 2 ,..., i n , n ∈ N } denotes the imagination set.
The “imagination” refers to the images that are visualized from the text.
Here, n is the number of visualized sentences for a specific task, which is the same as m by default.
To solve this problem, we devise a novel iACE to construct imagination from textual data and learn the bi-directional alignment between the imagination and text.
Specifically, for each piece of text x j in the sentence set X , we first follow (Esser et al., 2020; Radford et al., 2021) and use a generative model to render a descriptive illustration i j .
The visualized imagination will later serve as the visual input in the ICLU problem.
3. Model Architecture Overview
Figure 3 provides an overview of the iACE framework.
iACE consists of two modules: 1) the imagination generator G , 2) the imaginationaugmented cross-modal encoder E c .
Given the textual sentence x = { w 1 , w 2 ,..., w k , k ∈ N } ( w j denotes the j -th token in the sentence), G generates corresponding visual imagination i .
The crossmodal encoder then encodes x
and i as t and v , respectively.
iACE explicitly provides imagination supervision to the visually-supervised Transformer during fine-tuning on downstream NLU tasks.
Imagination Generator
Previous studies introduce visual supervision through retrieval from the web or image sets.
However, it is hard to find visuals that perfectly match the topics discussed in each text snippet, especially for the relatively complicated text input for the NLU tasks.
Such misalignment between the input text and the retrieved visuals might hinder the model from general language understanding learning.
Out of consideration for cross-modal feature alignment, we choose to render specific visualization corresponding to each piece of input text from scratch.
Specifically,
[Figure]
Imagination
L
L Imagine
L Lang
Step 2: Fine-tuning on Downstream NLU Tasks
Visually Supervised
Transformer
Language Corpus
Image Set
Step 1:Pre-training on Large-scale Language and Vision Datasets
Generator
Vision
Encoder
Language
Encoder
Language
Encoder
L GAN + +
Cross-Modal Encoder we construct imagination of the textual input with a large-scale vision and language model guided generative framework - VQGAN+CLIP (Crowson et al., 2022).
For each piece of input text x , we treat it as the prompt and use the VQGAN (Esser et al., 2020) model to render the imagination i with 128 × 128 resolution and 200-step optimization.
At each optimization step, we use the CLIP (Radford et al., 2021) model to assess how well the generated image corresponds to the text.
[Equation] To be specific, CLIP encodes the input text x and the corresponding imagination i as t and v , and the training objective is to minimize the distance between t and v in the cross-modal embedding space.
Cross-modal Encoder
We adopt CLIP as the cross-modal encoder to encode the input text and the generated imaginations.
CLIP (Radford et al., 2021) is trained on large-scale image-text pairs and is able to align visual and textual input in the embedding space.
Specifically, we use the ViT −
B / 32 version of Vision Transformer as the image encoder, and Transformer (Vaswani et al., 2017) with the architecture modifications described in (Radford et al., 2019) as the text encoder.
For each modality, the self-attention (SA) module is applied to model the regions of imagination or the words of the text as follows:
[Equation]
where F denotes the set of regions of the imagination or the words of the textual sentence.
W Qj , W Kj , and W Vj represents the weight in the j -th head for query, key and value respectively.
d k is the dimension of the embedding.
W is the weight matrix for multiple heads.
To solve the ICLU problem, we learn the bidirectional relationship between the text input and the visualized imagination.
We apply late fusion on the text feature t and visual feature v to construct the cross-modal feature.
Given the set of visual features S v and textual features S t , the fused embedding X S can be given with:
[Equation]
where W and b are of two separate fully connected layers to the visual and text embeddings.
The fused embeddings X S will go through two fully connected layers before we receive the final imaginationaugmented language representation.
Visually-supervised Transformer
We implement the visually-supervised Transformer language model proposed in Tan and Bansal (2020).
The model architecture is a BERT-like pure-languagebased masked language model.
3. Learning Procedure
We introduce a novel paradigm to better understand natural language by incorporating existing language models with visual imagination.
As shown in Figure 3, the procedure consists of two steps: (1) pre-train the visually-supervised Transformer, and (2) fine-tune the framework with imagination on downstream tasks.
Step 1: Visually-supervised Pre-training
We pre-train a visually-supervised Transformer following the scheme proposed in VOKEN (Tan and
Bansal, 2020), which extrapolates cross-modal alignments to language-only data by contextually mapping language tokens to the related images.
In addition to masked language modeling, VOKEN proposed a voken classification task: given a set of tokens with masks, the model is asked to predict the best-matching image (the voken) for each tokens.
The pre-training loss can be given as:
[Equation]
Here s is the token set, ˆ s is the masked tokens, and ˇ s is the unmasked tokens.
The q j and p j represent the conditional probability distribution of the j -th token given the token w j and voken v ( w j ; s ) respectively, and λ 1 and λ 2 are the balance factor of the masked language modeling task and the vokenclassification task.
The cross-modal classification task enables the model to learn the matching between the tokens from the language corpus (e.g., wiki) and its most-related images from the image set (e.g., MSCOCO).
Step 2: Imagination-augmented Fine-tuning
We use GLUE (Wang et al., 2018) and
SWAG (Zellers et al., 2018) as the downstream datasets in the following sections.
Our proposed iACE learns to minimize the cross-entropy loss below:
[Equation]
where j denotes the j -th data sample in dataset D , and K os the class number.
The p k represents the conditional probability distribution of d j .
During fine-tuning, the visually-supervised Transformer language model only relied on the textual input to make predictions.
The loss are computed as:
L Lang = − | D
| ∑ j =
K
∑ k =y k log p k
( d j ( t ) | D )
[Equation]
Notice that we use MSE loss for the regression task.
The imagination-augmented loss and purelanguage based loss are summed up with a balance factor λ in a jointly training schema as:
[Equation]
We use Adam Optimizer with a learning rate 1 e −for the GLUE benchmark and 2 e − 5 for the SWAG dataset.
We discuss more details in Section 4.
Experiments 4. Experimental Setup Datasets & Metric
We conduct experiments to evaluate the performance of our proposed method over SST-2 (Socher et al., 2013), QNLI (Rajpurkar et al., 2016), QQP (Iyer et al., 2017),
MultiNLI (Williams et al., 2018), MRPC (Dolan and Brockett, 2005), STS-B (Agirre et al., 2007) from GLUE (Wang et al., 2018) Benchmark, and
SWAG (Zellers et al., 2018) dataset.
We construct few-shot setting subsets by taking 0 .
3%, and 0 .
5% of training instances as the Extreme Fewshot Setting, and 1%, 3%, and 5% as the Normal
Few-shot Setting.
We train the model with the subsets and evaluate its performance on the complete development set.
We use accuracy as the default evaluation metric and compare such results in the following sections
. Baselines
We choose BERT (Devlin et al., 2019) and RoBERTa (Liu et al., 2019) as the base language models, and apply our iACE framework on top of their small and base architectures for comparison.
A recent study proposes a visually-supervised language model VOKEN (Tan and Bansal, 2020) that introduces visual supervision into language model pre-training by borrowing external knowledge from retrieved images of the tokens.
In natural language understanding tasks, VOKEN achieved improvements over language-based baselines BERT and RoBERTa.
Thus we also use VOKEN built upon these language-based models as a set of powerful baselines.
In the following experiments, each model is first pre-trained with visual supervision introduced in (Tan and Bansal, 2020) upon the four base models (BERT small , BERT base ,
[Table]
RoBERTa small and RoBERTa base ).
Then the models will be fine-tuned on downstream tasks.
Notice that base models and VOKEN use purelanguage training objectives during fine-tuning.
Neither of them utilizes the visual signals inherent in the downstream language corpora.
In contrast, our iACE explicitly introduces visual imagination supervisions into fine-tuning and inference stages.
Implementation Details
We train RoBERTa with the same configurations as a robustly optimized pre-training approach based on BERT of the same size.
BERT small has 6 repeating layers, 512 hidden dimension.
BERT base has 12 repeating layers, 768 hidden dimension.
The imagination of the texts is generated interactively by using VQGAN+CLIP, with 128 ×size, 500 iterations.
We use pre-trained VQGAN (imagenet f 16 ) and CLIP (ViT-B/32).
We leverage
CLIP (ViT-B/32) as our language and vision model for premise and hypothesis, and imagination of them.
The text and image dimension is 512.
The dropout rate is set to 0 .
We use Cross-Entropy loss for our cross-modal classification.
Each model was first pre-trained on 4 TITAN RX GPUs forepochs with early stopping and a batch size ofand a sequence length of 126.
The optimizer used is Adam with a learning rate of 2 e − 4 and a weight decay of 0 . 01.
The models are then fine-tuned on
GLUE benchmark and SWAG dataset for 3 epochs with 32 batch size.
We adopt the joint training strategy for our proposed iACE and visually supervised transformer during fine-tuning.
The learning rate of the Adam optimizer is set as 1 e − 4 and 2 e −for GLUE and SWAG, respectively.
[Table]
Few-shot Learning Results
We claim that introducing imagination into language processing helps the existing language-based system tackle the low-resource situation.
Thus, the automatically generated imagination helps reduce the human effort to annotate textual data.
To verify this, we define two situations, a normal few-shot setting, and an extreme few-shot setting.
For the normal few-shot setting, we keep 1%, 3%, and 5% of the training dataset for each task in GLUE
Benchmark.
For the extreme few-shot setting, we keep a lower number of the training dataset, which is reduced to 0 .
3%, and 0 .
5% of the training dataset.
We train the models with the same configuration under these two settings and compare them with visually supervised transformer baselines to confirm the benefit that our proposed iACE brings to the few-shot situation.
Results of the few-shot setting are reported in
Table 1.
Following Tan and Bansal (2020), we only report the four largest and stable tasks in
GLUE for the model-agnostic comparison.
We report the accuracy for SST-2, QNLI, MNLI.
For
QQP and MRPC, we report the average of F1 and accuracy.
For SWAG, we report the correlation.
We observe that the imagination information remarkably helps with both the normal few-shot curriculum and extreme few-shot curriculum.
We assume the imagination-augmented fine-tuning successfully transfers the language understanding from the large-scale vision and language model.
Thus iACE achieves consistent performance gain and shows great superiority of generalization and transferring ability.
[Table] [Table]
BERT base
Visual-Only 59.
BERT base
Visual+Textual (VT) 53.
BERT base
Bi-directional VT 77.
RoBERTa base
Textual-Only 75.
RoBERTa base
Visual-Only 75.
RoBERTa base
Visual+Textual (VT) 74.
[Table]
[Table]
[Table]
[Table]
RoBERTa base
Bi-directional VT
[Table]
[Table] [Table]
[Table]
We conduct ablation studies over both the method side and data side to validate their contribution to our proposed iACE. Method Design Ablation Two method variants of our imagination-augmented encoder are built as baselines to validate the importance of our bi-directional cross-modal imagination design in iACE.
The variants are built upon RoBERTa base and BERT base base models.
Specifically, we develop variant Direction and Unify .
Direction represent alignment between text input and imagination into a directional embedding as FUSE( t sen 1 − i sen 1 , t sen 2 − i sen 2 ).
Unify encode the text and imagination, considering the direction from vision to language by encoding as FUSE( t sent 1 , t sent 2 , i sent 1 , i sent 2 ).
While iACE consider direction from visoin to language and language to vision by encoding as the combination of FUSE( t sent 1 , i sent 2 ) and FUSE( i sent 1 , t sent 2 ).
As shown in Table 2, our bi-directional imagination and language learning achieve stable and best average performance.
These results indicate that our bi-directional imagination method design obtain generalization and transferring ability.
We assume iACE benefits from both learning from language to vision and learning from vision to language simultaneously.
Imagination Composition Ablation
The composition of the imagination is essential for the performance.
To further study the importance of full imagination, we ablate the data side by constructing a textual-only model denoted as Textual
Only , a visual-only imagination denoted as Visual
Only and a single directional imagination input denoted as Visual+Textual .
Visual Only and Visual+Textual represent the imagination model use visual pairs ( i sent 1 , i sent 2 ) and one direction visual and textual pairs ( i sent 1 , t sent 2 ) as input respectively.
Our full approach use Bi-directional VT which takes ( i sent 1 , t sent 2 ) and ( t sent 1 , i sent 2 ) as input.
Results are reported in Table 3 for Extreme
Few-shot setting and normal few-shot setting.
We observe Bi-directional VT data input achieve the most stable and the best average performance.
Results show the importance of bi-directional imagination from all the textual input to construct an imagination-augmented cross-modal encoder.
4. Model-agnostic Improvement
iACE is a model-agnostic training paradigm that could help existing models achieve consistent gain over GLUE and SWAG with both the few-shot [Table] [Table]
[Figure] setting and full data setting. To validate such model-agnostic effectiveness of our proposed novel paradigm in processing natural language, we compare the performance with two language models (BERT and RoBERTa) of two architectures ("6L/512H" and "12L/768H"), and a strong visually supervised pre-trained baseline VOKEN (Tan and Bansal, 2020).
Table 4 shows the metric comparison on GLUE and SWAG.
The base models are trained with a masked language model.
The VOKEN model is pre-trained with a masked language model with an additional voken-classification task as introduced visual supervision.
iACE achieves model-agnostic improvement over the model that solely fine-tune based on textual information, including the purelanguage-based model and visually supervised pretrained model.
The gain is consistently observed from different architectures of models.
4. Case Study
Figure 4 lists out our examples for the case study.
We show the results from the natural language inference and sentence similarity task.
We use examples from the STS-B and SNLI datasets.
Our contextual imagination describes the textual input as expected and provides an external prediction reference.
For example (a), given the structurally diversified sentence and low n -grams overlaps but high semantic similarity, we observe that the pure language-based model predicts the wrong label.
While the imagination helps the model capture the semantic similarity between two textual inputs via comparing the cross-modal semantics with the imagination information.
From example (b), we observe the pure language-based model predicts the wrong label based on the similar sentence structure and high n -grams overlaps.
While the imagination helps the model capture the difference between the similar premise and hypothesis text.
Conclusion
We treat the text-only learning problem in Natural
Language Understanding tasks as a cross-modal language understanding problem with generated imagination as supervision.
In this scenario, the task aims to bridge the gap between the human and the agent language understanding in both linguistic and perceptual procedures.
To address the proposed problem, we devised a model-agnostic learning paradigm iACE.
Specifically, we build the imagination of the downstream dataset using an interactive generative approach with guidance from a self-supervised pre-trained large-scale image and text model.
Our proposed iACE surpassed baselines of two architecture sizes by a large margin in the few-shot setting.
The improvement is consistently observed over pure-language baselines (BERT and RoBERTa) and visually supervised VOKEN on the GLUE and SWAG dataset.
The results show the superiority of our iACE in language understanding and handling low-resource circumstances.
Acknowledgement
We would like to thank the Robert N. Noyce Trust for their generous gift to the University of California via the Noyce Initiative.
The research was also sponsored by the U.S. Army Research Office and was accomplished under Contract Number
W911NF19-D-0001 for the Institute for Collaborative Biotechnologies.
The writers’ opinions and conclusions in this publication are their own and should not be construed as representing the sponsors or the U.S. government’s official policy, expressed or inferred.
Regardless of any copyright notation herein, the United States government is authorized to reproduce and distribute reprints for government purposes.
Ethical Statement
In this study, we only cover NLU datasets with
English annotations.
Such limitation is since the large-scale pre-trained multimodal models used in our studies, such as CLIP and VQGAN, are only trained on English corpus as of the date we conduct the experiments 2 .
This study use CLIP and VQGAN to render images given the text prompt.
Suppose there exists any bias in the training dataset for the largescale pre-trained multimodal models used in our study.
In that case, our “imagination” approach may face an issue of fairness since the visual generative model might be more likely to illustrate specific types of images that it has seen in the training data.
Moreover, if the training dataset for CLIP or
VQGAN contains any personal information, then our “imagination” approach may strike a threat on privacy leakage given certain triggers or prompts.
Even though we did not witness such issues in our study, we should keep in mind that the aforementioned behaviors would impair iACE’s effectiveness.