Elamur Research

Rethinking Attribute Representation and Injection for Sentiment Classification

Paper · 2019 · Reinald Kim Amplayo

Summary

A reviewer who enjoys sweet desserts may dislike sweet drinks. A sentiment classifier can use that reviewer’s identity to pay more attention to the sentence about a drink, but it still needs to decide what sweetness means in that sentence. Reinald Kim Amplayo uses this distinction to revisit the standard way of adding reviewer and product information to review rating prediction. Earlier systems commonly used the identities to adjust the scores that determine which words receive the most attention. This paper asks whether those identities are more useful when they change how the system represents words, interprets them in context, or turns a reading of the whole review into a rating. The task belongs to Sentiment & emotion.

The paper introduces the Chunk-wise Importance Matrix, or CHIM. It turns a pair of learned reviewer and product vectors into gates that control the strength of connections in a neural classifier. The gates act on a shared weight matrix, so the same piece of text can produce different evidence under different reviewer and product identities. A compact pattern of gates is repeated across the matrix. This keeps the system from having to generate a separate value for every connection. To test where this information helps, the paper applies the same method at several stages of a bidirectional long short-term memory classifier.

On the IMDB, Yelp 2013, and Yelp 2014 test sets, putting CHIM at the word embedding stage gives the highest exact rating accuracy among the systems compared, at 56.4%, 67.8%, and 69.2%, respectively. The best placement for root mean squared error, which penalizes predictions farther from the observed rating, varies by dataset. The embedding variant leads on IMDB, and the variant that conditions the final classifier leads on both Yelp datasets. Attention is the weakest single placement in the smaller development-set comparisons with CHIM, yet combining attention with embedding produces the strongest result in a separate Yelp 2013 development experiment that tests pairs of placements.

The paper also asks whether rating prediction teaches the reviewer and product vectors anything useful beyond sentiment. It freezes those vectors and uses them to predict product categories and generate review headlines on Amazon data. Vectors learned by conditioning the word encoder yield the best results on both tasks. The category experiment gives the clearer evidence of transfer. The headline experiment shows a modest gain in predicting headline text from the identities alone, and the paper leaves open how much practical value that gain has.

Deep dive: Rethinking Attribute Representation and Injection for Sentiment Classification

Reinald Kim Amplayo tests how reviewer and product information can change the way a sentiment classifier reads a review and predicts its rating. · about 35 minutes to read

The problem and its context

A rating depends on who wrote the review and what they reviewed

The task starts with a review, the identity of its author, and the identity of the item under review. The system predicts the rating attached to that review. This is a form of Text classification.

The text provides much of the evidence. It can describe qualities of an item, say whether those qualities met expectations, and give reasons for the verdict. The author and item identities are a different kind of input. Each is a categorical attribute, meaning that its value selects an entity from a collection of possible entities. A reviewer ID carries no description of the reviewer’s tastes on its own. Its value to the classifier comes from patterns associated with that reviewer across examples. The same applies to the item ID. The paper treats both as information the classifier can learn to use alongside the words.

This matters because a recurring pattern in ratings and a recurring pattern in the interpretation of a phrase are different things. A reviewer may consistently give modest ratings. Knowledge of that tendency can help the system predict a rating from a new review by the same person. The reviewer may also attach different significance to the same quality depending on what it describes. In that case the useful information concerns the combination of words and identity. A general tendency towards modest ratings accounts for only part of what the reviewer can contribute. The paper asks how the architecture can express these different kinds of dependence.

Earlier sentiment research had already made use of categorical information. The paper describes work that supplied reviewer and product information as features to classifiers before neural approaches became common. It also discusses attributes that can situate a text in place or time, as well as attributes inferred from text, such as topics, aspects, and features of argumentation. These examples broaden the motivation. The method concerns a way of conditioning a text classifier on categorical information, even though the experiments concentrate on reviewer and product IDs.

Attention became the common entry point

According to the paper’s account, the work of Tang and colleagues established that adding reviewer and product information could improve neural sentiment classification. Chen and colleagues subsequently introduced a design that became common in later systems. It places attribute information inside attention, the stage that assigns different weights to the contextual representations of words before gathering them into a representation of the review. In this design, the system learns a vector for each reviewer and item, projects the vectors into the space where attention scores are computed, and adds the results to the usual attention calculation.

The attraction is straightforward. The words worth emphasizing may vary with the item or the person. A reviewer may care much more about a restaurant’s drinks than its desserts, for example. An attention mechanism that receives a reviewer ID has a way to emphasize the relevant part of the review. The paper credits earlier studies with showing that changing the identity information can change which words receive attention. It accepts that mechanism as a way to personalize the selection of evidence.

Much of the subsequent work described in the paper kept some form of this design while adding other capabilities. Some systems distinguished reviewer and product attention more explicitly. Some brought in external signals about how a reviewer tends to rank items. Others introduced a hierarchy for handling words and sentences, or used memory drawn from related reviews. One study considered cold-start entities, for which there is little or no established history from which to learn a useful identity representation. That work is Cold-Start Aware User and Product Attention.

Those developments left a narrower question open. If a system gains accuracy after it acquires a more elaborate architecture, the result gives limited guidance about the operation that introduces identity information. Amplayo holds the basic architecture simple and changes that operation. The controlled comparison asks whether the attribute should enter as an additive offset or should instead change a weight matrix, and whether it should act on a word, a word in context, the selection of words, or the final rating decision. This makes the location of the change part of the research question.

