Elamur Research

Increasing Learning Efficiency of Self-Attention Networks through Direct Position Interactions, Learnable Temperature, and Convoluted Attention

Paper · 2020 · Philipp Dufter, Martin Schmitt and Hinrich Schütze

Summary

Self-attention lets a word draw information from anywhere in a sentence. That freedom comes with a learning problem. The mechanism needs a way to tell where words occur, and it has to learn which parts of the sentence matter for the decision at hand. Philipp Dufter, Martin Schmitt, and Hinrich Schütze ask whether small changes to the way attention assigns and uses its scores can help a network reach useful accuracy earlier in training. They test the changes on part-of-speech tagging, where the network assigns a grammatical category to each word and context can resolve ambiguities or help with unfamiliar words.

The authors intervene at different points in an attention head. Direct position interactions give pairs of positions their own learned scores. A score can belong to a particular pair of sentence slots, or it can be shared by pairs at the same signed distance. Learnable temperature gives the head a way to adjust the scale of its attention scores through trainable multipliers. Convoluted attention acts after the usual scores have been converted to weights. It learns to change a weight in light of its neighbors in the attention matrix, so a pattern across several entries can influence how much context the head passes along.

The changes produce different results. On the Penn Treebank, combining absolute and relative position scores gives test accuracy of 96.88%, close to 96.82% with added position embeddings. Relative scores alone use considerably fewer parameters and give lower accuracy than the combined setting. Learnable temperature makes little visible difference to training progress, although it raises accuracy on words outside the tagger's vocabulary slightly. The convolution variants improve development accuracy earlier in training. The authors describe their curves as appearing to settle after 5 epochs, with the compared settings reaching similar performance after more than 10 epochs.

Convolution also gives the strongest aggregate tagging results across the selected Universal Dependencies treebanks. The version that processes neighborhoods in both directions of the attention matrix reaches 94.40% macro-average accuracy across all test words, compared with 92.40% for the additive position baseline. The experiments establish a practical alternative to position embeddings and show that processing the attention matrix can improve tagging. The evidence for faster learning is clearest on the Penn Treebank development curves. Whether the same changes help on other tasks, in other architectures, or under a measured compute budget remains open.

Deep dive: Increasing Learning Efficiency of Self-Attention Networks through Direct Position Interactions, Learnable Temperature, and Convoluted Attention

Direct position scores and convolution change how self-attention learns to tag words, with faster progress on the Penn Treebank. · about 35 minutes to read

The problem and its context

Giving attention access to word order

Part-of-speech tagging asks for a prediction at every word. Some words have a familiar grammatical role, while others can take different roles depending on how they are used. A tagger can draw on the identity and spelling of a word, but the useful evidence can also lie in surrounding words. An unfamiliar word may look like a known class of words without providing enough information by itself. An ambiguous word presents a different difficulty. Even a well-learned representation of its identity can be compatible with several tags. In both cases, the network must make information from the rest of the sentence available to the prediction for the current word.

For each word, self-attention constructs a weighted combination of information from the input sequence. The operation has no built-in preference for a word that comes earlier, later, or a particular distance away. If the word representations move to new slots and carry no position information, their pairwise comparisons move with them. The output follows the same rearrangement. A tagged sequence still has an output at every slot, but the attention computation itself has no way to recognize that a word moved from one side of another word to the other. The paper describes this issue as invariance to reordering. At the level of the sequence of outputs, the important detail is that the outputs reorder along with the inputs.

That property accompanies a useful feature. Information can pass directly between distant positions through an attention head. The paper contrasts this ability with recurrence, where sequence processing builds a sequential bias into the architecture. A head can compare its current word with a distant word in the same attention operation it uses to compare adjacent words. The challenge is to supply enough structure for the network to make good use of those comparisons while preserving access to distant context. This issue also matters beyond tagging because self-attention is central to the Transformer architecture discussed in the paper. Attention Is All You Need

Earlier work supplied ordering information through position embeddings. An embedding represents a position as a vector. It can be added to the representation of the word at that position, or attached alongside it by concatenation. The attention head then receives an input that depends on both the word and its slot. The paper notes that the original Transformer work considered sinusoidal and learned position embeddings. It also discusses earlier relative position representations and directional self-attention, which provide other ways of making order or direction available to the network. Self-Attention with Relative Position Representations, DiSAN

Dufter and colleagues focus on the route from an embedding to the score between positions. With additive embeddings, the head projects the combined word and position vectors before comparing them. The resulting score mixes several kinds of interaction. It depends on the words, on the positions, and on how a word at one end of the comparison interacts with a position at the other. This gives the network ways to use both sources of information. It also means that a consistent preference for a pair of positions is expressed through the vectors and projections whose products give rise to that preference. The authors ask whether a trainable entry for the pair can supply the positional contribution more directly.

Changing the distribution and processing its patterns

The second problem concerns the distribution of attention over the sentence. The authors consider the possibility that the softmax operation makes some distributions sharply concentrated. If a head assigns most of its weight to a small part of the sentence, information elsewhere contributes little to that head's output. Concentration can be useful when the evidence is specific. It can also be a poor fit if the decision depends on several words. The paper asks whether giving the head an explicit way to learn the scale of its scores can help it use a broader context when that helps the tagging objective.

