A Hierarchical Approach to Neural Context-Aware Modeling
Patrick Huber Jan Niehues Alex Waibel

 On Behind the Physics of the Thermoelectricity of Topological Insulators 
    Daniel Baldomir^1∗ and Daniel Faílde^1



^1Departamento de Física Aplicada, Instituto de Investigacións Tecnolóxicas. Universidade de 

Santiago de Compostela E-15782 Campus Vida s/n, Santiago de Compostela, Spain



^∗daniel.baldomir@usc.es

    
=======================================================================================================================================================================================================================================================


We present a new recurrent neural network topology to enhance state-of-the-art machine learning systems by incorporating a broader context. Our approach overcomes recent limitations with extended narratives through a multi-layered computational approach to generate an abstract context representation. Therefore, the developed system captures the narrative on word-level, sentence-level, and context-level. Through the hierarchical set-up, our proposed model summarizes the most salient information on each level and creates an abstract representation of the extended context. We subsequently use this representation to enhance neural language processing systems on the task of semantic error detection. 

To show the potential of the newly introduced topology, we compare the approach against a context-agnostic set-up including a standard neural language model and a supervised binary classification network. The performance measures on the error detection task show the advantage of the hierarchical context-aware topologies, improving the baseline by 12.75% relative for unsupervised models and 20.37% relative for supervised models.




§ INTRODUCTION

In the research field of natural language processing (NLP), most state-of-the-art algorithms and topologies for translation and transcription tasks are based exclusively on the local context of a single sentence. This restriction is reasonable when working with techniques such as n-gram models. Modern machine-learning approaches, for example neural networks, have become far more powerful and thus lifted the restriction of the models to a local context. 

Even though many systems shifted from classical approaches towards neural design patterns, the scope of these approaches is still limited to a local context. Through the sequential nature of NLP systems, considering a longer context can benefit the performance in many sub-domains. 

For instance in the domain of neural machine translation (NMT), state-of-the-art approaches are mostly utilizing the advantages of asynchronous encoder-decoder neural network designs. Extending these models with a context component has the potential to enhance the overall system and increase the reliability of the translation. 

Another example where the context-aware extension can add direct value to the computation is the area of automatic speech recognition (ASR). As a part of the fundamental equation of speech recognition, the language model can be improved by extending the employed context.



§ RELATED WORK

<cit.> describe a hierarchical approach for NMT systems that takes an extended context into account. The described methodology in the paper summarizes the context in two computational stages: on sentence- and document-level. With this attempt to capture the context, the work by  is closely related to our work. Nevertheless, the main goal of the paper is to avoid translation errors through consistent translations for equal words. In contrast to the research by , we additionally pre-train the sentence embeddings to reduce the required amount of training data.

In the paper Character-Level Language Modeling with hierarchical Recurrent Neural Networks published by <cit.> hierarchical embeddings are used to create abstract representations on word and sentence level to enhance recent character-based approaches for speech recognition tasks. Even though  utilize a hierarchical approach to summarize information on multiple layers, the scope differs significantly from our work, as we try to create an abstract representation of the narrative rather than only summarizing up to a sentence-level.

Further related work has been conducted by <cit.>, analyzing the capability of hierarchical neural networks to capture temporal dependencies within sequences. As a result of their work, they showed empirical evidence that this type of models can actually capture the temporal structure.  also limit their system to lower-level features on word and sentence-level, not considering the context on document-level.

Related work within the area of question answering is conducted by <cit.> showing that recursive neural networks can be combined with a parse tree <cit.> and a multinomial logistic regression classifier to achieve good results on trivia-like tasks by extracting the essential information from the context. The task introduced by  varies from this work, as it targets a question-answering problem based on a short paragraph rather than semantic error detection on long narratives. Additionally, it utilizes a heterogeneous methodology instead of an end-to-end connectionist learning approach. 

The recently published work by <cit.> is related to our work, tackling the topic of neural semantic parsing. The described approach maps natural language to a formal logic with the goal to answer trivia-like questions by utilizing weakly supervised methodologies. Even though the approach by  also targets the broader domain of natural language processing, the exact task as well as the used methodologies discriminate the work from ours.

Other related work in the area of question answering is conducted by <cit.>, introducing a new neural network architecture to retrieve an answer from a long input sequence and a question statement. The described approach differs from our work, as it focuses on a neural network based framework creation rather than a methodology to capture an extended narrative. 



§ MOTIVATION


Recent neural language models predict the next word in a sentence according to the syntactical fit into the text. As these models only take a single sentence at a time into account, standard neural languages models are not capable to infer a broader context. In many real-life applications, such as document translation, transcription of natural language and chatbots, the semantic coherence plays a crucial role to advance the quality of the overall system and avoid substantial mistakes. Imagine a transcription system assembling the following English sentence [Example taken from the TEDTalk Wireless data from every light bulb by Harald Haas]:


And it's this importance why I decided to look into the issues that this technology has, because it's so fundamental to our countries.


Running a sentence-based neural language model on this sentence will return a high likelihood, due to the syntactical coherence of the text passage. The model cannot find the semantic out-of-context token countries, which should be transcribed as lives. Considering the broader context, the semantic error in the sentence becomes evident, as it does not fit into the overall context. 


We use it everyday. We use it in our everyday lives now, in our private lives, in our business lives. [...]. And it's this importance why I decided to look into the issues that this technology has, because it's so fundamental to our countries.


Taking the extended narrative into account, the last word in the original sentence emerges to be out-of-context.

To infer this semantic mismatch, the computational system needs to take more than just the sentence itself into account. This ability to include the former context is a complex task to integrate into computational systems. In comparison to that, humans have the innate capability to easily take long contexts into account when listening or reading. We thereby do not keep every single word within the context in our limited short-term memory, but hierarchically structure the received information and only keep a chunked representation of the narrative <cit.>. The human approach of hierarchical information retrieval allows us to group word-level units and acquire abstract representations of the world <cit.>. This natural paradigm efficiently summarizes the most salient information of the context in an abstract representation. To overcome the recent limitation of computational models and achieve more human-like context understanding for neural networks, we determine whether a hierarchical approach, derived from the human information retrieval paradigm, can enhance the semantic error detection within contextual text passages compared to systems solely relying on a local context. 



§ TASK


Within the area of text understanding, the evaluation task is defined as the detection of semantic errors in contextual text passages. To achieve that, artificially inserted out-of-context error tokens are uniformly distributed over a dataset. The respective replacement procedure is implemented in five-stages:


(1) Dataset Filtering to enhance the data quality

 
(2) Part-of-Speech Tagging substituting only nouns, as described superior by <cit.>, showing that the context is especially critical to nouns

 
(3) Candidate Selection to filter for nouns with strong contextual coherence

 
(4) Appearance Window approach to find syntactically suited replacement tokens by the word-count on the dataset

 
(5) Tense and Grammatical Number are taken into account within the appearance window to determine the most suitable substitution

 
The semantic word replacements within this task are at random positions wr in the series of word-tokens W =(w1,w2,...,wn) with wr∈ W. The task can therefore be interpreted as a binary sequence labeling problem defined by the input sequence W and the output sequence Looc = (l1, l2, ..., ln) with lr∈ Looc, representing the labels of the words in W. The labels Looc separate the two classes {0, 1}, defining valid-context tokens and out-of-context tokens. The task definition does not provide any information about the position of the modifications nor give any insight about the total number of out-of-context substitutions in the data. With this definition, every word wr∈ W needs to be assessed against every other word wq∈ W (r ≠ q) in the sequence in order to find the out-of-context tokens.

To assess the performance of our new model topology, a ground-truth dataset is created by extending the 2016 TEDTalk dataset <cit.> with semantic errors at arbitrary positions and an error-insertion rate of 10 replacements per TEDTalk. We use the 2000 individual TEDTalks (with combined 1millions words) for both, the pre-training as well as the final training process. For the translation system, the 2016 synchronous English-German TEDTalk corpus is utilized. The three mutually exclusive datasets (training, development and test) are separated with a classical 60-20-20 split, which is used to randomly distribute the data. An example for a replacement on the training set is given below.


Modified sentence: So many artists, so many different explanations, but my explanation for engineering is very simple.


Ground truth: engineering → performance


(Marina Abramovic, TED2015)


Through the automated modification process the whole dataset is altered, allowing unsupervised and supervised models to be trained on the data and evaluated against the task.



§ MODEL TOPOLOGY

Our newly proposed neural network model topology introduces a context component, based on the recurrent encoder-decoder neural network design described by <cit.>. The asynchronous model architecture thereby allows the necessary two-staged computation, similar to state-of-the-art translation systems. 



 §.§ Context Representation


The encoder component of the model feeds the context into the network. A standard encoder, as proposed in the original paper <cit.>, processes one word at every time step. Simply feeding the extended context into the model this way is problematic, as the amount of time steps in the encoder drastically increases for long narratives with multiple sentences or paragraphs. 

To effectively augment the decoder component of the model with a narrative, the information of the context is hierarchically summarized. This way, an abstract representation of the context is generated, which can be fed into the fixed-size context vector of the encoder-decoder model. The narrative is summarized on three levels:





(1) Word-Level

The first level of abstraction is achieved through a word-embedding layer. This way, the network input  W = {w1, w2, ..., wn} is transformed into real valued vectors by applying the parameterized function E(W):

    E(W) : W →ℝn × d