Choosing evidence and interpreting evidence

Consider a review that comments on both cake and wine. The identity of the reviewer may help the system decide that the wine comment deserves more weight. That decision leaves a further question about how to read the description. Sweetness could be a desirable quality in the cake and an unwelcome quality in the wine. With attention-only conditioning, the identity information enters the scores used to select evidence. The underlying word representations have already been computed by the time that happens.

The paper’s other placements offer different routes for making use of an identity. At the embedding stage, identity can change the representation associated with a word before the system has read its neighbors. In the encoder, it can change the operation that brings those neighbors into the representation. At the classifier, it can change which aspects of the pooled review matter for assigning a rating. Each placement gives the attribute access to information at a different scale. That is the reason to test them separately, even though every version takes the same review and metadata as input.

The distinction also explains the paper’s interest in going beyond additive offsets. An offset can express that a reviewer tends toward particular ratings, or can change the inputs to an attention scoring function. A weight matrix governs how the textual features themselves are combined. Making those weights depend on the reviewer and product gives the system a direct way to change the contribution of a feature according to the identities. The hypothesis concerns that interaction. It does not require positing that the classifier can reconstruct a reviewer’s preferences in words.

The method, step by step

The route from words to a rating

The base classifier processes a review in stages. It looks up each word in a shared embedding table, then transforms the result. It reads the transformed words in both directions with a bidirectional long short-term memory encoder, abbreviated BiLSTM. Each position acquires a representation that depends on neighboring words. Attention then assigns weights to the contextual representations and pools them into a single vector for the review. A final classifier gives each rating a score and chooses the rating with the largest score.

The word embeddings are vectors, or ordered collections of numerical features. The lookup gives a word its initial vector before the rest of the sentence has been considered. At this stage, repeated occurrences of the same word start with the same vector. The encoder has a different job. It combines information across positions, so occurrences of the same word can acquire different contextual representations. In a review about food and drinks, for instance, the vectors for sweet can become distinguishable once one occurrence has been read in the company of a dessert and another in the company of a beverage.

Attention turns the resulting sequence into a weighted summary. A large weight gives a position greater influence over the review vector. The paper uses attention of the kind introduced in work on aligning input and output in Neural Machine Translation by Jointly Learning to Align and Translate.

The classifier reads the pooled vector and scores the rating classes. This route gives the study a series of places where the same kind of mathematical intervention can serve different roles. The extra route takes the reviewer and product vectors and uses them to form gates for a chosen stage. In the experiments that test a single placement, that stage is the only one whose transformation directly receives the identity information. If the stage is early, its outputs still carry the effect of the gates into all the work that follows.

How CHIM conditions a review rating prediction

The steps in order.

How CHIM conditions a review rating predictionStep 1: Look up the reviewer and product vectors1. Look up the reviewer and product vectorsStep 2: Project the joined vectors into a compact matrix2. Project the joined vectors into a compact matrixStep 3: Tile the matrix and apply sigmoid gates3. Tile the matrix and apply sigmoid gatesStep 4: Gate the shared weights at the selected stage4. Gate the shared weights at the selected stageStep 5: Embed the words and encode their context5. Embed the words and encode their contextStep 6: Pool contextual word vectors with attention6. Pool contextual word vectors with attentionStep 7: Score the ratings and select the highest7. Score the ratings and select the highest

The first part of the diagram constructs the adjustment for the selected stage. The remaining stages describe the route that the text takes, with the gates applied at the chosen point along that route. For attention injection, the encoder finishes before the text encounters any identity-specific weights. For embedding injection, the change is already present when the encoder starts. The separate experiments with two placements apply this idea at both selected stages.

The base classifier in equations

The paper represents a review as a sequence of words.

x = (x₁, …, xₙ)

Here x is the review, x₁ is its first word, xₙ is its last word, and n is its length. The ellipsis denotes the intervening words. The classification target is the sentiment rating associated with x. The paper also uses x as a generic input to an individual layer later in its derivation. In that use it denotes a vector at the chosen stage.

After lookup, the classifier applies an affine transformation followed by a hyperbolic tangent.

wₜ = tanh(W_emb x′ₜ + b_emb)

Here t indexes a position in the review, x′ₜ is the word vector from the lookup, and wₜ is the transformed embedding at that position. W_emb is the shared embedding-stage weight matrix and b_emb is its bias vector. Matrix–vector multiplication combines the input features, and the plus sign adds the bias. The tanh function acts on each component and maps it into a bounded range. CHIM at the embedding stage changes the matrix in this operation. The initial word lookup and the transformation of its output are distinct parts of the calculation.

The encoder uses a recurrent cell to pass information between positions. The paper writes the calculation for the forward direction. It forms a candidate update and the gates governing the cell from the current word and the preceding hidden state.

(gₜ, iₜ, fₜ, oₜ) = (tanh, σ, σ, σ)(W_enc [wₜ; h⃗ₜ₋₁] + b_enc)

Here gₜ is the candidate content, iₜ is the input gate, fₜ is the forget gate, and oₜ is the output gate, all for position t. W_enc is the gate computation’s weight matrix and b_enc is its bias. The bracket notation with a separator joins wₜ, the current transformed word vector, to h⃗ₜ₋₁, the preceding forward hidden state. The result of the affine transformation is divided into components for the listed outputs. The candidate uses tanh, and the gates use σ, the sigmoid applied element by element. A sigmoid maps values into the interval between zero and one, so a gate can attenuate a component by multiplying it by a value closer to zero.