The paper places this idea near work on normalization and on adaptive attention temperature. The relationship to normalization is through the treatment of scale. The authors' multipliers are learned alongside the ordinary weights, with no normalization of those weights as part of the proposed operation. The adaptive temperature work the paper discusses uses activations from a preceding timestep to set the temperature at the current one. Here the scale parameters belong to the head and are shared across its uses. That design makes it possible to test a small architectural change without introducing a separate procedure to predict a temperature for every word. Layer Normalization, Weight Normalization

The third problem starts from observations of structure in attention matrices. Put the positions that seek information down the rows and the positions that supply information across the columns. Repeated attention to a neighbor, for instance, can then appear as a band. A pattern can also occupy a small region of the matrix when nearby positions show related behavior. The paper refers to attention analyses that found regular patterns and asks whether the network can use the patterns while computing its output. With convolution, a learned filter can detect a local arrangement of weights and alter the contribution of the positions involved. Revealing the Dark Secrets of BERT

The paper also describes earlier architectures that used both convolution and attention. That combination leaves a choice about which object a filter processes. A convolution applied to word representations pools local evidence before or alongside attention. Applying it to attention weights gives the filter a different input. Its entries already describe relationships between positions. The authors place their proposed operation on that matrix and train it through the tagging objective. Their account of prior work identifies this placement as the distinctive choice. QANet

What faster learning means here

The study is motivated by the data and computation needed to train self-attention networks, including the networks used in language pretraining. The experiments narrow that motivation to an observable question. How high is tagging accuracy after a given amount of progress through training? A modification can matter if it gives a better prediction at an earlier update, even if a conventional head eventually catches up. Conversely, an improvement on the final test set does not show when during training the advantage appeared.

Tagging gives the authors a way to examine the question at different levels. Overall accuracy shows how frequently a word receives the correct tag. Accuracy on vocabulary misses and ambiguous items focuses on cases where a prediction based on word identity alone is less reliable. Those groups make context use a plausible reason to study the architecture. The evidence still comes from prediction accuracy. A correct ambiguous-word tag gives the network credit for the outcome while leaving open which cues produced it. The separation between the overall score and these groups becomes important when comparing a change that helps mainly on difficult words with one that moves the aggregate result.

The method, step by step

From a sentence to a tag at each position

The starting point is a tagger that reads a sentence as a sequence of words. Each word supplies information through its entry in a word vocabulary and through its characters. Where the experiment uses position embeddings, the word lookup is also combined with a vector for the slot in which the word appears. The concatenation baseline puts the position and word vectors side by side. The addition baseline combines corresponding components into one vector. Both forms give the network access to word order before the first attention layer.

The character representation is separate from the word lookup. The network embeds the characters of a word and processes the resulting sequence with a convolutional network. Max pooling retains the strongest response of each feature across the character sequence. The resulting vector joins the word-level input. Accordingly, a word outside the network's vocabulary still has a route to the tag prediction through its spelling. That route is already present in the baseline. When the paper tests convolution on attention, it adds a different operation at a later point, after the network has computed weights between sentence positions.

Multi-head self-attention processes the input representations through successive layers. A head produces an updated vector at each position by drawing on the input vectors at positions it attends to. Different heads have separate projections and can assign different weights to the same sentence. The layer concatenates their outputs. The architecture applies dropout and includes residual connections around the attention layers, as well as a connection spanning the network. A residual connection carries an earlier representation forward so that information can reach a later stage alongside the result of the intervening computation.

The final softmax produces a distribution over grammatical tags for each word. This is a separate softmax from the one inside each attention head. The attention softmax distributes weight across sentence positions. The output softmax allocates probability across tags for a particular position. The authors train with categorical cross-entropy, which penalizes the tagger when it assigns low probability to the recorded tag. Attention scores, positional entries, scale multipliers, and attention filters receive their training signal through this prediction objective.

How the tagger produces a prediction at each word

The steps in order.

How the tagger produces a prediction at each wordStep 1: Look up word and character embeddings1. Look up word and character embeddingsStep 2: Convolve character features and apply max pooling2. Convolve character features and apply max poolingStep 3: Combine word, character, and optional position vectors3. Combine word, character, and optional position vectorsStep 4: Project inputs into queries, keys, and values4. Project inputs into queries, keys, and valuesStep 5: Compute attention weights with the chosen modification5. Compute attention weights with the chosen modificationStep 6: Aggregate values and concatenate head outputs6. Aggregate values and concatenate head outputsStep 7: Pass representations through the attention stack7. Pass representations through the attention stackStep 8: Predict a grammatical tag for each word8. Predict a grammatical tag for each word

What an ordinary attention head computes

It helps to follow a single row of the attention matrix. The row belongs to the position being updated. Its scores compare a query from that position against a key from each position in the sentence. The query represents what the projected input can seek, and a key represents what the projected input can be matched on. A third projection supplies the values. The scores decide how strongly the value at each position contributes to the result. Separating the key from the value allows the information used to identify a relevant word to differ from the information the word ultimately contributes.

The paper describes a head as a mapping between matrices whose rows correspond to sentence positions.

att ∶ ℝ^(t×d) → ℝ^(t×dₕ)

Here att denotes the attention head and ℝ denotes real numbers. The expression ℝ^(t×d) is the space of real matrices with t rows and d columns. The length of the input sequence is t, and its representation width is d. The width of each output vector is dₕ, with the subscript ₕ indicating the head dimension. The multiplication symbol within each shape separates the row and column counts. The arrow shows that the head maps an input matrix to an output matrix, keeping one row per sentence position.

The head first forms a square matrix of scaled dot products.

A = (dₕ)⁻¹ᐟ² X Wᵠ (X Wᵏ)ᵀ

