Elamur Research

Explaining Recurrent Neural Network Predictions in Sentiment Analysis

Paper · 2017 · Leila Arras, Grégoire Montavon, Klaus-Robert Müller et al.

Summary

A sentence can contain words of praise and still express disappointment. A sentiment classifier has to decide which expressions matter together, and its final label gives the reader little help in seeing how it did so. Arras and colleagues investigate this problem with a bidirectional long short-term memory network, or bi-LSTM, trained to classify movie-review text. Their aim is to explain a particular class score for a particular sentence by giving each word a signed relevance. The sign tells the reader whether the word received credit for supporting that class or for opposing it. This makes the paper a study of interpretability.

The method extends Layer-wise Relevance Propagation, or LRP. It starts with the score for a chosen sentiment class and works backward through the operations that produced it. A recurrent network repeatedly uses gates to control how much material from its input and memory can pass through. These gates introduce multiplication, which needs its own rule during the backward calculation. The authors send the relevance of each gated product to the source being regulated. The gate still affects the calculation through the value it produced on the forward pass. At the input, the authors add up the contributions assigned to the dimensions of each word vector.

The experiments use the Stanford Sentiment Treebank. On its test sentences, the classifier achieves 46.3% accuracy on the five-class task and 82.9% when evaluated on the binary task with neutral sentences excluded. The authors compare LRP with sensitivity analysis, which ranks words by the size of local derivatives of the chosen score. In selected examples, LRP gives opposite signs to words that support and oppose the target sentiment. Its attribution to negation also varies with context. Across the test set, the strongest positive and negative LRP scores for the very positive class yield salient words at opposing ends of the sentiment scale.

The authors also use the word rankings to choose which input vectors to zero out. On sentences the classifier initially gets right, removing highly relevant words causes the strongest deterioration when standard LRP determines the order. On sentences it initially gets wrong, removing the words with the lowest LRP scores produces the clearest improvement. These results give the signs a practical interpretation in this experiment. The heatmaps can also make a mistake more intelligible, since the class being explained can be the true label even when the classifier predicts something else.

Deep dive: Explaining Recurrent Neural Network Predictions in Sentiment Analysis

Arras and colleagues explain recurrent sentiment predictions by tracing class scores back to words and test those explanations through word removal. · about 34 minutes to read

The problem and its context

Why the label leaves a question unanswered

The paper starts from a problem in semantic composition. Sentiment can change when words are combined. A negator can reverse the effect of an expression, and a modifier can change its strength. The difficulty lies in determining where that effect applies. A sentence can introduce a potentially favorable feature, express disappointment with its execution, and contain cues to both interpretations. Knowing which polarity the classifier chose leaves open how it handled those cues. The task brings together sentence meaning and the analysis of sentiment and emotion.

For the authors, the need for explanations follows from the way neural classifiers were being used. They describe growing interest in convolutional and recurrent networks for sentiment tasks and point to a Twitter sentiment evaluation as an example of that trend. As such systems become more predictive, an accuracy figure answers a narrower question than a reader may want to ask. Accuracy measures how frequently the label agrees with the reference. An explanation can help investigate an individual decision, including whether the evidence the system used resembles what a reader takes to be important.

There are several ways to ask what a network knows about a sentence. A reader might ask how it represents an expression internally, which part of a sentence carries sentiment, or which inputs contributed to a particular score. This paper chooses the last question. The units displayed to the reader are words, and each explanation has a named target class. The relevant distinction is therefore between a word that supports that class and one that opposes it, with the rest of the sentence held in view. This is an explanation of an individual decision in text classification.

A class-specific explanation matters because the same word may have different uses across sentences and different implications across classes. A term that conveys disapproval can supply evidence for the very negative class. The same term can work against the very positive class. Its role may change again when it occurs within the scope of negation. A word ranking that measures intensity alone can put all of these cases near the top. A signed ranking adds the direction needed to distinguish them.

The target class also gives the authors a way to investigate mistakes. When a negative review is classified favorably, a reader can ask which words favored the true negative class and which pulled against it. That question can be asked directly of the score for the true class, even though a different score determined the prediction. A misplaced sign in this kind of display would have practical consequences for interpretation. It would turn a possible explanation of the error into a misleading account of what supported the expected answer.

What earlier approaches made visible

The paper distinguishes explanations made possible by a network’s structure from explanations that redistribute its final score. In a recursive sentiment network built over a parse tree, intermediate nodes correspond to parts of the sentence. Inspecting those nodes lets a researcher ask about sentiment at different levels of the tree. The paper takes this as an example of transparency that follows from the way sentences are represented, citing the earlier work on the Stanford Sentiment Treebank.

An attribution to the input answers a different question. Rather than inspecting a sentiment value attached to a constituent, a researcher starts at a chosen output and asks how its score relates to the input features. For text represented as vectors, the immediate features are individual dimensions of those vectors. The authors want the result to be legible at word level. That choice requires an aggregation step after the attribution has been worked out for the individual dimensions.