The cell then combines what it retained from the earlier position with the gated candidate content.

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

Here cₜ is the current cell state and cₜ₋₁ is the previous one. The symbol ⊙ denotes elementwise multiplication. The product involving fₜ keeps a selected amount of the earlier cell state, and the product involving iₜ controls how much of the candidate gₜ is added. These gates depend on the word and the earlier hidden state through the preceding equation.

The paper writes the forward hidden state as the cell state multiplied by the output gate.

h⃗ₜ = oₜ ⊙ cₜ

Here h⃗ₜ is the forward hidden state at position t, oₜ is the output gate, and cₜ is the cell state at that position. The product is elementwise. The backward encoder runs in the opposite direction using the corresponding recurrence. The representation passed on to attention combines the states from the two directions.

hₜ = [h⃗ₜ; h⃖ₜ]

Here hₜ is the complete contextual representation of the word at t. The rightward arrow marks the forward state h⃗ₜ, and the leftward arrow marks the backward state h⃖ₜ. The brackets and separator indicate concatenation. When CHIM conditions the encoder’s weight transformation, the recurrence has access to identity-specific weights while it reads the review. Those weights can affect how information passes from one position to another as well as what is produced at the current position.

The attention calculation begins by transforming the contextual word vector into an intermediate vector.

eₜ = tanh(W_att hₜ + b_att)

Here eₜ is the intermediate attention representation for position t, W_att is the attention weight matrix, and b_att is the attention bias. The input hₜ is the word representation from the BiLSTM. The matrix product and addition make up the affine transformation, and tanh acts on its components. CHIM at attention acts on W_att.

A shared vector scores how informative each position is for the pooled review representation.

aₜ = softmaxₜ(vᵀ eₜ)

Here aₜ is the attention weight at position t. The learned vector v represents informativeness, and the superscript ᵀ transposes it so that vᵀ eₜ is a dot product, yielding a scalar score. The subscript on softmax indicates normalization across the word positions of this review. Each normalized weight depends on its own score and on the other scores in the same review. The informativeness vector follows the idea discussed in Hierarchical Attention Networks for Document Classification.

The pooled review vector is the weighted sum of the original contextual word vectors.

d = ∑ₜ aₜ hₜ

Here d is the document vector, ∑ₜ sums over all word positions, aₜ is a scalar weight, and hₜ is the contextual vector multiplied by that weight. The distinction between eₜ and hₜ matters. The intermediate vector eₜ helps decide how much a position counts, while hₜ supplies the information that is being averaged. An identity-dependent attention matrix can change d by changing the mixture of contextual word vectors.

The final decision uses a linear score for each class.

y′ = argmax(W_cls d + b_cls)

Here y′ is the predicted rating class, W_cls is the classifier weight matrix, d is the pooled review vector, and b_cls is a vector of class biases. The vector inside argmax contains one score for each possible rating. The argmax operation returns the class with the highest score. At training time the classifier minimizes cross-entropy, which penalizes it for assigning low probability to the observed rating. Choosing the largest score gives a predicted class at evaluation time.

What it means to change a bias or a matrix

The paper points out a common structure in the transformations used at the different stages.

g(f(x)) = g(Wx + b)

Here x is the input vector to the stage, f is its affine transformation, and g is the activation applied afterwards. W is the matrix multiplying the vector and b is the added bias. The symbol g in this equation names a generic activation, separately from the candidate content gₜ in the recurrent cell. The final classifier uses the affine scores for its decision. The common structure lets the study change the way a stage uses W or b while retaining its purpose in the overall classifier.

In the conventional attention design, the reviewer and product contribute through additive terms. Using the stage subscripts for clarity, the paper’s attention expression has this form.

eₜ = tanh(W_att hₜ + Wᵤu + Wₚp + b_att)

Here hₜ is the contextual word vector and eₜ is the attention representation. The embeddings u and p represent the reviewer and product. The learned matrices Wᵤ and Wₚ project those embeddings into the space of the attention transformation, and b_att is its ordinary bias. W_att is the matrix acting on the word vector. The result is passed to tanh and then scored and normalized as in the base classifier.

The additive contributions can be collected into a single identity-dependent bias.

b′ = bᵤ + bₚ + b_att

Here bᵤ is the projected reviewer contribution Wᵤu, bₚ is the projected product contribution Wₚp, and b′ is the combined bias. Together with W_att and hₜ, it gives the equivalent expression below.

eₜ = tanh(W_att hₜ + b′)

Here eₜ is still the intermediate attention representation and tanh is the same elementwise activation. The combined bias b′ is shared by all positions for that review’s reviewer and product. Because the addition is made before tanh, the shared offset can affect different words’ scores differently. The paper’s criticism concerns the direct text transformation W_att hₜ, whose matrix is shared across identities.

The distinction is especially easy to see if the same bias idea is applied to the final classifier, as in the paper’s illustration. Then identity-specific biases raise or lower particular class scores regardless of the contents of d. The document still influences the output through the ordinary weight matrix. An identity-conditioned matrix gives another possibility. It can make the effect of a specific document feature depend on the identities. The example motivates a way to express individual preferences about the contents of reviews, in addition to tendencies towards particular ratings.

Generating a whole matrix

The direct matrix variant starts by concatenating the reviewer and product vectors and projecting them into a vector long enough to populate the target matrix.