The word embedding function E(W) is implemented as a lookup matrix of dimension |V| × d, with |V| as the vocabulary size and d representing the word embedding dimension. The function transforms the sparse network input of size |V| into a d dimensional real valued vector with d ≪ |V|. During the training process, the word embeddings learn to abstract from specific words and create a first synopsis on word-level <cit.>.


(2) Sentence-Level

On the second layer of abstraction, the sentences S = {s1, s2, ..., sm} in the dataset are embedded. To generate this representation, the word-embeddings E(W) are fed sentence-wise into a recurrent neural network <cit.>. For a single sentence sj within the context C, the sentence-level input is defined as {E(w1, j), E(w2, j), ..., E(wn, j)}. During training, the network learns to store the important information of the sentence within the recurrent neural units defined by 

    hi, j = f(hi-1, j, wi, j)

with hi, j representing the hidden state of the network at time step i of sentence j. f(·) is the activation function of the neural network layer. Through the sequential nature of the recurrent neural network, the final hidden state hnj, j of the network contains an abstract representation of sentence j. Therefore, the final hidden state is used as the sentence representation.

    H(sj) ≡ hn, j


(3) Context-Level

The sentence-wise content of the narrative C is subsequently fed into the recurrent neural network representing the encoder component of the major encoder-decoder network. The context representation utilizes the summarized sentence representations H(S) = {H(s1), H(s2), ..., H(sm)} to add the final layer of abstraction to the model topology. The final hidden layer computed by 

    hm = f(hm-1, sm)

is used as the context C of the system.

    C ≡ hm

The hierarchically summarized context C is used as the context vector to initialize the decoder, containing the content of the complete narrative. (See figure <ref>)




With the described three-layered approach we propose a new neural network architecture that learns to create an abstract representation of the context C. The model topology thereby allows to:
 (a) Replace synonyms and closely related terms on a word level to abstract from the exact terminology used in the text.
 (b) Determine the semantic of a sentence independent of the sentence structure.
 (c) Create an abstract representation of the context, which models the human principle of the mindset, as motivated in section <ref>.

To keep the computational efforts reasonable, the sentence embeddings are pre-trained on the same corpus as the final encoder-decoder model and are used for the presented evaluation of the system. The pre-trained sentence embeddings are described in more detail in section <ref>.



 §.§ Sentence Prediction

The context vector of the encoder recurrent neural network initializes the decoder component. For our task, three different decoder topologies are generated:


(1) Contextual Language Model

The first decoder topology utilizes an unsupervised neural language model to synchronously predict the next word within the current sentence. Augmented with the context vector of the encoder computation, the model assigns every word in the vocabulary V a probability, indicating the likelihood of the word to succeed the current word in the sentence. Through the encoder-decoder topology, the network jointly learns to enhance the context representation and the network output during the training.


(2) Contextual Attention-based Language Model

The attention based topology extends the neural language model with an additional attention mechanism derived from the paper by <cit.>. The attention component is introduced to remove the restriction of the standard encoder-decoder model to a fixed-size context vector and allow the decoder to dynamically focus on the encoder states.


(3) Contextual Binary Classification Model

As the last decoder topology, a supervised network is evaluated on the task. This model labels the input sentence through a binary classification on a word base and directly outputs the probability of the token within the context.



§ TRAINING


To keep the model topologies comparable during the training and evaluation phase, the hyper-parameters of the models are identical for all instances. This includes the Adam Optimizer as described by <cit.>, the cross entropy cost function and the Long short-term memory (LSTM) cell architecture for the recurrent networks, as proven more efficient by <cit.>. The networks are limited to 512 neurons per recurrent layer and a single recurrent layer per network. The mini batch-size for the training of the models is set to 100 data points. 

The attention based models use the Bahdanau attention mechanism <cit.>. 

Applied learning rates are derived from the original paper introducing the Adam Optimizer <cit.>. A vocabulary size |V| of the most frequent 30,000 words and a maximum sentence length |S| of 50 word-tokens are chosen. 

As mentioned in section <ref>, the sentence embeddings are pre-trained for this evaluation in order to keep the computational efforts low. Furthermore, for a given sentence sj, the context Cj is defined as 

    Cj≡ hj-1

where hj-1 is the last hidden state of the limited sentence representation H(Sj,p) = H(sj-p), ..., H(sj-1) with p set to 10. The most salient information on a sentence-level is summarized by the following two approaches:


(1) Final State of Neural Language Model

The first approach to summarize the context on a sentence-level is realized by utilizing a neural language model. Thereby, the sentence sj is fed into the network word-by-word and the final network state is extracted. The unsupervised neural language model is trained on the same TEDTalk training set as the final context-aware encoder-decoder model. This sentence-level abstraction exactly resembles the summarization of the network topology described in section <ref>


(2) Context Vector of Neural Machine Translation