The earlier attribution methods discussed in the paper include approaches that use local gradients. A gradient describes how an output would respond to a small change near the input being examined. Its size provides a natural way to identify sensitive input features. The authors also describe methods that start with the value of the output itself and allocate that value backward through the computation. These approaches define importance through different quantities. A large derivative indicates local responsiveness, while a large share in a backward allocation indicates that the propagation rules assigned substantial relevance to that part of the computation.

The authors trace both lines of work through studies of image classifiers and through applications to text. Their immediate starting point is earlier work on LRP for feed-forward networks. That work supplies rules for assigning relevance to lower-layer units once the relevance of an upper-layer unit is known. The paper also cites previous use of relevance propagation for text and a comparison of gradient-based and propagated explanations in Explaining Predictions of Non-Linear Classifiers in NLP.

The paper places representation erasure among the ways researchers investigate what a network uses. An erasure experiment removes or suppresses part of a representation and observes what happens. This idea plays a separate role from the propagation rule in the present study. LRP generates a ranking from the original computation, and an erasure-style experiment tests what happens when that ranking determines which words to suppress. The related work includes Understanding Neural Networks through Representation Erasure.

Why recurrence calls for another rule

A recurrent network combines each input with a state carried from earlier steps. The LSTM examined here uses gates to determine how much of a previous memory to keep, how much new information to write, and how much of the resulting memory to expose. This behavior is useful when a decision depends on relationships between words that occur at different positions. It also means that the computation being explained contains repeated products, each combining a gate value with the material it regulates.

The authors take the weighted-connection rule from earlier LRP work as the starting point. That rule can distribute relevance across several inputs whose weighted contributions are added. A product has a different structure. Its output depends on both factors, and one factor has a designated role as a controller. The paper’s technical proposal is a backward rule that uses this asymmetry. The authors discuss it in relation to both LSTMs and gated recurrent units, or GRUs, and cite the latter architecture through Learning Phrase Representations using RNN Encoder–Decoder for Statistical Machine Translation.

The method, step by step

From a class score to a word explanation

The procedure begins with a sentence and a class to explain. The sentence is represented as a sequence of vectors, with one vector for each word occurrence. The classifier reads the sequence in both directions and assigns a score to each sentiment class. The explanation then follows the computation backward from the selected score. In the main visualization and deletion analyses, the selected class is the sentence’s known label. In an analysis that asks what characterizes the very positive class, that class stays fixed across sentences. These choices illustrate a general property of the method. The input can stay the same while the question asked of it changes.

At each operation, relevance travels through the inputs that participated in producing the output. At an addition of weighted terms, the authors allocate relevance using those terms. At a multiplication of a gate and a source, they pass the relevance along the source branch. After tracing the score back to the word vectors, they sum the values that belong to each word. The resulting score is for a word in its sentence, so recurring words can receive different explanations in different contexts. The classifier sees those words through word embeddings.

From a sentence to signed word relevance

The steps in order.

From a sentence to signed word relevanceStep 1: Represent each word as a vector1. Represent each word as a vectorStep 2: Encode the sentence in both directions2. Encode the sentence in both directionsStep 3: Compute scores for the sentiment classes3. Compute scores for the sentiment classesStep 4: Initialize relevance at the chosen score4. Initialize relevance at the chosen scoreStep 5: Redistribute relevance through weighted connections5. Redistribute relevance through weighted connectionsStep 6: Route gated relevance through source values6. Route gated relevance through source valuesStep 7: Sum relevance within each word vector7. Sum relevance within each word vector

How the recurrent classifier reads the sentence

The authors reuse a trained bi-LSTM from earlier work on interpreting neural networks for text. Its training task covers sentiment in phrases and sentences from the Stanford Sentiment Treebank, which consists of movie-review text. The recurrent classifier has one hidden layer, a word-vector dimension of 60, and a hidden layer size of 60. For the experiments here, the test input consists of tokenized sentences converted to lower-case. The paper directs readers to the earlier study for training details and makes the implementations of LRP and sensitivity analysis available with its LSTM explanation code.

Inside each directional encoder there are two related states. The cell state carries memory from step to step. The hidden state is the part of the recurrence exposed to later computation, including the calculations at the next word. The authors give equations for the input gate, forget gate, output gate, and candidate update. Each of the four uses the previous hidden state along with the current word vector. They use separate parameters, so each can respond differently to the same input and history.

iₜ = sigm(Wᵢ hₜ₋₁ + Uᵢ xₜ + bᵢ)

Here t indexes the current step in the direction being read, and iₜ is the input gate at that step. hₜ₋₁ is the previous hidden state and xₜ is the current word vector. Wᵢ multiplies the previous hidden state, Uᵢ multiplies the word vector, and bᵢ is the input-gate bias. The plus signs add the resulting vectors. sigm applies the sigmoid function separately to each component, giving gate values in the range from 0 to 1. The input gate controls the candidate material that enters the cell.

fₜ = sigm(Wᶠ hₜ₋₁ + Uᶠ xₜ + bᶠ)