w′ = W_c [u; p] + b_c

Here w′ is the projected vector, u is the reviewer vector, and p is the product vector. The bracket notation joins them. W_c is the learned projection matrix, and b_c is its bias. The output has as many entries as are needed to fill the weight matrix at the destination stage.

W′ = reshape(w′, D₁ × D₂)

Here reshape arranges the entries of w′ as the new matrix W′, with D₁ rows and D₂ columns. The multiplication sign in the shape gives its row and column dimensions. Those dimensions match the weight matrix being replaced.

f(x, u, p) = W′x + b

Here f is the resulting affine transformation, x is the layer’s input vector, and b is its ordinary bias. The matrix W′ depends on the identities u and p, so it can change how much any given input feature contributes to an output. The bias remains shared.

The attraction of this construction is also the source of its cost. The projection produces an entry for every weight of the destination matrix. The paper motivates the scale of the problem in terms of all reviewer and product combinations and the dimensions of the destination weights. Its equations generate the matrix through a shared projection of two embeddings. In that construction, a larger destination matrix means a longer output from the projection, even with the shared parameterization. The paper expects the burden to be especially consequential where the matrix being replaced is large.

Sharing a gate across parts of the matrix

CHIM keeps the idea of changing how inputs are weighted. It generates a smaller matrix, then uses it to modulate the original weights. The projected vector is reshaped to a compact grid.

C = reshape(c, (D₁ / C₁) × (D₂ / C₂))

Here c is the compact vector obtained by linearly transforming the concatenated reviewer and product embeddings, and C is the resulting chunk matrix. D₁ and D₂ are the dimensions of the full layer matrix. C₁ is the repetition factor for the row dimension, and C₂ is the repetition factor for the column dimension. Division gives the size of the smaller grid along each axis. The multiplication sign separates the row and column dimensions of the shape.

Copies of C are arranged in a grid until they reach the shape of the shared weight matrix. Applying a sigmoid to every entry turns that tiled matrix into gates.

W′ = σ(tile(C, C₁, C₂))

Here tile repeats C along the two matrix dimensions according to C₁ and C₂. The elementwise sigmoid σ turns the tiled entries into values in the range described by the paper as [0, 1]. W′ is now the full-size gate matrix. This use of W′ differs from its role in the direct matrix approach. Here it contains multipliers for the existing weights. Corresponding entries in the repeated chunks have the same gate, while the original weights at those entries can differ.

The layer uses the gated weights when it processes the input.

f(x, u, p) = (W′ ⊙ W)x + b

Here f is the conditioned affine transformation, x is the input vector, and u and p are the reviewer and product vectors that produced W′. W is the original shared weight matrix, and b is the original bias. The product ⊙ multiplies corresponding entries of W′ and W. The resulting matrix is then multiplied by x. Gates near zero suppress the corresponding connections, and gates near one retain most of their strength. The shared weights can express positive and negative contributions, with the gates controlling their magnitude.

There are two forms of sharing in this calculation. The classifier learns a common set of underlying weights for all reviews, and the compact grid reuses a gate across repeated positions for a given pair of attributes. The first makes it possible to adapt a transformation learned from the full training collection. The second reduces what the attribute projection has to produce. The paper describes the result as a form of weight shrinkage or correction. An attenuated connection can be close to zero while still being used in the mathematical operation.

What each placement can change

At the embedding stage, CHIM affects how the classifier transforms a word vector in isolation. The adjustment can, for example, make two favorable adjectives represent different degrees of approval for a particular reviewer. It occurs before the BiLSTM reads surrounding words. All occurrences of the same word under the same attributes consequently receive the same initial adjustment, with the contextual encoder free to distinguish them later.

At the encoder, the identity information can affect the recurrent operation itself. A description of sweetness can contribute differently when it is read in the context of a cake than in the context of a drink. The paper presents this as an example of what the architecture makes possible. It does not measure individual gates against documented preferences about either item.

At attention, CHIM changes how contextual word vectors are scored for pooling. It can make the document vector place more emphasis on the part of a review concerned with a particular aspect of the product. The encoder has already supplied the contextual vectors in this setting. Making the pooling identity-sensitive can still change the final rating by changing the combination of textual evidence reaching the classifier.

At the classifier, CHIM changes how the completed review representation maps onto the classes. One reviewer’s history might teach the classifier to associate a feature of the whole review with stronger approval. The same feature could have less influence on the class scores for another reviewer or product. This intervention takes place after the words have been contextualized and pooled.

How the parameters are learned

In the general setup, the paper gives the word, reviewer, and product vectors 300 dimensions. Word vectors start from pretrained GloVe values.

The BiLSTM state is 300 dimensions in total, with 150 dimensions in each direction. Both chunk factors are set to 15 in the general setup. The paper reports a dropout rate of 0.1 on nonlinear connections and a mini-batch size of 32. Dropout is used during training to reduce reliance on individual activations. The corresponding earlier work is Dropout.

Training proceeds on shuffled mini-batches using stochastic gradient descent with Adadelta. The paper reports an ℓ₂ constraint of 3 and uses development-set performance to decide when to stop.

Learning the identity vectors is part of training for rating prediction. There is no separate annotation telling the projection which gates it should open. The cross-entropy objective supplies the signal through the chosen transformation. Thus a reviewer vector learned through the encoder receives supervision by way of its effect on contextual representations. A vector learned through the classifier receives supervision through its effect on the class scores. That difference becomes relevant when the paper takes the vectors out of the sentiment classifier and uses them for another task. The paper releases the implementation and datasets with CHIM.