A is the matrix of attention scores. X contains the input representations, with one row per position. Wᵠ and Wᵏ are trainable projection matrices for queries and keys, respectively. Their input width is d and their output width is dₕ. The superscripts ᵠ and ᵏ label the projections. The transpose ᵀ exchanges the rows and columns of the projected keys. This lines up each projected query with each projected key when the matrices are multiplied. The power ⁻¹ᐟ² scales the dot products by the inverse square root of the head dimension dₕ. Juxtaposition denotes matrix multiplication, with the leading scalar multiplying the entries of the result.

A dot product provides a score for a query and a key taken together. At this stage the entries of a row have no probability interpretation. The head applies softmax along the row. This converts the scores into non-negative weights with a fixed total, increasing a position's share when its score is large relative to the other entries in the row. The same operation is performed for each query independently. A large weight then gives the corresponding value a larger contribution to the returned representation.

Z ≔ att(X) = σ(A) X Wᵛ

Z is the output of the head, and ≔ introduces its definition. att(X) is the head applied to the input matrix X. The function σ is row-wise softmax, and A is the scaled score matrix to which it is applied. Wᵛ is the trainable projection that produces the value vectors, with superscript ᵛ identifying the value projection. The product X Wᵛ contains those vectors. Multiplying it by σ(A) gives a weighted sum for each query row. The output width is therefore the width of the value vectors.

This layout gives the proposed changes distinct places to act. A positional contribution can be added to A before softmax tells the head how to distribute its weight. A scalar multiplier can change the spacing between score values, affecting how concentrated the resulting weights are. Convolution can process the weights after the head has assigned them, but before they are multiplied by the projected values. Each route can affect the final weighted sum, and each requires a different comparison to explain its effect.

Giving pairs of positions their own scores

Consider what happens in the additive position baseline. The input for a word includes the vector for its position. Both the query projection and the key projection receive a sum of the two sources. When their product is expanded, there is a content contribution, a position contribution, and mixed contributions. The authors use that expansion to identify which part of the score can be represented as a table of learned positional interactions. With the common scale factored out, their decomposition is as follows.

A_PE[add] ∼ X Wᵠ (Wᵏ)ᵀ Xᵀ + P Wᵠ (Wᵏ)ᵀ Xᵀ + X Wᵠ (Wᵏ)ᵀ Pᵀ + P Wᵠ (Wᵏ)ᵀ Pᵀ

A_PE[add] is the first-layer score matrix in the additive position-embedding case, with PE[add] identifying that setting. ∼ indicates that the expression is written up to the shared attention scaling factor. X is the input representation before the positional addition in this decomposition. P is the matrix of position embeddings, with a vector at each of the t positions and width d so it can be added to X. Wᵠ and Wᵏ are the query and key projections. ᵀ transposes the matrix to which it is attached, juxtaposition denotes matrix multiplication, and + adds the resulting term matrices.

The first term compares content with content. The final term depends on positions at both ends of a comparison. The middle terms mix the content at one end with the position at the other. What the paper calls direct position interactions keeps a content score and supplies the positional contribution through learned scalars. The mixed terms from adding position embeddings are omitted. Because the position contribution appears as an addition to the score, its effect is to alter the relative standing of keys for a given query before the row is turned into weights.

The absolute version, SAN+P, gives every ordered position pair a trainable entry in a square matrix. An entry belongs to a query slot and a key slot, regardless of which words occupy those slots. The entry for that query and key order has its own parameter. It can therefore express preferences specific to a part of the sentence, such as a recurring relationship involving a slot near its beginning. These learned scores are added to the content-based comparisons. A positional preference can encourage a particular comparison while leaving the word content free to supply evidence in the other direction.

Absolute entries give the network flexibility at the cost of sharing. Two ordered pairs can have the same distance and still use separate parameters. The relative version, SAN+R, ties those cases together. Its parameters are stored in a vector indexed by signed offset. Moving the same query–key relationship along the sentence then selects the same parameter, as long as the relative distance and direction match. Direction matters because a key to the left of the query and a key to the right of it have opposite signed offsets.

Aʳᵢⱼ = aʳ[i − j + t]

Aʳᵢⱼ is the entry in row i and column j of the relative positional score matrix Aʳ. The index i marks the query position and j marks the key position. aʳ is the learned relative-score vector, with length 2t in the paper's notation. The bracketed expression selects an entry of that vector. Subtracting j from i gives the signed offset, and adding the sequence length t shifts the offset into the vector's indexing range. The superscript ʳ marks relative position in both the vector and the matrix.

The absolute and relative versions can also be used together. The absolute entry can express a preference particular to the pair of slots, and the relative entry can express a preference shared over pairs with the same offset. A head using both receives their sum alongside its content score.

Aᴾ⁺ᴿ = A + Aᵖ + Aʳ

Aᴾ⁺ᴿ is the score matrix for the combined SAN+P+R setting. A is the ordinary content-based score matrix, Aᵖ contains learned absolute position interactions, and Aʳ contains the relative position interactions generated from the offset vector. Each matrix has a row for every query position and a column for every key position. The plus signs denote entrywise addition of the matrices. Superscript ᵖ marks the absolute-position contribution, and superscript ʳ marks the relative one.

The paper adds these matrices in the first attention layer, where they take the place of the input position embeddings used in the baseline. Each head there has its own positional parameters. The effect of placing the scores in that layer is that position can influence the representations passed through the stack without a separate positional table in every layer. The direct entries are also specific to the attention scoring operation. In the baseline, the input embedding carries position as part of the representation from which the attention projections are made.