Here fₜ is the forget gate at step t. It is distinct from the class-score function introduced below. hₜ₋₁ is the previous hidden state and xₜ is the current word vector. Wᶠ and Uᶠ are the forget gate’s weight matrices for those inputs, and bᶠ is its bias. The affine terms are added before sigm converts their components into gate values. The forget gate controls the portion of the previous cell state retained at the current step.

oₜ = sigm(Wₒ hₜ₋₁ + Uₒ xₜ + bₒ)

Here oₜ is the output gate at step t. hₜ₋₁ and xₜ again denote the preceding hidden state and current word vector. Wₒ weights the former, Uₒ weights the latter, and bₒ is the output-gate bias. sigm acts separately on the components of their sum. This gate regulates how much of the current cell state appears in the hidden state.

gₜ = tanh(Wᵍ hₜ₋₁ + Uᵍ xₜ + bᵍ)

Here gₜ is the candidate update at step t. Wᵍ and Uᵍ weight the preceding hidden state hₜ₋₁ and the current input xₜ, respectively. bᵍ is the candidate’s bias. After the weighted vectors and bias are added, tanh, the hyperbolic tangent, acts component by component. This pathway produces candidate content for the memory. The input gate determines how much of that content enters.

cₜ = fₜ ⊙ cₜ₋₁ + iₜ ⊙ gₜ

Here cₜ is the cell state at step t, and cₜ₋₁ is the preceding cell state. fₜ is the forget gate, iₜ is the input gate, and gₜ is the candidate update. The symbol ⊙ means componentwise multiplication. The first product scales the old memory and the second scales the proposed update. Their sum is the new memory. This operation presents both kinds of connection that the LRP extension needs to handle. Each product has a gate and a source, and the products are then added together.

hₜ = oₜ ⊙ tanh(cₜ)

Here hₜ is the hidden state at step t, oₜ is the output gate, and cₜ is the new cell state. tanh acts component by component on the cell state, and ⊙ multiplies the result component by component with the gate. The paper sets the initial hidden state h₀ and cell state c₀ to zero. These are the states before the encoder has read any word in its direction.

The notation x = (x₁, x₂, …, xₜ, …, x_T) describes the sentence input in its original order. Here x is the whole input, each xₜ is a word vector, t is a word position, and T is the length of the sequence. One encoder consumes the sentence in this order. The other consumes the same words in reverse order. Each encoder ends with a hidden state representing its own complete traversal. The classifier concatenates those two states and uses a fully connected linear layer to compute the score vector f(x). The entry f_c(x) is the scalar score for sentiment class c on sentence x.

This setup is relevant to attribution because a word can affect the output through both encoders. The word may be early in the computation for one encoder and late for the other. When examining where relevance occurs in a sentence, the authors can count the contributions together or look at the part carried by each directional encoder. Relative position in the sentence and elapsed time in an encoder are consequently different ways of describing a word’s location.

How the gradient comparison assigns importance

The comparison method is sensitivity analysis, abbreviated SA. It asks what would happen to the chosen score if an individual dimension of the input vector changed by a small amount near its present value. The partial derivative describes that local response. Squaring it gives a non-negative value, so changes in either direction contribute to measured sensitivity.

R_d = (∂f_c(x) / ∂x_d)²

Here R_d is the sensitivity relevance for input dimension d, x_d is the value of that dimension, and x denotes the complete sentence input. f_c(x) is the score for the selected class c. The ∂ notation indicates a partial derivative with respect to x_d, taking the other input dimensions as given. The superscript ² squares that derivative. Standard gradient back-propagation supplies the derivatives through the recurrent computation.

Σ_d R_d = ‖∇ₓ f_c(x)‖₂²

Here Σ_d sums the values R_d over input dimensions d. The vector ∇ₓ f_c(x) is the gradient of the selected class score with respect to the sentence input x. The notation ‖ · ‖₂² gives the squared Euclidean norm of that vector. The total underlying an SA explanation is therefore the squared size of a local gradient. A word can score highly because changing it would affect the class score strongly. The square leaves that relevance value without a sign for support or opposition.

The earlier first-derivative visualization discussed by the authors also uses local derivatives. It takes their absolute values and displays the individual word-vector dimensions. In the present comparison, the authors square the derivatives and aggregate the resulting values by word. The resulting baseline supports a direct comparison of word rankings and word-level heatmaps. The change in how derivatives are processed is also part of what defines the particular SA baseline being tested.

How LRP redistributes a score

For LRP, the authors initialize the selected output unit’s relevance with its class score. The other class outputs have zero relevance for that explanation. The initial quantity is thus a value from the classifier’s forward calculation. As the method works backward, it assigns portions of that value to the units that provided inputs to each operation. A unit used by several later operations receives relevance from those different paths.

Take a unit whose forward value comes from adding weighted lower-layer inputs and a bias. The authors write that connection as follows.

zⱼ = Σᵢ zᵢ · wᵢⱼ + bⱼ