Experiments and results

Review corpora and rating metrics

The main sentiment experiments use IMDB, Yelp 2013, and Yelp 2014. The paper uses previously curated versions in which reviewer and product records meet a twenty-core requirement. As the paper describes it, users are linked to at least twenty products, and products to at least twenty users. This gives the training procedure repeated examples involving the entities it is trying to represent. The corpora are divided at a reported 8:1:1 ratio into training, development, and test data. The earlier preparation used Stanford CoreNLP for tokenization and sentence splitting.

IMDB has 10 rating classes, with 67,426 training reviews, 8,381 development reviews, and 9,112 test reviews. The corpus includes 1,310 reviewers and 1,635 products. Yelp 2013 has 5 rating classes. It contains 62,522 training reviews, 7,773 development reviews, and 8,671 test reviews, with 1,631 reviewers and 1,633 products. Yelp 2014 also has 5 classes. Its splits contain 183,019 training reviews, 22,745 development reviews, and 25,399 test reviews. That corpus has 4,818 reviewers and 4,194 products.

Accuracy is the share of reviews assigned their observed rating. Root mean squared error, or RMSE, measures the typical magnitude of rating error by squaring the distance from the observed class, averaging those squared distances, and taking the square root. A prediction one class away and a prediction several classes away count equally as errors under accuracy. RMSE gives the farther prediction more influence. The paper uses both because a change in the classifier can improve the exact match rate and change the distribution of its errors in different ways.

The study first compares methods within the same smaller architecture on development data. It then compares the CHIM variants with published systems on the test sets. The development comparison helps isolate choices within the architecture. The test comparison shows how the finished classifiers fare against systems that make many other design choices at the same time.

The published comparison systems

UPNN uses a convolutional classifier that brings reviewer and product weights into the word representation and the final classification stage. UPDMN uses a recurrent classifier and makes related documents available through a separate memory network. DUPMN also uses memory, with a separate network for each of the two attributes and a hierarchical recurrent classifier. Together these systems cover ways of using metadata that include changing weights and adding extra sources of information.

NSC adds reviewer and product biases to attention over words and sentences in a hierarchical recurrent architecture. PMA supplements a related approach with external features, including information about how a user ranks items. HCSC combines recurrent and convolutional components and explicitly accommodates cold-start entities. CMA uses a recurrent encoder and hierarchical attention, with separate attention conditioning for reviewer and product. Differences among these baselines include the text architecture and the available information, in addition to how reviewer and product identities are introduced.

The paper’s own four test systems share a BiLSTM classifier and each use CHIM in a different single location. Their comparison is useful for reading the headline result. A gain shared by several placements suggests that the new way of representing the attributes matters, while the spread across placements shows that the destination still matters. The published systems provide a second comparison against previously reported results on the same benchmarks.

Exact rating accuracy on the test sets

On IMDB, embedding conditioning gives the highest reported test accuracy. The strongest published accuracy in the comparison comes from HCSC. The encoder and classifier variants also do well, with attention yielding the lowest accuracy among the CHIM systems on this dataset.

Selected published systems and CHIM placements on IMDB test accuracy

Conditioning the embedding gives the highest exact rating accuracy in the comparison.

Selected published systems and CHIM placements on IMDB test accuracyNSC: 53.3NSC53.3HCSC: 54.2HCSC54.2CMA: 54.0CMA54.0CHIM attention: 54.4CHIM attention54.4CHIM classifier: 55.5CHIM classifier55.5CHIM encoder: 55.9CHIM encoder55.9CHIM embedding (this paper): 56.4CHIM embedding (this paper)56.4
The numbers
System or settingaccuracy %
NSC53.3
HCSC54.2
CMA54.0
CHIM attention54.4
CHIM classifier55.5
CHIM encoder55.9
CHIM embedding (this paper)56.4

The same placement leads on Yelp 2013. CHIM at the embedding stage achieves 67.8% test accuracy. The classifier placement gives 67.5%, the encoder 67.0%, and the attention placement 66.5%. CMA, the published accuracy leader in the paper’s Yelp 2013 comparison, records 66.4% on that test set. This is a case where several CHIM placements surpass the previous best listed accuracy while retaining a visible ordering among themselves.

On Yelp 2014, embedding conditioning achieves 69.2% test accuracy. The corresponding values for classifier, attention, and encoder conditioning are 68.9%, 68.5%, and 68.4%. CMA and DUPMN each report 67.6% test accuracy, the highest listed among the published comparison systems for this dataset. The placement ordering contains an exception to the broad development-set pattern. On Yelp 2014 test accuracy the encoder scores below attention, while the embedding stage still gives the strongest result.

Across these benchmarks the highest exact match rate comes from changing the transformation immediately after word lookup. That placement personalizes the features that enter the encoder and continues to influence the result through contextualization and pooling. The experiment shows that this route works well for prediction in the tested setting. The interpretation that it captures personalized lexical intensity comes from the structure of the intervention and the illustrative examples, instead of a direct annotation of intensity.

How far the predictions miss

For IMDB, CHIM at the embedding stage also produces the lowest test RMSE, at 1.161. CMA has the strongest listed published value, 1.191. The classifier and attention variants each have a test RMSE of 1.219, and the encoder gives 1.234. The relative position of the encoder illustrates why an accuracy ordering cannot stand in for an error-distance ordering. It is among the stronger choices for IMDB exact matches and has the highest IMDB test RMSE among the CHIM variants.