The paper gives a condition for when the absolute-position table uses fewer parameters than the additive position embedding table.

t² × n_heads < t × d

t denotes sequence length, n_heads is the number of attention heads with their own absolute tables, and d is the width of a position embedding in the additive baseline. The left side counts one square table for each of those heads, with t² entries in each table. The right side counts t position vectors of width d. The multiplication sign indicates a product and < denotes a strict inequality. The comparison depends on the sequence length and the embedding width. The paper's separate parameter count for relative positions reflects the sharing of a scalar across slots with the same offset.

Learning how strongly a head responds to score differences

Softmax reacts to the scale of its inputs. If a set of scores has a small spread, their weights can remain relatively close together. If the spread becomes large and some scores lead the rest, the leading scores can dominate their row. The authors hypothesize that a learned scale can help a head use context more effectively. They introduce scalars on the attention projections, so training can change the overall scale as well as the individual entries in the projection matrices.

Wⁱ → γⁱ Wⁱ,  i ∈ {k, v, q}

Wⁱ is one of the trainable projection matrices, and γⁱ is its learned scalar multiplier. The index i ranges over the set identified by k for keys, v for values, and q for queries. The membership symbol ∈ expresses that choice of index. The arrow indicates replacement of the projection matrix by the scaled version when the attention computation uses it. Juxtaposition on the right means scalar multiplication.

The query and key multipliers enter the score through a dot product, so their product determines how the additional scaling acts on the scores. The paper calls this a learnable temperature because it changes how softmax responds to score differences. A positive scale can adjust concentration while preserving which score is larger. The value multiplier acts at a different stage. It rescales what the head aggregates after the attention weights have been determined. The variant called SAN+PE[add]+Temp includes all of these multipliers, so its evaluation tests the package of changes rather than isolating query–key scaling from value scaling.

The distinction also matters for understanding the hypothesis. The trainable scalars have a direct relation to the head's output, but the tagging loss supplies the criterion for their values. Training has no separate target distribution for attention. The network can benefit from a spread that helps prediction, or it can retain behavior much like the baseline if changing the scale contributes little. The projections themselves are trainable, so a head already has ways to alter the magnitude of its scores. Explicit scalars provide a separate parameter through which training can make that adjustment.

Convolving the attention weights

In the ordinary computation, each attention weight goes directly into the weighted sum of values after softmax. In convoluted attention, the normalized matrix passes through a learned filter first. Convolution applies a local operation repeatedly over its input. A filter can thus respond to a pattern of neighboring entries wherever that pattern falls within the part of the matrix it processes. The important choice is the input to the filter. Its neighbors are attention weights between positions, giving the filter access to the structure of the row or region rather than to raw word features.

The authors illustrate the idea with a short sequence in which the first and last words draw high attention while the middle word draws little. If that pattern regularly leaves out a useful word, a filter can learn to increase the middle weight in response to its neighbors. The filter can also weaken a pattern if doing so helps prediction. The example explains the flexibility of the operation. The training objective still selects the filter by its effect on the predicted tag, and the paper uses the example to motivate what the filter could learn.

A′ = conv(σ(A))

A′ is the processed attention matrix, with the prime marking the result of convolution. conv is the learned convolution, σ applies softmax along each attention row, and A is the matrix of scores before that normalization. The parentheses indicate that conv receives the output of σ(A). The processed matrix is then used to combine the projected values. Its rows need not retain the fixed total imposed by the softmax, so the resulting coefficients can change the size of the aggregate as well as the shares contributed by different positions.

The one-dimensional version, SAN+PE[add]+Conv, uses a filter for each row in a head's attention matrix. The paper specifies t filters per head to preserve the shape for a sequence length t. The filter width is 3. A filter examines a segment along a row, where the query stays fixed and the key changes across neighboring sentence positions. The separate filters allow the operation to differ from row to row.

SAN+PE[add]+Conv2d uses a two-dimensional convolution. Its filter can see neighboring entries along both matrix axes. A local region therefore includes nearby key positions and nearby query positions. The authors use one filter per head with width 3. The paper interprets the operation as a form of smoothing that can make use of local attention patterns. The coefficients are learned, so the smoothing interpretation describes the locality and potential behavior while leaving the direction of individual weight changes to training.

The authors also tried placing convolution before softmax and report worse results from that order. In that arrangement, the filtered scores would still compete in a softmax row. In the chosen arrangement, the filter receives weights that already reflect each row's competition, and its output goes into value aggregation. The two placements thus change both what the filter sees and how its result is used. The paper retains the post-softmax placement in the reported convolution variants.

Training the tagger and varying the attention operation

The architecture uses 4 self-attention layers with 4 heads per layer. Its character CNN has 3 layers, a filter width of 3, and 64 filters. The maximum sentence sequence length is 60 and the maximum character sequence length is 20. The authors use ReLU activations, a dropout rate of 0.1, and RMSprop with the default settings of the implementation named in the paper. Early stopping uses a patience of 3 epochs. They describe the settings as conventional choices and leave performance-oriented hyper-parameter tuning outside the experiment.

For the Penn Treebank runs, the word vocabulary is limited to 20,000 entries. The authors initialize the word representations from pretrained fastText sub-word vectors and keep the pretrained word embeddings fixed. For the Universal Dependencies runs, the vocabulary setting is 50% of unique words, and the word embeddings are trained without pretrained initialization. That difference is part of the training setup for the respective benchmarks. It gives the score comparisons within each benchmark a common embedding procedure while making the comparison between benchmarks a comparison of more than datasets alone. Enriching Word Vectors with Subword Information