Here j indexes the upper unit and i indexes the lower units feeding it. zⱼ is the upper unit’s weighted sum, zᵢ is the value from lower unit i, and wᵢⱼ is the weight on the connection from i to j. The symbol · denotes multiplication, Σᵢ adds over the input units, and bⱼ is the upper unit’s bias. A lower unit that has already passed through a nonlinearity supplies its activated value in these rules. The expressions use the values from the particular sentence being explained.

The authors divide the upper unit’s relevance into messages directed to the lower units. Each message uses a term for that lower unit’s forward contribution, and the rule includes a stabilizer for weighted sums close to zero.

Rᵢ←ⱼ = [(zᵢ · wᵢⱼ + (ε · sign(zⱼ) + δ · bⱼ) / N)
        / (zⱼ + ε · sign(zⱼ))] · Rⱼ

Here Rᵢ←ⱼ is the message from upper unit j to lower unit i, as indicated by the arrow, and Rⱼ is the relevance already assigned to j. zᵢ, wᵢⱼ, and bⱼ are the input value, connection weight, and bias from the forward equation. zⱼ is the resulting weighted sum. N counts the lower units connected to j. ε is a small positive stabilizer, set to 0.001 in the experiments. sign(zⱼ) gives the direction in which the stabilizer shifts the denominator. δ controls whether the adjustment containing the bias and stabilizer is shared across the incoming connections. The bracketed fraction is the share of Rⱼ assigned to this message.

sign(zⱼ) = 1[zⱼ ≥ 0] − 1[zⱼ < 0]

Here sign is the paper’s sign convention for the unit value zⱼ, and 1[condition] is an indicator that equals 1 when the condition holds and 0 otherwise. The first comparison includes a value of exactly zero, and the second covers negative values. The subtraction makes the sign positive at zero. With the positive ε, the shift makes the denominator non-zero there and moves a non-zero denominator away from zero in its existing direction.

Rᵢ = Σⱼ Rᵢ←ⱼ

Here Rᵢ is the relevance assigned to lower unit i, Rᵢ←ⱼ is the message it receives from upper unit j, and Σⱼ adds over upper units that send it messages. Gathering these messages matters in recurrence. A state can contribute to more than one subsequent operation, so its relevance depends on the paths traced through all those uses.

The paper tests two settings of δ. With δ = 1.0, the messages collectively preserve the relevance received at the upper unit. Summing the message numerators then collects the weighted inputs, the full bias, and the full stabilizing term, which together match the denominator. The paper calls this variant LRP cons. With δ = 0.0, the adjustment in the numerator vanishes, and relevance is only approximately conserved across weighted connections. The authors describe part of it as being absorbed by biases. Their default, called LRP, is the setting with δ = 0.0.

This arithmetic also helps explain how relevance acquires a sign. A weighted input can contribute in a direction that differs from the combined weighted sum, so an individual message can have a sign that differs from the received relevance. Each lower input is considered through the weight on its actual connection and its activation in context. By the time the calculation reaches the word vectors, a negative contribution can therefore be read as evidence allocated against the class being explained.

How the backward pass handles a gate

At a multiplicative connection, the authors distinguish the gate from the source. In the forward calculation, the gate scales the amount of the source that reaches the next unit.

zⱼ = z_g · z_s

Here zⱼ is the product, z_g is the gate value, and z_s is the source value. The dot denotes scalar multiplication for the component being considered. In the LSTM, a sigmoid supplies the gate, whose value lies between 0 and 1. The paper also allows for a gate of the form one minus a sigmoid output in a GRU. The notation g in this product labels a generic gate. In the recurrence above, gₜ specifically denotes the candidate update and serves as the source in one of the products.

R_g = 0,  R_s = Rⱼ

Here Rⱼ is the relevance assigned to the product. R_g is the relevance routed to the gate via this product, set to zero, and R_s is the relevance sent to the source, set equal to Rⱼ. The rule accounts for the whole incoming relevance of the product. Each gated product in the recurrence can be handled in the same way, whether the source is old memory, a candidate update, or the activated current memory.

The distinction between the forward and backward calculations is central to the authors’ explanation. A gate can change the value of a product substantially. In turn, that product can make a smaller or larger forward contribution to a later operation. The weighted rule takes the resulting value into account when it computes relevance for the product. By the time relevance reaches the product in the backward pass, the forward effect of gating has already entered the calculation. The local backward rule then credits the source for the part that got through.

The assignment of zero at the gate also fixes what this explanation means. It follows the flow of the information that survives gating. It gives no separate allocation through that product to the inputs that caused the gate to open or close. For example, a reader might want to know which word led a forget gate to retain a memory. That asks about the cause of the control decision, whereas the proposed rule follows the contribution of the retained memory to the chosen class score.

How input dimensions become words again

Once either method has worked backward to the input, the authors aggregate the feature values within each word vector. This is where a coordinate-by-coordinate calculation becomes a word-level explanation.

Rₜ = Σ_d Rₜ,d

Here Rₜ is the relevance of the word at sentence position t, Rₜ,d is the relevance of coordinate d in its embedding, and Σ_d adds over coordinates of that embedding. Under SA, those coordinates contribute non-negative squared derivatives. Under LRP, their values can have either sign, so contributions in opposite directions can cancel within a word. The word score expresses the resulting net attribution.