On Yelp 2013, the classifier placement has the lowest test RMSE, at 0.641, followed among the CHIM variants by embedding at 0.646, encoder at 0.659, and attention at 0.664. The best published Yelp 2013 RMSE in the comparison is HCSC’s 0.660. The choice between the embedding and classifier placements on this dataset depends on whether the objective is exact agreement or smaller errors in the rating scale.

The classifier likewise has the lowest test RMSE on Yelp 2014, as the comparison below shows. The embedding placement still performs strongly on error distance, while retaining its lead for exact matches. The model with the best result under a given metric outperforms the corresponding published results listed for that dataset.

Selected published systems and CHIM placements on Yelp 2014 test RMSE

Conditioning the final classifier yields the lowest rating error by this measure.

Selected published systems and CHIM placements on Yelp 2014 test RMSEPMA: 0.641PMA0.641DUPMN: 0.639DUPMN0.639CMA: 0.637CMA0.637CHIM attention: 0.634CHIM attention0.634CHIM encoder: 0.631CHIM encoder0.631CHIM embedding: 0.629CHIM embedding0.629CHIM classifier (this paper): 0.622CHIM classifier (this paper)0.622
The numbers
System or settingRMSE
PMA0.641
DUPMN0.639
CMA0.637
CHIM attention0.634
CHIM encoder0.631
CHIM embedding0.629
CHIM classifier (this paper)0.622

The Yelp results give a concrete reason to keep the metric attached to any claim about the best placement. An exact class prediction and a small miss carry distinct consequences in the two measures. The reported test scores show where each aggregate improves. The paper does not break these results down into individual kinds of rating error, so the scores cannot identify the specific substitutions that account for the advantage of the classifier placement under RMSE.

Transfer from sentiment training on Amazon reviews

The transfer experiment poses a different question. If a reviewer vector or product vector is learned while predicting ratings, it may retain information that a second system can use for another purpose. The paper trains the sentiment classifier on Amazon reviews, saves the reviewer and product encodings, and supplies them as fixed inputs to separate systems for category prediction and headline generation. The identity encodings are the transferred objects. The inference route that reads review text and predicts ratings is used to learn them.

The Amazon dataset contains review text, ratings, reviewer and product IDs, product categories, and review headlines. For sentiment training, the paper applies the twenty-core criterion, prepares the review text with CoreNLP, and divides the data at an 8:1:1 ratio. The collection after this preparation contains 77,028 examples, 1,728 reviewers, and 1,890 products.

The category and headline tasks use a new division. Within that division, a reviewer assigned to a split appears only in that split, and the same rule applies to products. The authors remove reviewer–product pairs that fail the split condition and attach the target category and headline to the remaining pairs. The resulting downstream data contain 46,151 training instances, 711 development instances, and 840 test instances. The possible product categories are Music and Video DVD. Headlines are segmented with SentencePiece using a vocabulary of 10k. This is a use of Subword tokenization.

The split rule concerns exposure to downstream supervision. Across splits within the transfer task, a downstream system cannot rely on having trained on the very same product ID with its category already attached. The reviewer and product vectors are already available from sentiment training when this task starts. Their availability is part of the transfer setup, and keeping them fixed makes downstream performance evidence about information the training procedure has already put into those vectors.

For product category, the downstream system is a logistic classifier that reads the fixed encodings. The comparison includes a majority-class predictor and a classifier supplied with randomly set encodings. It also includes encodings learned through additive attention conditioning and through all four CHIM placements. Accuracy intervals come from running the category system 10 times. The chart shows the central test accuracy values for the Amazon transfer task.

Product category test accuracy with different reviewer and product encodings on Amazon

The most accurate category classifier uses encodings learned through CHIM at the sentiment encoder.

Product category test accuracy with different reviewer and product encodings on AmazonMajority class: 60.12Majority class60.12Random encodings: 60.67Random encodings60.67Bias attention: 58.74Bias attention58.74CHIM attention: 60.95CHIM attention60.95CHIM classifier: 61.83CHIM classifier61.83CHIM embedding: 62.26CHIM embedding62.26CHIM encoder (this paper): 64.62CHIM encoder (this paper)64.62
The numbers
System or settingaccuracy %
Majority class60.12
Random encodings60.67
Bias attention58.74
CHIM attention60.95
CHIM classifier61.83
CHIM embedding62.26
CHIM encoder (this paper)64.62

For Amazon product category test accuracy, the paper gives 60.67 ± 0.27 for random encodings and 58.74 ± 0.49 for encodings learned through additive attention bias. The CHIM values are 60.95 ± 0.15 for attention, 61.83 ± 0.43 for the classifier, 62.26 ± 0.22 for embedding, and 64.62 ± 0.34 for the encoder. The encoder leads this comparison even though embedding is the best placement when the task is exact rating prediction on the main review benchmarks. How an identity vector helps the sentiment classifier and how easily a downstream classifier reads category information from it are separate empirical questions.

Headline generation uses an LSTM decoder with the fixed reviewer and product encodings as its source of information about the example. The system predicts headline text, and the evaluation uses perplexity. A lower perplexity corresponds to higher probability assigned to the observed text under the decoder’s scoring procedure. This is an evaluation of Text generation.