The baseline called SAN uses attention without position embeddings. SAN+PE[con] uses concatenated position embeddings. SAN+PE[add] uses additive position embeddings and is the main reference for the modifications. The direct-position variants replace those embeddings. The temperature and convolution variants keep additive embeddings and change the corresponding part of the head. This design helps trace differences to the part of the tagger being varied. It also means the study does not test a single combined tagger containing the absolute and relative tables, learned temperature, and convolution together. The authors make the implementation available as convatt.

Experiments and results

Reading the accuracy measurements

The English experiment draws on the Penn Treebank’s Wall Street Journal section. The training sections are 0-18, the development sections are 19-21, and the test sections are 22-24. Training fits the parameters. The development split supplies the accuracy curves used to examine learning progress, and the test split supplies the final tagging comparisons. The paper reports means and standard deviations from three random seeds. A score such as an overall test mean represents a different measurement from the accuracy at a particular point on the development curve.

The paper reports word-level accuracy for all positions, for out-of-vocabulary words, and for ambiguous words. The out-of-vocabulary group examines words outside the vocabulary available to the tagger. The character representation still supplies evidence for such an item. The ambiguous group is defined from the training annotations. A word belongs to it if it receives more than one distinct tag in the training data. Its accuracy measures how frequently the network chooses the recorded tag on the evaluated occurrences of such words.

These slices answer related questions. A change can produce only a small movement over all words and still have a visible effect on a harder group. Accuracy on an unfamiliar word can reflect its spelling, contextual cues, or their interaction. Accuracy on an ambiguous word can reflect a preference for a common tag, local grammatical cues, or a more distant dependency. The slices describe which predictions improve. The training and evaluation procedure does not assign individual improvements to particular features or attention heads.

The second benchmark uses version 2. Version 2 of Universal Dependencies in the form used for the CoNLL 2018 shared task. The authors select treebanks with training, development, and test splits for which the Smith and colleagues comparison reports a result. The selection yields 47 treebanks. The aggregate score is a macro mean across treebanks, so a large treebank does not dominate it by contributing more test words. The paper also reports the average of the standard deviations for the treebanks. That statistic describes the reported run variation at the treebank level in aggregate, while the disaggregated test scores show how performance varies across corpora. CoNLL 2018 Shared Task

Penn Treebank test accuracy over all words

The position-free SAN averages 94.62% across all test words, with a standard deviation of 0.15. Supplying position embeddings moves the mean to 96.81% with concatenation and 96.82% with addition. The corresponding standard deviations are 0.02 and 0.07. The near equality of the embedding baselines makes the addition setting a useful reference for the other interventions. The separation between either embedding baseline and the position-free tagger also shows that position information makes a substantial difference in this architecture.

Direct absolute scores reach 96.84% mean accuracy, with a standard deviation of 0.10. Relative scores alone reach 96.33%, with a standard deviation of 0.09. With both tables, the mean is 96.88% and the standard deviation is 0.05. The absolute and combined settings are close to additive embeddings. The lower score of the relative-only setting accompanies a substantial reduction in its position-specific parameter count. It therefore supplies evidence about a compact design as well as about the effect of using relative position by itself.

Learnable temperature and one-dimensional convolution each reach 96.93% mean accuracy over all Penn Treebank test words. The standard deviation is 0.04 for temperature and 0.07 for that convolution. The two-dimensional convolution reaches 96.88%, with a standard deviation of 0.04. These values show how little separation there is among the best overall end scores on this benchmark. The paper reports the published Meta-Bi-LSTM result of 97.96% as a reference and also names the Tag-Dictionary system in its external comparison. Its architectural experiments focus on differences within the self-attention tagger. Meta-BiLSTM, Bidirectional LSTM-CRF Models for Sequence Tagging

Position representations on the Penn Treebank test set, all-word accuracy

Absolute position scores and the combined scores are close to the embedding baselines.

Position representations on the Penn Treebank test set, all-word accuracySelf-attention without position embeddings: 94.62Self-attention without positionembeddings94.62Concatenated position embeddings: 96.81Concatenated position embeddings96.81Added position embeddings: 96.82Added position embeddings96.82Direct relative position scores: 96.33Direct relative position scores96.33Direct absolute position scores: 96.84Direct absolute position scores96.84Direct absolute and relative position scores (this paper): 96.88Direct absolute and relative positionscores (this paper)96.88
The numbers
System or settingaccuracy %
Self-attention without position embeddings94.62
Concatenated position embeddings96.81
Added position embeddings96.82
Direct relative position scores96.33
Direct absolute position scores96.84
Direct absolute and relative position scores (this paper)96.88

Penn Treebank test accuracy on difficult words

The out-of-vocabulary results expose differences that the overall scores compress. The position-free SAN reaches a mean of 80.37%, with a standard deviation of 0.72. Concatenated embeddings give 85.45%, with a standard deviation of 0.58. Added position embeddings give 85.81%, with a standard deviation of 0.26. The comparisons show that positional information improves tagging even when the word lacks its own vocabulary entry. The character pathway is available throughout these runs, so the change comes from what the tagger can do with the inputs surrounding an unfamiliar word and with its representation at that position.