The whole LRP calculation uses the original classifier and its forward activations for the input under examination. It is deterministic for a given sentence, target class, and relevance setting. Once the forward computation is available, the backward calculation requires a single propagation pass. The authors emphasize this because alternative explanation procedures can involve repeated input changes or random sampling. Their later word-removal experiments involve new predictions, but those predictions are used to evaluate the explanation after it has been computed.

Experiments and results

The classifier and the test set

The authors use the 2210 tokenized sentences in the Stanford Sentiment Treebank test set and lower-case them before classification, following the procedure used with the earlier classifier. The fine-grained labels range from very negative through negative, neutral, and positive to very positive. On complete test sentences, the bi-LSTM reaches a five-class accuracy of 46.3%. On the binary evaluation, which distinguishes positive from negative and excludes neutral sentences, its test accuracy is 82.9%. These are measurements of the classifier before the authors use relevance to remove any words.

Bi-LSTM test accuracy by label setting on Stanford Sentiment Treebank

The classifier achieves higher accuracy on the binary evaluation, which excludes neutral sentences.

Bi-LSTM test accuracy by label setting on Stanford Sentiment TreebankBi-LSTM, five-class evaluation: 46.3Bi-LSTM, five-class evaluation46.3Bi-LSTM, binary evaluation (this paper): 82.9Bi-LSTM, binary evaluation (this paper)82.9
The numbers
System or settingaccuracy %
Bi-LSTM, five-class evaluation46.3
Bi-LSTM, binary evaluation (this paper)82.9

Both rows describe the same classifier under different evaluation conditions. The binary score belongs to a task with fewer choices and a different set of eligible test sentences. The reported figures establish how well the classifier predicts under each label setting. The evidence for the explanation method comes from the relevance comparisons below. In those comparisons, the main alternatives are ordinary LRP and the squared-gradient SA baseline. The word-removal experiment adds conservative LRP and a random removal order.

Reading the heatmaps

The authors display selected test sentences from the very negative and very positive classes. They show the true label alongside the classifier’s label and use the true class as the explanation target in every example. This keeps the color interpretation consistent even when the classifier makes an error. A negative LRP value always means opposition to the target printed for that sentence. It can therefore be sensible to see a positive-sounding word in blue when the target is very negative.

The SA plots use red for sensitivity, with intensity normalized to the greatest relevance within the sentence. The LRP plots use red for positive relevance and blue for negative relevance, normalizing intensity by the largest absolute relevance in that sentence. The colors help locate relatively strong words within a sentence. Their per-sentence normalization makes cross-sentence comparisons of raw relevance magnitudes unavailable from color alone.

In the very negative examples, SA can give strong scores to words such as “thrilling” and “must-see.” It can also emphasize “difficult” in a very positive example. These are intelligible candidates for words to which the class score might be sensitive. The LRP heatmaps give them a more specific role. “Thrilling” is evidence against the very negative target, while words such as “waste” and “disaster” supply evidence for it. In a very positive example, “difficult” appears on the opposing side, while “worthy” receives supporting relevance.

The same distinction helps with some mistakes. In a sentence with a very negative reference label that the classifier calls very positive, LRP shows relevance against the true class around “must-see list.” Another very negative example receives a positive prediction, and words including “remember” and “future” acquire negative relevance for its true class. In an example whose true class is very positive, the word “fails” receives a strongly negative word attribution. These examples let a reader see where the system encountered evidence working against the expected label.

Finding representative words across sentences

The authors also ask what kinds of words appear at the extremes of the rankings across the test set. They use all 2210 test sentences and keep the explanation target fixed at very positive. They then rank the occurrences of words by their relevance values across those sentences. The paper inspects the ten highest and ten lowest entries for each explanation method. The resulting lists characterize the tails of the rankings for that target, including scores from sentences whose own labels differ from it.

For SA, high-scoring entries include “broken-down,” “lackadaisical,” and “mournfully.” These are words with comparatively strong meanings, though their meanings give little reason to treat them as representative evidence for the very positive class. At the other end of the SA list, the authors see common stop words. That is consistent with a measure where low values indicate weak local sensitivity.

With LRP, the high end features words such as “funnier,” “gorgeous,” and “excellent.” At the low end are words such as “wrong,” “forgettable,” and “nonsense.” Both ends are informative for the same target. The higher end contains recognizable ways of expressing approval, and the lower end contains recognizable sources of opposition to a very positive reading. Because each ranking begins with a score for a word occurrence in a sentence, the lists are a snapshot of contextual attributions across the corpus.

Testing what happens when words are removed

For word removal, the authors retain the 1849 test sentences that have at least 10 words. Each eligible sentence is first explained in its original form, with the true sentiment class as the target. The resulting relevance values determine a fixed order for removing up to 5 words. To remove a word, the authors set its embedding to zero, leaving its position in the sequence in place. The recurrent classifier then predicts again after the interventions, so the experiment measures how classification accuracy changes as the selected input information is suppressed.