On the Amazon headline test task, CHIM-encoder is best at 42.65 perplexity. The classifier placement gives 42.69, embedding gives 42.71, and attention gives 42.78. Random encodings yield 43.53, and bias-attention encodings yield 44.00. The paper describes the decrease from the random baseline to the best transfer result as 0.88 points. It treats that change cautiously. The perplexity results show that the choice of sentiment training method affects prediction of held-out headlines under this setup. Coherence and the match between a generated headline and the content of its review are separate questions.

What the ablations show

Representation and placement in the smaller classifier

The preliminary study compares approaches on the same simpler classifier, using the development portions of the sentiment datasets. The dimensions in this comparison are 64. The standard bias approach is included at attention. The full-matrix approach and CHIM are each tested at the embedding, encoder, attention, and classifier stages. This design gives the paper a comparison against the established practice and a way to compare placements under the same matrix-based method.

The additive attention baseline does poorly relative to the stronger alternatives. Generating a full matrix can improve on it when the destination is attention or the classifier. The full-matrix versions fare especially poorly when they generate the weights for the embedding stage or encoder. The authors attribute this pattern to the size of the matrices at those sites. Producing a full set of identity-specific weights is easier to train, on their account, when the transformation to be replaced is smaller.

That result is informative because embedding and encoding are precisely the places where the proposed use of identity appears particularly natural. If the full-matrix result were considered alone, it could suggest that these early stages are poor places to add attributes. CHIM changes that picture: the best development accuracy across the three corpora comes from CHIM at the embedding stage. The evidence points to an interaction between placement and parameterization. The location determines what can be changed, and the representation determines how much the classifier has to learn in order to make the change.

Within CHIM, attention is consistently the weakest single placement in the preliminary development comparison. Here the encoder and word representations follow the ordinary route, and the identity information can adjust only the weighting of their outputs before classification. This fits the paper’s account of why early conditioning might help. The comparison measures outcomes from moving the gate. It leaves the underlying semantic explanation as an interpretation of the pattern.

The principal comparison changes two features when it moves from a generated full matrix to CHIM: it reuses a compact pattern and treats the generated values as importance gates on shared weights. It therefore tests their combined effect. The paper also reports trying residual addition and low-rank adaptation without an improvement in performance. Its residual alternative can be written as follows.

W_adapted = tanh(W′) + W

Here W_adapted is the effective matrix under the residual alternative, W′ is the full-size attribute-dependent matrix to which tanh is applied, and W is the shared layer matrix. The plus sign adds the resulting adjustment to the shared weights. This alternative draws on Deep Residual Learning for Image Recognition.

The paper gives no numeric breakdown for those alternative adaptations. The reported comparison favors the complete CHIM construction in the tested setups and leaves the separate contributions of gate multiplication and chunk sharing unresolved. There is also a narrower asymmetry in the development design. Since the additive bias baseline appears at attention, the experiment directly compares matrix and CHIM placements across the architecture, while evidence about additive bias pertains specifically to its conventional attention use.

When attention is paired with an earlier stage

A separate experiment asks whether conditioning more than one stage helps. The paper uses the smaller classifier and evaluates every pair of distinct CHIM placements on the Yelp 2013 development set. Each pair can be compared with the relevant single-placement scores. This lets the experiment address whether identity information applied twice is complementary, redundant, or difficult to make effective under the same setup.

Adding an encoder or classifier injection to an embedding injection produces a slight drop in accuracy in this comparison. More ways to condition the classifier therefore do not automatically give a better result. A plausible reading is that some of the changes overlap or interact unfavorably, but the experiment records accuracy and does not trace which feature changes explain the drop.

Attention behaves differently in the paired settings. The strongest increases in the pairwise comparison involve attention, and the best pair combines attention with the embedding stage. It improves on embedding alone. This qualifies the recommendation one might take from the single-placement development runs. Changing the weighting of words has limited value when it is the only way the identity information enters this classifier. Once that information has changed the features supplied at the embedding stage, directing the eventual pooling towards particular positions can help.

The result is consistent with the two stages using different information. Embedding changes the features supplied for each word, while attention changes the amount that each contextual representation contributes to the review vector. The paper presents the possibility of complementary information as a direction for further investigation. The evidence for the particular pairing comes from the smaller classifier on one development set.

Reading the transfer comparisons as a test of the encodings

The frozen-vector design controls one source of variation in the transfer results. Both downstream tasks read identity representations produced during rating prediction, and training the downstream systems leaves those representation values fixed. The random baseline asks how well the downstream learner can do with input vectors that carry no learned sentiment-training structure. The majority predictor gives another point of comparison for product category, since category accuracy alone can reward predicting a common label.

Encoder conditioning leads for both downstream tasks. One interpretation is that making the identities useful to contextualization encourages the vectors to preserve information that matters for a broader set of predictions. The category result establishes that a downstream classifier can use the encodings under these conditions. The headline result adds evidence from another objective, with a smaller gain according to the paper’s own assessment. These comparisons do not reveal which dimensions carry category cues or whether the category signal comes primarily from the reviewer vector, the product vector, or their combination.

The transfer outcomes also help interpret the difference between the two matrix placements that work best for exact rating prediction and transfer, respectively. The sentiment classifier can arrive at a useful rating by taking advantage of a reviewer vector at a particular stage. A downstream classifier sees that vector outside the architecture that originally gave it a purpose. Its success depends on which information remains accessible to the downstream operation. Moving the injection point changes both how the sentiment classifier uses the vector and how sentiment supervision shapes it.