The combined direct-position setting reaches 85.71% on out-of-vocabulary test words, with a standard deviation of 0.52. Absolute scores alone reach 85.69%, with a standard deviation of 0.41. Relative scores alone give 83.70%, with a standard deviation of 0.85. The ordering is similar to the overall comparison in placing the relative-only setting below the absolute or combined setting. In this slice, the additive baseline has a slightly higher reported mean than either of the settings with absolute direct scores.

Learnable temperature reaches 86.15% on out-of-vocabulary words, with a standard deviation of 0.26. The one-dimensional convolution reaches 86.41%, with a standard deviation of 0.35. The two-dimensional convolution has the highest reported mean in this slice, at 86.48%, with a standard deviation of 0.31. This is one reason the paper describes temperature as having a small possible benefit for unfamiliar words even though the learning curves show little distinction between temperature and the additive baseline. It is also a case where the two-dimensional filter leads the one-dimensional filter in spite of having the lower overall test mean.

Among ambiguous test words, the additive position baseline reaches 95.19%, with a standard deviation of 0.12. The combined direct-position setting reaches 95.33%, with a standard deviation of 0.05. The temperature variant gives 95.37%, with a standard deviation of 0.10, and the one-dimensional convolution gives 95.38%, with a standard deviation of 0.10. The two-dimensional setting gives 95.30%, with a standard deviation of 0.08. The ranking depends on the evaluated group. The stronger unfamiliar-word result for the two-dimensional filter does not carry over to the ambiguous-word group, where the one-dimensional filter gives the highest mean among the proposed variants.

How development accuracy changes during training

The Penn Treebank learning curves provide the direct test of the paper's learning-efficiency question. The plot follows development accuracy over epochs for the additive position baseline, the combined positional tables, and the temperature and convolution variants. The curves for convolution rise more steeply, reaching a region of apparent stability after 5 epochs. The authors describe the compared settings as reaching similar performance after more than 10 epochs. The difference is therefore most visible while the baseline is still improving. By the final test comparison, the overall accuracies are close.

The temperature curve has no visible advantage in the authors' reading of the plot. The combined direct-position setting appears to improve slightly faster than the additive baseline. The authors also include a closer view of the first training steps. It covers around 1 epoch for the Penn Treebank, and convolution shows a somewhat steeper rise during that interval. The longer curve makes the difference easier to see. Taken together, the plots show the early rise and also show what happens as the runs approach similar accuracy.

The paper includes an early-training development plot for Universal Dependencies as well, with accuracy averaged across the evaluated languages. Its closer view likewise shows a somewhat steeper initial rise for convolution. The longer Penn Treebank plot gives the paper its clearest evidence about earlier progress over epochs. For Universal Dependencies, the main quantitative evidence is the final accuracy comparison. These observations refer to accuracy as training proceeds. The paper does not convert an epoch count into elapsed training time.

Universal Dependencies aggregate results

The additive position baseline reaches macro-average accuracy of 92.40% across all test words in the selected treebanks, with an average standard deviation of 0.31. Combined direct position scores give 92.82%, with an average standard deviation of 0.27. Learnable temperature gives 92.49%, with an average standard deviation of 0.24. As on the Penn Treebank, direct scores offer a competitive positional representation and temperature changes the overall result little.

The one-dimensional convolution reaches 94.21%, with an average standard deviation of 0.17. The two-dimensional convolution reaches 94.40%, also with an average standard deviation of 0.17. On this benchmark, the convolution advantage remains visible in final test accuracy. The paper gives the external Uppsala result of 95.62% for comparison across the selected treebanks. The strongest convolution result exceeds the study's additive baseline, while the external system has the highest macro mean of the systems shown. Uppsala multi-treebank system

Attention variants on Universal Dependencies, macro-average all-word test accuracy

Both convolution variants improve on the additive position baseline, with the two-dimensional filter giving the highest mean among the tested variants.

Attention variants on Universal Dependencies, macro-average all-word test accuracyAdded position embeddings: 92.40Added position embeddings92.40Direct absolute and relative position scores: 92.82Direct absolute and relative positionscores92.82Learnable temperature: 92.49Learnable temperature92.49One-dimensional attention convolution: 94.21One-dimensional attention convolution94.21Two-dimensional attention convolution (this paper): 94.40Two-dimensional attention convolution(this paper)94.40Uppsala reference system: 95.62Uppsala reference system95.62
The numbers
System or settingaccuracy %
Added position embeddings92.40
Direct absolute and relative position scores92.82
Learnable temperature92.49
One-dimensional attention convolution94.21
Two-dimensional attention convolution (this paper)94.40
Uppsala reference system95.62

The out-of-vocabulary macro mean rises from 77.89% with additive position embeddings to 82.40% with one-dimensional convolution and 82.87% with two-dimensional convolution. Their respective average standard deviations are 1.10, 0.65, and 0.69. Combined direct position interactions reach 78.77%, with an average standard deviation of 0.97. Temperature reaches 78.33%, with an average standard deviation of 1.01. The convolution variants' advantage is therefore visible in the difficult vocabulary slice as well as in the all-word aggregate.

The ambiguous-word macro mean is 88.85% with the additive baseline and 89.44% with combined direct positions. Their average standard deviations are 0.35 and 0.39. Learnable temperature gives 88.85%, with an average standard deviation of 0.34. The one-dimensional convolution gives 92.20%, with an average standard deviation of 0.26, and the two-dimensional version gives 92.47%, with an average standard deviation of 0.29. The stronger convolution result on Universal Dependencies extends to both slices. For temperature, the ambiguous-word mean is identical to the additive baseline's reported mean.