The protocol asks different questions on initially correct and initially incorrect sentences. On sentences with the right initial label, the authors remove the words with the highest relevance first. A useful ranking of supporting evidence should identify inputs whose removal makes correct decisions harder to sustain. On sentences with the wrong initial label, they remove the words with the lowest relevance first. A useful ranking of opposing evidence should identify inputs whose removal makes the true class easier for the classifier to select.

The baseline is a random word order, averaged over 10 runs. The figure caption reports std < 0.016 for random deletion. The results are given as accuracy trajectories over the number of words removed. For initially correct sentences, the standard LRP ranking produces the strongest decline. For initially incorrect sentences, it yields the strongest improvement. Conservative LRP is close to standard LRP, with the reported comparison slightly favoring the default setting. In the initially incorrect group, removing the words with the smallest SA values does worse than choosing them at random.

The design gives a practical test of the signed rankings. If the lowest scores identified words with little effect, removing them would have little ability to restore the true label. When low LRP scores instead identify opposition to that label, suppressing the selected inputs can help the classifier recover. The direction of the desired accuracy change is part of the test. A loss of accuracy is informative on the initially correct group, and a gain is informative on the initially incorrect group.

Where the relevance falls in longer sentences

The positional analysis uses the 1104 test sentences with at least 19 words, reported as 50.0% of the test set. To compare sentences of differing lengths, the authors divide each one into 10 equal relative intervals. If a word’s span crosses an interval boundary, each interval receives its portion of the word’s relevance. For LRP, the statistic takes the absolute value after the relevance has been aggregated to the word level, so opposing signs cannot cancel between words in the same interval. The aggregate is normalized to sum to one.

The authors compute distributions for different target classes, using the combined relevance as well as the part from each encoder direction. For most targets, more relevance lies in the second half of the sentence. Neutral is the exception described in the paper. There, the ends of the two encoder computations receive considerable relevance, producing an approximately symmetric total across sentence position. The authors also observe that the left encoder, which reads in original order, tends to give smoother positional distributions than the right encoder.

They suggest that longer movie-review sentences may open by setting up a topic and put the strongest judgment later. That would offer one explanation for the later concentration of relevance for polarized classes. The measurement itself concerns the position of attribution under this classifier. The proposed pattern of how reviewers organize their judgments is the authors’ interpretation of that measurement.

What the ablations show

The effect of enforcing conservation

The controlled change within LRP is the setting of δ in the rule for weighted connections. The classifier, the data, the target labels, and the rule for gated products stay fixed in this comparison. Standard LRP uses 0.0, which permits relevance to be absorbed through the weighted rule. Conservative LRP uses 1.0, which allocates the full upper-unit relevance among the lower inputs. This changes how quantities are passed through the network while preserving the same procedure for producing a ranking and testing it.

The two variants yield similar word-removal behavior. The standard version is slightly stronger in the reported comparison. This suggests that exact conservation at weighted connections contributes little additional benefit under the tested deletion criterion. It also shows that the result is compatible with a degree of tolerance to the way biases are handled. The figure evaluates the orders in which words are selected. Similar curves can result from similarly useful rankings even when the underlying numerical allocations differ.

This parameter comparison is narrower than a test of the recurrent extension itself. Both variants route relevance through the source input of a product. Their performance tells the reader how the written weighted rule behaves under the alternative conservation settings. The evidence for the gate rule as part of LRP comes from the performance of the complete procedure. Establishing what is gained specifically by its allocation to the source would require a comparison with another rule for the same products.

Why the low end of the ranking matters

The comparison with sensitivity analysis is especially revealing on the initially misclassified sentences. The lowest SA values are the smallest squared derivatives. They rank words that make the chosen score locally insensitive. The lowest LRP values can be strongly negative, which places words there according to how much allocated evidence they supply against the true class. Sorting both scores in ascending order is mechanically the same operation. The meaning of the first items selected by that operation differs.

The result against random removal supports the distinction. When SA removes its least sensitive inputs first, accuracy recovers more poorly than under random removal. This is consistent with the experiment spending its earliest interventions on words with very little effect. LRP’s lower tail is more informative for this purpose. Removing those words tends to make the expected label more attainable. The word lists offer a qualitative counterpart. Common stop words occupy the low SA tail, while recognizable negative expressions appear at the low LRP tail for the very positive target.

At the high end, the initially correct group tests whether the ranking finds words the classifier relies on to sustain a successful decision. Standard LRP produces the strongest loss of accuracy as those words are removed. Together, the two groups give separate evidence about the two ends of a relevance ranking. The correct group tests the removal of support, and the incorrect group tests the removal of opposition. This is more specific than an aggregate claim that relevance merely identifies influential words.

The comparison still changes several things at once. SA starts from local derivatives, squares them, and sums them by word. LRP starts from a class score, uses connection-specific allocation rules, and aggregates signed values. The contrast therefore shows how these complete methods behave. The experiment does not isolate the gain attributable to carrying signs from the gain attributable to redistributing a score or treating gates in a particular way.

What the contextual examples reveal