The second approach to abstract on the sentence-level is though the context vector of a NMT encoder-decoder model. The model is trained to translate bilingual TEDTalks from English into German. The training-, development- and test-set are aligned with the monolingual data split.


Figure <ref> shows the network topologies of the pre-trained sentence embeddings. 





§ EVALUATION

The evaluation of the hierarchical context-aware model topology is based on the task described in section <ref>. Within the evaluation, two common performance measures are applied on the newly introduced model, as well as the baseline. 



 §.§ Baseline

To evaluate the impact of the narrative, the novel hierarchical context-aware model topology is assessed against sentence-based baseline models resembling the decoder part of the network without the context component. This way, the effect of the narrative can be individually tested and evaluated. The two baseline models are a neural language model and a neural binary classification model.



 §.§ Scoring

In order to evaluate the performance of the presented models, the F-score is assessed on the task defined in chapter <ref>. As the total amount and the position of the semantic error tokens are not disclosed within the task, every word in the dataset D is assessed according to its fit in the context. The scores are subsequently sorted and the least likely Nooc words are classified as out-of-context tokens. As the number Nooc of out-of-context tokens is not known, a suitable threshold is defined to separate the binary classes. To determine the best split, the F-score is calculated for every threshold tNooc = {1 .. N} with 1 ≤ N ≤ |D|. For unsupervised models, the perplexity measure is additionally applied to show the systems' performance on the general word prediction task.



 §.§ Results





To assess the final results, the F-score and perplexity values are evaluated on the development set. Figure <ref> shows the F-scores for separation thresholds in the range of 2,000 to 20,000 words for the best hyper-parameter settings of every model topology. The displayed model performances on the development-set already show a clear separation between the unsupervised and supervised models, with the supervised models reaching higher F-scores at lower thresholds. Depending on the individual graph, the optimal threshold for every model is independently determined and subsequently applied on the test set.

For the unsupervised models, the perplexity is additionally evaluated and taken into account when selecting the best model hyper-parameters such as the learning rate and the training epoch.

The best instance of every topology is evaluated on the mutually exclusive test set. The final results are shown in table <ref>.

The unsupervised baseline language model, only taking the local context of a sentence into account, reaches a F-score of 6.51% and a perplexity of 115 on the test-set. The second baseline system, the supervised binary classification model, achieves a F-score of 10.16%. Based on these values for the unsupervised and supervised baselines, the context-aware systems are evaluated on the test-set. 

The unsupervised context-aware language model is evaluated with both sentence representations described in section <ref>: the language model context representation (Context Lang Model LM-CR) and the NMT context embedding (Context Lang Model NMT-CR). The two model instances reach F-scores of 7.06% and 7.34% respectively. Compared to the unsupervised baseline, the better performing NMT based context-aware model increases the F-score by 0.83% absolute and 12.75% relative. This model also reduces the perplexity compared to the baseline model, showing the general superiority of context-aware models for the word prediction task.

The two attention based language models (Context Attn Lang Model LM-CR and Context Attn Lang Model NMT-CR) are not able to enhance the performance compared to the previously described context-aware language models, especially due to the low precision values. Therefore, it is not advisable to add an attention mechanism.

Both supervised context-aware binary classification models (Context Bin Class Model LM-CR and Context Bin Class Model NMT-CR) enhance the performance of the supervised baseline. The NMT based sentence representation again outperforms the language model sentence embeddings, indicating the superiority of the NMT based sentence representation for all evaluated model topologies. Compared to the supervised baseline, the context component enhances the system by 2.07% absolute and 20.37% relative, increasing the F-score form 10.16% to 12.23%. The context component thereby primarily enhances the precision, while the recall remains mostly constant.

The best model topologies in the unsupervised and supervised category are bolded in the final performance comparison (See table <ref>)



§ CONCLUSION

In this paper, we present a novel architecture for context-aware computational models. To outline the potentials of the contextual approach, we compare the model to sentence-based baseline models showing the effects of a hierarchical context on state-of-the-art systems. With a unsupervised context extension applied to the sentence-based models, the performance improved by a factor of 12.75% relative. Adding an additional attention mechanism to the model impairs the results and is therefore not advisable. Applying the context on a supervised model shows an enhancement of 20.37% relative. 

The consistent improvements of the performance for unsupervised and supervised models illustrate the significance of an extended context for the task of semantic error detection. The result, hence, shows the importance of a context to semantic error detection.

With this work, the general superiority of context-aware system over sentence-based approaches to find semantic errors has been shown. To reduce the computational efforts, multiple constraints have been introduced, including a limited topology size and a confined vocabulary. To further enhance the performances of the context-aware models, an increased number of computational layers can be employed to learn more abstract relations on the data. Through the restricted vocabulary in this work, an extended or open vocabulary should be taken into account to further excel the quality of the model.


acl_natbib