Differences between treebanks

The paper also gives all-word accuracy for each treebank. On the Afrikaans AfriBooms test set, additive position embeddings give 92.11%, one-dimensional convolution gives 94.50%, and two-dimensional convolution gives 94.75%. On the French Spoken test set, the corresponding values are 86.50%, 91.17%, and 92.20%. These are examples of the convolution improvements behind the aggregate. They also show that the different corpora can have different starting accuracies and different responses to the same architectural change.

The two Ancient Greek treebanks illustrate why the aggregate should be read alongside the individual outcomes. For Ancient Greek PROIEL, the additive baseline gives 94.79% all-word test accuracy, and the two-dimensional convolution gives 95.99%. For Ancient Greek Perseus, the same comparison is 89.50% against 89.11%. Even treebanks grouped under the same language name can therefore give different outcomes. The table establishes these differences at the corpus level. It does not identify which properties of a corpus make attention convolution helpful.

The external reference also varies by treebank. On Arabic PADT, the two-dimensional convolution gives 95.36% all-word test accuracy, while the Uppsala reference gives 90.70%. On Czech CAC, those scores are 98.25% and 99.17%, respectively. The overall external reference is higher on the macro average, and the individual results give a more detailed picture of how that comparison changes across test sets. The paper uses the reference to situate the tagger's accuracy. Its main controlled comparisons are between the attention variants that share the same tagging architecture.

What the ablations show

Positional information matters more than the choice of embedding operation

The position-free, concatenation, and addition baselines give the cleanest view of whether the tagger benefits from a positional signal. The word and character representations already supply evidence for the tag. Adding a way to identify order raises accuracy over all words and in both difficult slices. Concatenation and addition produce very similar all-word means. For the settings tested, getting the positional signal into the network matters more than choosing between those two embedding operations.

The direct-position comparisons ask whether the same task can be handled without a conventional embedding input. The absolute table by itself gives an overall result close to the added embeddings. The combined table does too. The relative-only design shares more information across positions and gives lower Penn Treebank accuracy, including on the two difficult groups. These relationships support the feasibility of direct scoring. They also put a boundary around a stronger claim that would treat any direct positional representation as interchangeable with the embedding baseline.

Comparing the absolute and combined settings isolates the addition of the relative table when the absolute scores are already available. On Penn Treebank test words overall, the reported means are 96.84% and 96.88%, respectively. The authors regard the combination as offering little practical advantage over the absolute table on that benchmark. Having both terms lets the network express slot-specific and offset-specific preferences. The comparison measures how much that extra distinction helps in this tagger. The Universal Dependencies experiment evaluates the combination against the additive baseline and lacks the separate absolute-only and relative-only rows needed to repeat the same comparison there.

The parameter counts explain why the relative-only result is of interest in spite of its lower accuracy. The base Penn Treebank SAN has 7,691,823 parameters. The additive embedding extension contributes 18,000, the direct absolute table contributes 14,400, and the relative table contributes 480. The small relative table is possible because pairs of positions share a scalar when their offsets agree. The experiment shows that this more compact source of order information still gives much of the tagging benefit seen with position embeddings. The overall network size and the separate contribution of the positional mechanism are different scales of comparison.

Learned scaling produces little visible change in training speed

The temperature comparison preserves the additive position baseline and adds 48 parameters in the Penn Treebank count. Its high overall test mean shows that the modification is compatible with the tagger. Its slight improvement on vocabulary misses is visible in the subgroup results. Its learning curve, however, follows the baseline closely enough that the authors report no visible effect on the rate of improvement. The Universal Dependencies macro results likewise give little evidence of a general gain from the added scaling.

This is a test of the implementation chosen in the paper. Query and key scaling can change the softmax's concentration, while the value multiplier scales the information it aggregates. The experiment varies those parameters together. It therefore leaves open how much each multiplier contributed to the results or how much the learned scale actually changed. The authors also report that normalizing the weights harmed performance in their experiments. They give no numerical comparison for that observation, so it supports their choice to use simple multipliers while leaving the size of the difference unmeasured.

Filter placement and shape change the comparison

Placing convolution after softmax gave better results than placing it before softmax in the authors' trials. The account gives the direction of that comparison without reporting scores for the pre-softmax version. It shows that the authors tried both placements and chose the one acting on weights. It leaves separate questions about the cause of the advantage. At the earlier location a filter sees raw scores and its output is normalized. At the later location it sees normalized weights and the filtered outputs are passed to value aggregation. The comparison changes both properties at once.

The one-dimensional and two-dimensional variants provide a reported comparison of filter shapes. The one-dimensional variant has a slight lead on overall Penn Treebank test accuracy, and the two-dimensional variant has the highest out-of-vocabulary mean there. The two-dimensional variant leads on the Universal Dependencies macro metrics. The paper treats the approaches as performing similarly in broad terms. Their parameter counts differ sharply. On the Penn Treebank network, the one-dimensional extension contributes 173,760 parameters while the two-dimensional extension contributes 160. The paper gives 10 additional parameters per head for the two-dimensional design.

The two-dimensional result makes the effect interesting even at that small added parameter count. The improvement can appear with a filter shared over locations in the matrix, without the row-specific filter allocation of the one-dimensional design. The results are consistent with the authors' idea that neighborhoods in attention weights contain exploitable structure. They do not measure which patterns the filters actually reinforce. The learning curves and test results show the consequence of inserting the operations, while a characterization of the learned filters would address the proposed explanation more directly.