The selected heatmaps let the authors inspect effects that corpus-wide rankings can obscure. Negation is their main example. With very negative as the target, negators associated with words such as “waste” and “horrible” receive negative relevance in the examples discussed. Negators occurring with favorable expressions such as “worth,” “funny,” or “good” can receive positive relevance for the same target. The direction depends on the context in which the negation appears.

This pattern is reasonable for a sentence that weakens a criticism or qualifies praise. An expression associated with a bad outcome can contribute differently when the sentence says that the outcome does not apply. Conversely, denying a desirable property can push the sentence towards an unfavorable reading. The heatmaps show that the relevance assigned by LRP varies in a way compatible with these movements. They also give a reader a more precise place to look when the overall prediction seems surprising.

This is a qualitative comparison of examples, so the results speak about the illustrated sentences. A sign assigned to a negator captures its attributed contribution to a class score as a word occurrence. It does not identify the full syntactic scope of the negation. Likewise, the attribution to an approving term inside an otherwise negative sentence describes its role under the classifier’s computation. A reader can use the surrounding text to interpret that role. The displayed heatmaps supply neither a separate scope analysis nor a score for scope detection.

The heatmaps and the lists of extreme words operate at different scales. Individual examples let the reader see clues whose value depends on nearby words. The pooled ranking gives a broader view of which expressions fall at the tails for a given target. A dataset-wide list naturally foregrounds recognizable cues such as evaluative adjectives. The contextual examples show why the method still needs to compute relevance for each occurrence, including occurrences of words that would be difficult to classify in isolation.

What separating the directions tells us

The positional plots compare the relevance attributed through the original-order encoder and the reverse-order encoder. Because the two encoders traverse the same sentence in opposite directions, their late computational positions lie at opposite ends of the source text. The neutral result illustrates why the distinction matters. A tendency to emphasize late computational steps can put relevance near both ends when the contributions are combined in ordinary word order.

For most target classes the total distribution is more heavily weighted toward the latter half. The paper also notes the smoother distribution from the original-order encoder. The authors regard this difference as surprising because the encoder structure itself provides no designated distinction in how the directions should process sentiment cues. They present the asymmetry as an observed property of the trained classifier and the review sentences under analysis.

Separating the directions is an analysis of existing attribution paths. Both encoders remain in the classifier. A test with an encoder disabled would ask how much its computation contributes to accuracy or changes individual predictions. These plots instead ask where in a sentence each encoder’s attributed contribution falls. That distinction lets the results speak about positions and direction-specific distributions without treating them as evidence about how well either encoder could classify independently.

Limitations

Limits identified by the authors

The authors explicitly tie the usefulness of explanations to the quality of the underlying classifier. LRP explains scores generated by the classifier it is given, including scores that support a mistaken decision. A clear attribution can reveal a cue the classifier relied on and still leave the predicted label wrong. The paper suggests that a better-tuned classifier might give more useful explanations, which makes the quality of the classifier and the quality of the attribution separate matters to examine.

The authors also describe the scope of the empirical work through the extensions they leave for future study. The evaluation concerns a word-level bi-LSTM for sentence sentiment. Character-level networks and GRUs are proposed as future applications. Extractive summarization is another possible task, as are applications of recurrent networks outside text. The description of the gate rule supplies reasons that these transfers could be attempted. The paper’s evidence about explanation quality comes from the sentiment experiments.

The proposed account of the positional asymmetry is tentative in the paper. The authors suggest a connection between a review sentence’s opening setup and a judgment expressed later. The positional analysis groups relevance by relative location and chosen class. It does not independently label the parts of each sentence that describe the movie or express an evaluation. The distribution is evidence for where the classifier’s attributions concentrate in this setting. The suggested explanation in terms of review composition remains a hypothesis.

Limits of the evaluation setup

The experiments reuse a single trained classifier on one movie-review benchmark. This makes the comparison between explanations focused, since each method sees the same sentences and the same underlying decision function. Its generality across different training runs, other recurrent sentiment classifiers, or other kinds of text remains open. The five-class and binary accuracies describe the classifier on their respective test settings. They provide context for the explanation study without measuring the fidelity of any particular heatmap.

The deletion experiment tests a specific intervention. A zero vector still occupies the position of the removed word and participates in a recurrent pass whose other inputs remain in their original places. The classifier may respond to that changed sequence differently from the way it would respond to a grammatical revision that removes or replaces the expression. The resulting curves are evidence about what happens under zeroing, using the classifier’s own predictions as the outcome. They establish neither how a human reader would interpret the revised sentence nor how every other way of masking a word would behave.

The procedure ranks each sentence before deletion begins. Removing several words applies that original ordering to inputs that have already changed. An early deletion can change the contextual role of a word that is removed later. The curves therefore evaluate a ranking of evidence in the intact sentence through cumulative interventions. They give no step-by-step attribution for the modified sentence after every removal. The minimum length also limits the result to the eligible test sentences, leaving the shorter ones outside this comparison.