Limitations

Limits stated by the paper

The paper treats the best injection location as dependent on the outcome being measured. Embedding has the strongest exact rating accuracy in the test comparison, the classifier gives the strongest Yelp results in RMSE, and the encoder supplies the most useful encodings for the two downstream tasks. The paper’s advice to compare placements follows from this variation. Its development experiment with pairs also leaves open why one pair works better than others and how much of the result comes from complementary information.

The scope of the attributes is constrained by what the rating benchmarks include. The paper describes prior uses of attributes such as time, location, topics, and aspects, and argues that the same mechanism could accept them where available. Its experiments establish results for reviewer and product identities. The benchmarks used for the comparison lack the additional attributes needed for an empirical extension of that claim.

The paper treats headline generation as the weaker transfer result. A reviewer vector might encode preferences and a product vector might carry information about the item, yet a headline ordinarily reflects what was said in a particular review. The decoder receives just the two identity vectors, so the input places a strong limit on the information available about the specific text. The authors compare this setup with earlier generation work that used additional information, including sentiment, learned aspects, or a short version of the text. They also acknowledge that the observed perplexity gain may be too small to count as significant.

The authors suggest that CHIM could coexist with more elaborate text architectures and with methods that address cold-start cases. The classifiers in the comparison illustrate that these are separate design choices. The paper’s reported results come from its simple architecture and chosen metadata intervention. Gains from combining CHIM with those extensions remain an expectation.

Limits visible in the evaluation

The sentiment datasets deliberately retain reviewer and product identities with substantial histories. That is a suitable setting for testing whether learned identity vectors can improve reading of a review. It leaves performance on a new reviewer or product open. The transfer split gives a different kind of separation. It excludes shared reviewer and product IDs across the downstream splits, while making encodings learned during the sentiment stage available as inputs. The result shows reuse of existing encodings under downstream separation, and a true cold-start scenario would require a way of obtaining useful encodings without that history.

The baseline comparison tests practical benchmark performance across different systems. It does not isolate the causal effect of CHIM from all other differences between those systems. Published baselines vary in architecture, the treatment of word and sentence structure, how they use related documents, and whether they incorporate external features. The smaller development experiment holds the architecture fixed more closely, so it gives cleaner evidence about representation and placement. Its results apply to that particular scale and development setup. The reported advantage of joint embedding and attention conditioning has the narrower scope of the Yelp 2013 development comparison.

The single-placement findings also need to be tied to the stated metric and split. Attention ranks last among CHIM placements in the smaller development runs and in the Amazon transfer comparisons. The test results contain exceptions to a universal ordering. On Yelp 2014 test accuracy, attention exceeds the encoder. On IMDB test RMSE, the encoder has a higher error than attention. The evidence supports a recurring weakness of attention as the only injection site in these experiments, with its relative place dependent on the score and dataset. Its strong showing when paired with embedding gives direct evidence that its usefulness can also depend on what another stage is doing.

The paper’s examples show how the architecture could learn that sweetness carries different implications for cakes and drinks. The experiments assess ratings and transfer performance in aggregate. They give neither controlled evidence that particular preferences were recovered nor an explanation of the role played by individual gates. Several kinds of regularity can improve rating prediction, including who tends to rate generously, which products tend to receive favorable reviews, and what words occur in those reviews. The setup leaves the relative importance of those explanations open. A separate reviewer-only and product-only comparison would be needed to assign the transfer gains between the two attribute sources.

The uncertainty reported for category accuracy comes from repeated runs, but the paper gives no fuller definition of those intervals. The headline comparison reports perplexity values alone. On the evidence reported, the category result supports a descriptive comparison of the tested encodings, while the headline result supports the narrower claim of improved probability assignment on the task. Evidence about the quality of particular generated headlines would require a different evaluation.

Finally, the compact gate construction limits the adjustments the method can express. Repeated entries of the gate matrix change together, and the gate attenuates the shared connection it multiplies. The system gains a less costly way to condition a large matrix by accepting that structure. The paper’s comparison favors the construction in its tested settings. It leaves open how sensitive the result is to the chunk layout, whether a different degree of sharing would work better elsewhere, and which aspects of the improvement arise from sharing gates or from retaining a common weight matrix.

What came after

The later study Attribute Injection for Pretrained Language Models: A New Benchmark and an Efficient Method (2022) takes the attribute-injection question into a pretrained setting and introduces a benchmark and a method for that setting. The continuity is in the design problem. The earlier study asks how an existing text-processing architecture should receive information about reviewers and products, and varies the form and location of the intervention. The later study makes attribute injection itself a research question for a system whose text-processing parameters have already undergone pretraining. Its stated benchmark and efficiency focus extend the question of how to evaluate and implement that intervention. Attribute Injection for Pretrained Language Models

Cite

Cite as Reinald Kim Amplayo. 2019. Rethinking Attribute Representation and Injection for Sentiment Classification. Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP).

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

@inproceedings{kim2019rethinking,
  title = {{Rethinking Attribute Representation and Injection for Sentiment Classification}},
  author = {Reinald Kim Amplayo},
  booktitle = {Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP)},
  year = {2019},
  doi = {10.18653/v1/d19-1562},
  url = {https://doi.org/10.18653/v1/d19-1562}
}

↑ back to top

This page in Markdown https://md.research.elamur.ai/free/en/papers/amplayo-2019-rethinking-attribute-representation-injection-sentiment/