Limitations

Limits identified by the authors

The authors describe the paper as a small study confined to part-of-speech tagging. The task was chosen because unfamiliar and ambiguous words make context important, but it remains a task with a supervised grammatical label for each word. The study does not establish that the same changes help with language pretraining or other applications of self-attention. The authors propose experiments on additional tasks and architectures as future work.

They also leave the reason for the larger final convolution gains on Universal Dependencies for future investigation. Both convolution variants improve the aggregate accuracy there, whereas the principal Penn Treebank finding concerns the learning curve and the final accuracies are closer. The authors give a mechanism that could explain why convolution helps, namely the reinforcement or weakening of local patterns in attention. The experiments show how the modified taggers perform. The explanation for why the benchmark-level gains differ remains open.

The authors say they chose standard hyper-parameter settings and left them untuned for performance gains. This defines the scope of the comparison with published taggers. Their study asks what changes when attention is modified inside a simple architecture under the reported settings. The external scores indicate the range of accuracy achieved by other systems. They do not provide a controlled comparison of the architectures or their training procedures.

Limits visible in the setup

Faster improvement over epochs and faster training in elapsed time are distinct measurements. The development plots show when an accuracy advantage appears as the runs progress through training. Convolution adds an operation to the head and may change the cost of a step. Even a small parameter count measures storage for learned weights, while computation also depends on how often a filter is applied and the size of the matrix it processes. Without timing or compute measurements, the early accuracy advantage does not establish a corresponding reduction in training time or resources. The experiments also lack a comparison in which the quantity of training data is varied, so they do not establish how the changes affect data requirements.

The absolute table is evaluated within the chosen sequence-length setting. Its parameters attach to pairs of absolute slots and scale with the size of the table. The relative design shares parameters, which keeps the cost of representing offsets lower in the reported setup. The tagging results show that these alternatives can work with the trained lengths and architecture. They leave open how either approach would behave when asked to handle positions or offsets outside the ranges encountered during training.

The reported standard deviations describe variation across runs. They can provide context when two means are close, but they do not supply a formal test of the difference between methods. Small numerical gaps, such as those between the best overall Penn Treebank scores, should be read as reported means under the experimental setup. The larger separation visible in the Universal Dependencies aggregate is accompanied by varied per-treebank results. The macro mean gives each selected treebank equal influence and does not answer how a different mix of corpora would affect the ranking.

Across benchmarks, more changes than the annotated corpus separate the runs. Pretrained word vectors are used in the Penn Treebank experiments, whereas the Universal Dependencies configuration uses trained embeddings without pretrained initialization. The vocabulary definitions also differ. Those choices do not undermine comparisons that hold the embedding procedure fixed within each benchmark. They do limit a causal explanation that attributes the larger Universal Dependencies gain to the languages or treebanks alone. A study aimed at that explanation would have to distinguish the contributions of the data and training setup.

Finally, the difficult-word accuracies are indirect measures of successful context use. The tagger can exploit characters, word identity where available, position, and neighboring words together. No reported intervention removes or swaps the relevant context at test time to track why particular tags change, and the paper does not connect learned filter responses to individual corrections. The result establishes that the convolution variants improve tagging in the reported comparisons. The examples of pattern reinforcement describe behavior that the architecture permits and that could contribute to the gains.

What came after

The paper documents related developments around the time of its submission. The authors say that they had an early draft in 2019 and identify work that explored similar positional ideas by the time the paper appeared. This establishes that several groups investigated ways of putting position information into attention scores. The paper treats these as related developments and gives no account of a subsequent study extending its tagging experiments.

Raffel and colleagues use scalar values to represent relative position, which Dufter and colleagues describe as similar to SAN+R. The point of contact is the use of a scalar contribution indexed by relative position. Schmitt and colleagues also investigate relative position and apply it to modeling graph structure for text generation from knowledge graphs. The paper identifies this as another exploration of relative position, without making a claim that its tagging evidence transfers to generation. Exploring the Limits of Transfer Learning with a Unified Text-to-Text Transformer

The authors describe Ke and colleagues' TUPE as contemporary work with a similarity to SAN+P. They report that it also found a feasible alternative to conventional position embeddings, with slight performance gains in its own experiments. For convolution on attention weights, the account ends with the tagging results and the authors' plan to test the operation more broadly. It leaves the later empirical record for that specific modification open.

Cite

Cite as Philipp Dufter, Martin Schmitt and Hinrich Schütze. 2020. Increasing Learning Efficiency of Self-Attention Networks through Direct Position Interactions, Learnable Temperature, and Convoluted Attention. Proceedings of the 28th International Conference on Computational Linguistics.

The paper itself, not this page. BibTeX from the library's record of the work. DOI 10.18653/v1/2020.coling-main.324

@inproceedings{dufter2020increasing,
  title = {{Increasing Learning Efficiency of Self-Attention Networks through Direct Position Interactions, Learnable Temperature, and Convoluted Attention}},
  author = {Philipp Dufter, Martin Schmitt and Hinrich Schütze},
  booktitle = {Proceedings of the 28th International Conference on Computational Linguistics},
  year = {2020},
  doi = {10.18653/v1/2020.coling-main.324},
  url = {https://doi.org/10.18653/v1/2020.coling-main.324}
}

↑ back to top

This page in Markdown https://md.research.elamur.ai/free/en/papers/dufter-2020-increasing-learning-efficiency-self-attention/