The use of the true class is another boundary on interpretation. On an initially incorrect sentence, the explanation asks what worked against the known label. Recovery of that label after suppression supports the ranking for this diagnostic task. In ordinary prediction, the true label may be unavailable. A user asking why the classifier picked the displayed class would select that class and obtain a different class-conditioned explanation. The paper’s use of the true class is important when reading both the signs in the heatmaps and the improvement on the initially incorrect group.

The qualitative examples and extreme-word lists are also selective in different ways. The heatmaps focus on illustrative test cases at the ends of the sentiment scale. The pooled word lists look only at the extremes for the very positive target. Neither view provides a frequency estimate for how often the interpretations hold across all labels, all constructions, or all words. The neutral case in the positional analysis further shows that findings about a polar class need to be kept distinct from findings about other targets.

Finally, signed relevance depends on the allocation rules the paper chooses. Giving the source all of a product’s relevance produces a clear attribution of passed information. It leaves the mechanism that formed the gate value without a separate allocation through that product. The experiments confirm that this choice can participate in an informative explanation procedure for the task. They provide no comparison among alternative allocations to the gate and source. A word-level score also condenses potentially opposing contributions within an embedding, and per-sentence color normalization further restricts how the resulting maps can be compared. The signed displays are best understood as class-specific accounts of the chosen classifier and propagation procedure.

What came after

The closest later paper in subject is Evaluating Recurrent Neural Network Explanations. Its title makes explicit a shift in emphasis from proposing an explanation procedure to evaluating explanations for recurrent systems. The sentiment paper already addresses this question by checking both whether the attributions make sense in context and whether the word rankings predict the effects of intervention. The later citation places that study within a continuing line of work on what should count as evidence for a recurrent explanation.

Analysis Methods in Neural Language Processing: A Survey places the paper in a wider discussion of methods for studying neural language processing. One distinction the sentiment study brings to that discussion is the difference between examining an intermediate representation and assigning an output score back to the input. Its comparison of gradients and propagated relevance also shows how procedures with different meanings can yield superficially similar displays. The survey’s citation connects the study to the broader practice of analyzing how neural systems process language.

Explainable Artificial Intelligence (XAI): Concepts, taxonomies, opportunities and challenges toward responsible AI cites the work from a broader perspective on explainability. The sentence-level method gives a concrete case for that perspective. It explains one chosen decision using a classifier’s own computation and reports tests tied to the intended meaning of the explanation. The citation links a task-specific procedure to a discussion whose stated scope includes concepts and taxonomies of explainability.

The Elephant in the Interpretability Room brings saliency into a discussion of whether attention should be used as explanation. The relevance of the sentiment paper to that question lies in the kind of evidence it asks a word attribution to supply. A display has a designated target, its colors have a precise meaning, and its word ranking can be challenged by changing the input. The later paper’s citation connects this signed attribution study to the question of what an explanatory signal should offer alongside the prediction.

Before Name-Calling: Dynamics and Triggers of Ad Hominem Fallacies in Web Argumentation provides a citation from a different text-analysis task. The subject of that work is the dynamics and triggers of personal attacks in web argumentation. Its thematic connection to the sentiment paper is the interest in evidence within the text that bears on a judgment about the text. The citation establishes that connection across tasks. It leaves open whether the later work used the same propagation rule or the same type of recurrent classifier.

The Hidden Attention of Mamba cites the paper in another architectural setting. Its subject is attention in Mamba systems. The connection visible across the two papers is the interest in how a sequence computation leads to an output and what can be traced back to elements of the input. The earlier method is specifically an allocation rule for gated products in an LSTM. The citation provides a link between the research questions, with no basis for attributing the earlier rule to the later architecture.

The citation in 深度知识追踪模型综述和性能比较 reaches into work on deep knowledge tracing and performance comparison. Its presence shows that the sentiment paper was cited in a study with a different stated application. Across these works, the strength of the documented connection varies. Evaluation of recurrent explanations and the discussion of saliency are the closest matches to the original paper’s question. The citations in work on argumentation, Mamba, and knowledge tracing show a wider reach, while the details of any direct technical reuse remain unspecified.

Cite

Cite as Leila Arras, Grégoire Montavon, Klaus-Robert Müller and Wojciech Samek. 2017. Explaining Recurrent Neural Network Predictions in Sentiment Analysis. Proceedings of the 8th Workshop on Computational Approaches to Subjectivity, Sentiment and Social Media Analysis.

The paper itself, not this page. BibTeX from the library's record of the work. DOI 10.18653/v1/w17-5221

@inproceedings{arras2017explaining,
  title = {{Explaining Recurrent Neural Network Predictions in Sentiment Analysis}},
  author = {Leila Arras, Grégoire Montavon, Klaus-Robert Müller and Wojciech Samek},
  booktitle = {Proceedings of the 8th Workshop on Computational Approaches to Subjectivity, Sentiment and Social Media Analysis},
  year = {2017},
  doi = {10.18653/v1/w17-5221},
  url = {https://doi.org/10.18653/v1/w17-5221}
}

↑ back to top

This page in Markdown https://md.research.elamur.ai/free/en/papers/arras-2017-explaining-recurrent-neural-network-predictions/