What Is One Grain of Sand in the Desert? Analyzing Individual Neurons in Deep NLP Models
Paper · 2019 · Fahim Dalvi, Nadir Durrani, Hassan Sajjad et al.
Summary
A translation system can learn something about the grammar of its input without ever receiving a grammar lesson. Researchers can test for that knowledge by asking a separate classifier to recover grammatical labels from the system’s internal activations. But a successful prediction from a whole vector leaves a question unanswered. Does the classifier draw on many dimensions, or can it do much of its work with a few? Dalvi and colleagues bring interpretability down to the level of individual dimensions, which they call neurons. They ask where particular linguistic signals can be read and which dimensions the original network depends on to do its own job.
The authors develop two rankings. Linguistic Correlation Analysis fits a classifier to activations from a trained network, then reads the classifier’s weights to identify dimensions useful for a labeled property. A label can describe a word’s grammatical category, its meaning, or where it occurs in a sentence. Cross-model Correlation Analysis looks for dimensions whose activity follows a similar pattern in independently trained networks. It needs common input words for comparison and can work without linguistic labels. The authors test the rankings on recurrent networks for machine translation and on recurrent language models trained to predict words.
The checks distinguish what a classifier can recover from what the original network uses. For English part-of-speech tagging from translation encoder activations, the classifier reaches 93.5% test accuracy with all dimensions. Keeping the highest-ranked 10% at test time gives 69.8%, while keeping the lowest-ranked 10% gives 15.8%. Training a new classifier on those subsets raises the corresponding accuracies to 89.1% and 80.6%. The lower-ranked dimensions therefore retain information that the original classifier was poorly equipped to read by itself. In the translation networks, zeroing the highest-ranked 50 neurons under the cross-network ranking produces drops of 15-20 BLEU points. Zeroing the lowest-ranked 50 costs 0.5 BLEU points.
The picture depends on the property. The classifier weights for months of the year concentrate on a small set of dimensions, while those for categories such as nouns and locations are more spread out. The two ranking methods also converge on some of the same dimensions for word position. These results give a way to connect recognizable activation patterns with controlled tests of reliance, while keeping the conclusions tied to the task, the network, and the intervention being measured.
Deep dive: What Is One Grain of Sand in the Desert? Analyzing Individual Neurons in Deep NLP Models
Dalvi and colleagues trace linguistic information to individual neurons and test which neurons matter for translation and word prediction. · about 32 minutes to read
The problem and its context
From whole representations to individual dimensions
A recurrent network turns the words of a sentence into a sequence of vectors. As it reads a word, its internal state can preserve aspects of that word and the surrounding sequence that help it perform its training task. In a translation encoder, those vectors supply information to the part of the network that produces a translation. The encoder receives supervision through translation. A researcher can then ask whether its vectors also carry cues about grammatical categories or word meaning.
The paper describes an established way of answering that question. Take the vector associated with each word, add a linguistic label from a separate source, and train a classifier to predict the label from the vector. A similar approach applies to a representation of a whole sentence, where the auxiliary label describes a property of the sentence. Earlier studies had used supervised tasks to study word and sentence embeddings, recurrent states, and translation representations. The auxiliary targets included properties of word form, meaning, and sentence structure. The paper situates its method within that line of work, including Fine-grained Analysis of Sentence Embeddings Using Auxiliary Prediction Tasks and Probing Sentence Embeddings for Linguistic Properties.
The familiar result from such an experiment is a score for a full representation. A classifier that predicts a verb label accurately has found a usable signal somewhere in its input. The score allows many accounts of how the signal is organized. A few coordinates might supply most of the evidence. A broader collection might be necessary to distinguish verbs in different contexts. A strong coordinate might also have weaker substitutes elsewhere in the representation. All of these arrangements can support a good classifier score when every dimension is available.
The shift in this paper is to ask which coordinates support the prediction and what happens when access to them changes. A coordinate can be tracked across many words, yielding an activation pattern that a researcher can inspect. A set of coordinates can be masked while the classifier or translation system is evaluated. This gives the authors units of analysis small enough to connect a recognizable pattern, such as a change with sentence position, to a controlled intervention.
Here a neuron is a dimension of a chosen representation. If a translation encoder produces a vector for each word, a particular neuron is the same coordinate considered across all those vectors. Its activation can change markedly from word to word. The object of study is that changing value and the information it makes available. The analysis takes place after training, an approach the authors connect to decomposability. They seek to explain aspects of a trained system by examining its parts.
The precedents for looking at single units
The paper identifies earlier examples of neuron-level analysis in language research. Some had examined units associated with sentence length, and others had looked at sentiment. Work on recurrent networks also supplied ways to visualize activations against the sequences that produced them. These studies made the behavior of individual coordinates a plausible topic of investigation. The gap the authors saw was a method for ranking coordinates across a range of properties, along with a systematic way to test those rankings. Visualizing and Understanding Recurrent Networks, Learning to Generate Reviews and Discovering Sentiment
The comparison with computer vision further shaped the problem. The paper describes a tradition of examining the responses of individual units or filters in convolutional networks. It also notes a debate about what a striking response pattern establishes. A unit can look specialized when inspected across examples, and the network may still produce the relevant outputs when that unit is removed. Conversely, work reviewed by the authors had used ablation to show that some units contribute to particular object classes. An ablation is an intervention that disables a component so that performance can be measured with it out of operation. Visualizing and Understanding Convolutional Networks
This distinction matters for language. A neuron that responds strongly to month names might be easy to describe, while a neuron essential to translation might have an activation pattern that is hard to name. Researchers might also have no labeled data for the property that a useful neuron carries. A method that begins with linguistic labels and a method that begins with agreement across trained networks therefore ask different questions. One looks for dimensions that make a specified property readable. The other looks for recurring patterns that may matter to the training task, leaving their interpretation for later.
The authors put those questions in the broader context of understanding and controlling trained systems. A ranking could help investigators decide which units to inspect, which to intervene on, and which might be candidates for removal when studying smaller networks. The paper also raises potential uses involving sensitive attributes and output choices. The prerequisite is an empirical account of what a ranking measures. Useful explanations require evidence about what a unit responds to, what other units can substitute for it, and how the original network behaves when it is unavailable. Towards A Rigorous Science of Interpretable Machine Learning
The method, step by step
Record the same coordinate across many words
The common starting point is a trained network and a collection of sentences to run through it. In translation, the authors examine the encoder. Its input can be described as a sequence of word embeddings, numerical vectors that the network receives in place of word spellings. As the encoder processes the sentence, it produces hidden states, the internal vectors used to represent the words in context. The analysis records those states and keeps track of which word occurrence produced each one. Word embeddings
The paper expresses this mapping as follows.
x = (x₁, …, xₙ) ⟶ᴹ z = (z₁, …, zₙ), with zᵢ ∈ ℝᴰ
Here x is an input sequence, xᵢ is its input at position i, and n is the sequence length. The arrow marked M denotes applying the trained network. The output sequence is z, and zᵢ is the latent representation at position i. The symbol ∈ means that zᵢ belongs to ℝᴰ, the space of real-valued vectors with D coordinates. The ellipses stand for the entries between the displayed endpoints. The paper writes zᵢⱼ for coordinate j of zᵢ. That scalar is the activation of neuron j for the word at position i.
For the supervised analysis, the vector for each word occurrence is paired with a label. For the cross-network analysis, the vector for each occurrence is paired with vectors produced for the same occurrence by other networks. Keeping those roles distinct helps explain the rest of the design. In the supervised branch, what the authors compare is how well coordinates help predict a label. In the cross-network branch, they compare the shapes of activation series across common inputs.
From trained networks to tested neuron rankings
The steps in order.
Fit a classifier for the property of interest
Linguistic Correlation Analysis starts by specifying what the researcher wants to read from the network. The full label set might consist of grammatical categories for a part-of-speech task. Within that set, the researcher might want to examine a particular category, such as verb. The same setup can be used for morphology, which concerns the structure and forms of words, or for semantic tags, which mark kinds of meaning. The paper also uses position classes as labels. Position can be supplied from the sentence itself, illustrating how the method can work with labels that require no grammatical judgment. Part-of-speech tagging
For each labeled occurrence, the authors use the already trained network to obtain its activation vector. They fit a separate logistic regression classifier to these vectors and labels. The classifier assigns a score to each possible label by weighting the coordinates and adding their contributions. It converts the scores to probabilities, which it uses to predict a label and to learn from errors during training. Because the score is linear in the activations, the researchers can inspect the weight attached to each coordinate for each label.
Pθ(l | xᵢ) = exp(θₗ · zᵢ) / ∑ₗ′∈P exp(θₗ′ · zᵢ)
Pθ(l | xᵢ) is the probability that the classifier with weights θ assigns label l to input word occurrence xᵢ. The set P contains the candidate labels, and l′ ranges over those labels in the denominator. The vector zᵢ holds the recorded activations for the occurrence. The vector θₗ contains the classifier weights for label l, and θₗ′ contains the weights for the label indexed by l′. The dot denotes a dot product, which multiplies corresponding entries and adds the products. The function exp exponentiates each score, and the denominator sums the resulting values so that the probabilities across labels add to a whole. The weight array θ has one axis for the D coordinates and one for the L labels, with L the size of P.
The classifier therefore learns a collection of readouts from the same internal representation. A large positive weight means that a positive activation raises the score for the associated label, holding the other contributions fixed. A large negative weight can also carry strong evidence, with the direction depending on the activation’s sign. Both kinds of weight matter for finding sensitive coordinates. This is why the ranking uses weight magnitude.
Shape the classifier weights with regularization
Many weight settings can make useful predictions when the input contains correlated coordinates. A classifier can concentrate weight on a few of them or spread it among coordinates that give similar evidence. Since the weights are what the authors will inspect, their training objective directly affects the interpretation they obtain. The paper uses elastic net regularization. It adds penalties on the classifier weights to the usual loss on the predicted labels.
ℒ(θ) = −∑ᵢ log Pθ(lᵢ | xᵢ) + λ₁‖θ‖₁ + λ₂‖θ‖₂²
ℒ(θ) is the loss minimized during training. The index i runs over the labeled training examples, with xᵢ their input occurrences and lᵢ their observed labels. In the first term, Pθ(lᵢ | xᵢ) is the classifier probability of the observed label, log takes its logarithm, and the negative sum is the cross-entropy loss for these labeled examples. The notation ‖θ‖₁ denotes the sum of absolute weights. The term ‖θ‖₂² is the sum of squared weights, the squared Euclidean norm of the weights viewed as a collection of entries. The hyper-parameters λ₁ and λ₂ specify how strongly to penalize the two quantities. The authors use gradient descent to adjust θ while keeping the activations from the original network fixed.
The absolute-weight penalty encourages sparsity, so some coordinates can receive little or no weight. The squared-weight penalty helps retain groups of correlated coordinates. Both behaviors are valuable to this analysis. A sparse readout can make a sharply localized signal easy to see. Allowing weight to spread among correlated features gives a group of neurons a chance to register when its members carry related evidence. The authors tune the penalties with prediction accuracy in view so that a convenient ranking still comes from a classifier that performs its assigned task.
Turn weights into rankings for a label or a task
For an individual label, the ranking starts with its vector of classifier weights. The authors sort the coordinates in descending order of absolute weight. They then take a prefix that accounts for a chosen fraction of the label’s total absolute weight. The total is what the paper calls weight mass. A label with a few dominant weights reaches the threshold quickly. A label with many comparable weights needs a longer prefix. Holding the fraction fixed across labels gives the paper an operational way to compare concentrated and spread-out evidence.
A ranking for a whole tagging task needs to combine these label-specific lists. Pooling raw weights could let a label with large overall weights dominate the result. The paper instead uses a shared percentage threshold and lets each label contribute coordinates according to that label’s own total. It starts with a small percentage and collects the selected coordinates for every label. It then increases the percentage and appends any coordinates that have just entered the union. As the threshold rises towards 100%, more of each label’s weight is covered.
This procedure prioritizes a neuron if it enters early for any label in the set. A neuron highly weighted for a particular adjective category, for example, can appear early in the ranking for part-of-speech tagging even if its weights for other categories are small. A dimension that matters across several labels still appears as a single dimension in the final list. The resulting order reflects when dimensions become salient within labels, which gives a task-level ranking without discarding the label-level structure that produced it.
Find activation patterns that recur across networks
Cross-model Correlation Analysis begins with independently trained networks for the same task. The authors keep the network settings comparable and vary the training data and initialization. They then run a common evaluation sequence through the networks and record each coordinate’s activations across the same word occurrences. Each neuron can now be represented as a series of numbers indexed by evaluation word.
The hypothesis is that some useful patterns recur across independent training runs. An activation that tends to rise near sentence endings in one network might have a counterpart elsewhere, even when the two coordinates occupy different positions in their vectors. The method searches for such a counterpart by calculating Pearson correlation, a measure of how closely two series vary together in a linear fashion. Each neuron receives the best correlation found in a different network.
score(Mᵢⱼ) = max{ρ(Mᵢⱼ, Mᵢ′ⱼ′) | 1 ≤ i′ ≤ N, 1 ≤ j′ ≤ D, i′ ≠ i}
Mᵢⱼ denotes the activation series for neuron j in network i. Each series lies in ℝᵀ, where T is the number of word occurrences in the common evaluation set. Mᵢ′ⱼ′ denotes a candidate series for neuron j′ in network i′. The symbol ρ denotes the Pearson correlation coefficient between the two series, with the occurrences aligned. N is the number of trained networks and D is the number of coordinates in each representation. The conditions after the vertical bar define the candidates. The inequality i′ ≠ i excludes coordinates from the network being ranked. The max takes the largest coefficient among the remaining candidates, and score is the resulting value used to rank the neuron.
The best-match rule makes a recurring pattern sufficient for a high score. The corresponding neurons can have different indices, and the procedure can assign multiple neurons the same best counterpart. Nor does the score require agreement from every run. The displayed rule uses the signed coefficient, so agreement in the direction of changes contributes directly. This differs from the supervised ranking, where the ordering for a label uses the absolute value of a classifier weight. The ranks from the two procedures can be compared afterward, as the authors do for position-sensitive neurons.
Test a ranking in the system that produced it
The last step depends on the scope of the ranking. A linguistic ranking is meant to identify evidence useful to an auxiliary classifier. The authors compare equal-sized subsets from the top and bottom of that ranking. In a masking test, they keep the selected activations and replace the rest with zero at test time. The classifier’s learned weights stay fixed. In a separate test, they train a classifier from the beginning with only the selected dimensions. This allows it to adapt its readout to whatever evidence the subset contains.
For a ranking intended to describe the original network, the comparison works in the other direction. The authors turn off the selected neurons and leave the remaining coordinates available. They progressively zero neurons from the top or bottom of the order and measure the original task. Translation quality is evaluated with BLEU, a score based on overlap between generated translations and reference translations. Word prediction is evaluated with perplexity, which is lower when the network gives higher probabilities to the words that occur. A larger loss of performance after masking the top of a ranking indicates greater reliance on those coordinates under the intervention.
The different meanings of selection matter when reading the experiments. In a classifier test, retaining the top neurons asks how much can be read from them. In an original-task ablation, erasing the top neurons asks how much the trained network loses without them. The authors made their extraction and analysis code available through the NeuroX toolkit.
Experiments and results
Networks, languages, and labels
The translation experiments cover English and French in both directions and German into English. The authors work with 2 million sentences drawn from the United Nations parallel corpus for English and French. The German-to-English data come from the IWSLT campaign. For each language pair, they divide the parallel training data into three equal subsets to train separate instances. The recurrent language-prediction experiments use the source side of the parallel corpora. The United Nations Parallel Corpus, IWSLT Evaluation Campaign Report
The translation system uses a sequence-to-sequence architecture with attention. An encoder reads the source sentence, and the decoder uses attention to draw on the source representations as it produces the target sentence. The authors train a 2-layer bidirectional translation network with 500-dimensional word embeddings and LSTM states. A bidirectional encoder incorporates information from both directions through the input. LSTM, short for long short-term memory, is the recurrent architecture used for the states. Translation training runs for 20 epochs, and the authors use the checkpoint with the best development loss. They use similar settings to train a unidirectional LSTM for word prediction. Neural Machine Translation by Jointly Learning to Align and Translate
The general classifier setup draws 20k source-side sentences at random from the translation training data and uses 4k sentences from the official test sets for evaluation. French part-of-speech labels come from Tree-Tagger, English labels from MXPOST, and German part-of-speech and morphology labels from LoPar. The paper also reports a separate split for the annotated English semantic-tagging data, with 42k sentences for training and 12k for testing. The semantic task operates at the word level. Its categories include kinds of meaning such as a location or a calendar expression.
The analysis covers both broad tagging tasks and narrower properties. A classifier for sentence position predicts whether an occurrence is at the beginning, in the middle, or at the end. Month names are another example of a specific category. These narrower cases help the authors connect weights and activation traces to clearly described patterns. The accuracy tables provide the main quantitative comparisons for part of speech, morphology, and semantic tagging.
Readability before neuron selection
The full-vector classifiers establish how much label evidence is available before coordinates are selected. The comparison is with a local majority baseline that assigns each word the tag it was associated with most frequently in training. For words it has never seen, the baseline uses the most frequent label overall. This baseline measures how far a type-level association can go. A classifier trained on internal activations also has the opportunity to use distinctions that depend on the context in which a word occurs.
On the English part-of-speech test, the baseline obtains 91.6% accuracy. The classifier using translation encoder activations reaches 93.5%, and the one using recurrent language-prediction activations reaches 92.9%. On the German part-of-speech test, the corresponding scores are 89.3%, 93.6%, and 92.3%. In English semantic tagging, the baseline scores 84.2% on the test data, while the translation and language-prediction classifiers score 90.1% and 86.0%.
Classifier test accuracy for English part-of-speech tagging
Both activation-based classifiers exceed the word-level majority baseline.
The numbers
| System or setting | accuracy % |
|---|---|
| Local majority baseline | 91.6 |
| Recurrent language-prediction activations | 92.9 |
| Translation encoder activations (this paper) | 93.5 |
The baseline is particularly competitive for French part of speech. It reaches 92.8% test accuracy, the translation encoder classifier reaches 93.2%, and the language-prediction classifier reaches 92.4%. This is the exception to the reported pattern of activation-based classifiers surpassing the baseline. For French morphology, the language-prediction classifier achieves 90.1% test accuracy, ahead of the translation encoder classifier at 88.0% and the baseline at 89.5%. The baseline comparison is therefore also unfavorable to the French morphology translation classifier in the reported table. For German morphology, the baseline, translation encoder classifier, and language-prediction classifier obtain 83.7%, 87.3%, and 86.5% test accuracy, respectively.
The regularization setting is chosen using a grid search on English part-of-speech tagging. The authors report minimal differences in classification accuracy for regularization values below 1e −4 in that experiment. They choose 1e −5 for each penalty and use that setting throughout. This gives the subsequent comparisons a common basis. It also leaves open how much an alternative setting with similar full-vector accuracy would alter individual ranks.
How much the highest-ranked coordinates retain
When the already fitted classifier sees only part of its input at test time, accuracy can fall sharply. From English translation encoder activations, the full classifier scores 93.5% on the part-of-speech test. Keeping the top 10% gives 69.8%, and keeping the bottom 10% gives 15.8%. At 20% retained, the top subset gives 84.1% and the bottom subset 21.5%. The fixed classifier thus remains sensitive to the direction of the ranking even as the size of its available input changes.
English part-of-speech test accuracy after masking translation encoder activations
The classifier retains much more accuracy when the same masking budget preserves the highest-ranked coordinates.
The numbers
| System or setting | accuracy % |
|---|---|
| Bottom 10% retained | 15.8 |
| Top 10% retained | 69.8 |
| Bottom 20% retained | 21.5 |
| Top 20% retained (this paper) | 84.1 |
The pattern recurs in the other main classifier tests. From French translation encoder activations, retaining the top 20% gives 79.4% part-of-speech test accuracy, compared with 24.9% for the bottom subset. In German, the translation encoder scores for those subsets are 88.2% and 15.7%. For English semantic tagging from the translation encoder, they are 74.2% and 20.7%. The language-prediction activations also yield better accuracy from top subsets in these comparisons. In English semantic tagging, the top and bottom 20% give 65.2% and 25.1% with the trained classifier held fixed.
Morphology offers a useful check on the scope of the pattern. With French translation encoder activations, retaining the top 20% gives 56.3% morphology test accuracy, and retaining the bottom 20% gives 24.3%. The full classifier scores 88.0%. The rank successfully separates stronger and weaker subsets, while the accuracy retained from the top subset is considerably below the full-input score. The paper can therefore compare the ordering’s usefulness across tasks without assuming that a fixed reduction leaves the same amount of recoverable evidence in each case.
What changes when the readout can adapt
The retraining experiment lets each subset have its own classifier. For English part of speech from translation encoder activations, training with the top 10% produces 89.1% test accuracy. Training with the bottom 10% produces 80.6%. With 20% of the coordinates, the respective accuracies are 91.2% and 87.2%. The top set continues to offer the more effective input, and the bottom set supports predictions that the original full-input classifier made poorly when it was masked.
English part-of-speech test accuracy after refitting on translation encoder subsets
Refitting recovers substantial accuracy from both ends of the ranking, and the top subset remains stronger at each size.
The numbers
| System or setting | accuracy % |
|---|---|
| Bottom 10% retained | 80.6 |
| Top 10% retained | 89.1 |
| Bottom 20% retained | 87.2 |
| Top 20% retained (this paper) | 91.2 |
The German word-prediction network shows a sharper separation with small input subsets. When the classifier is refitted for German part-of-speech tagging, its test accuracy is 87.2% with the top 10% and 41.7% with the bottom 10%. The full-input classifier scores 92.3%. From German translation encoder activations, refitting with the same fractions yields 91.4% and 77.1%, with 93.6% from the full input. These figures support the paper’s comparison of how unevenly classifier-readable information is distributed in the two architectures.
Refitting also recovers much of the morphology performance. For French translation encoder activations, classifiers trained on the top and bottom 20% reach 80.6% and 75.1% on the morphology test. For German translation encoder activations, the scores are 83.5% and 80.5%. These morphology results put the masking experiment in context. The poor accuracy of a fixed classifier on the lower-ranked coordinates can coexist with a fairly effective readout trained specifically for those coordinates.
What the original networks lose
To test the cross-network ranking on translation, the authors mask a growing set of encoder coordinates and inspect translation quality. Across the tested translation directions, removing neurons from the top of the ranking damages BLEU earlier and more strongly than removing neurons from the bottom. The paper reports drops of 15-20 BLEU points when the highest-ranked 50 neurons, or 2.5% of the coordinates, are removed. It reports a loss of 0.5 BLEU points for the lowest-ranked 50. These values are changes in translation quality under ablation, measured against the unablated translation systems.
The corresponding word-prediction experiments use perplexity. Removing neurons from the top of the cross-network ranking increases perplexity faster than removing neurons from the bottom. The paper presents this comparison as curves across ablation sizes. Its account establishes the direction of the effect across the experiments. The result complements the translation numbers by showing that the ranking also identifies consequential coordinates when the original task is to predict words and the metric rewards assigning them higher probability.
What the ablations show
Weight rankings recover evidence for the auxiliary task
The fixed-classifier experiment changes the set of available dimensions while leaving both the encoder and the classifier’s weights as they were. Its strongest control is the equal size of the top and bottom subsets. A larger input usually gives a classifier more opportunities to make a correct prediction, so comparing different-sized sets would give an ambiguous result. Here the difference is which dimensions remain. Across the main tagging results, the top subsets support much higher accuracy, which confirms that the learned weights provide a useful order for the auxiliary task.
Masking alone would give an incomplete picture of how much information is spread through the representation. The classifier was fitted to the entire vector. It can rely on combinations of dimensions that disappear under masking. Other coordinates with useful evidence can have low weights because the classifier already had stronger sources of similar evidence. If the high-weight dimensions are erased, a fixed classifier continues to apply the weights it learned under full access. A low score then describes the behavior of that particular readout after an intervention.
Refitting tests the possibility of another readout. The recovery from bottom subsets shows that lower-ranked dimensions carry signals that a newly trained linear classifier can use. The continued advantage of top subsets shows that this recovery does not erase the asymmetry in the representation. The combination supports a more specific interpretation than either result could by itself. Task-relevant evidence is distributed unevenly, with useful signal extending well beyond the group that supplies most of the full classifier’s weight.
The paper summarizes this asymmetry across properties for its smallest reported refitted subsets. With the top and bottom 10%, the reported absolute accuracy advantage of the top group averages 12.8% for translation and 25.5% for language prediction. The authors speculate that the translation networks distribute linguistic evidence more broadly. Their comparison also changes the recurrent architecture, from bidirectional translation encoding to unidirectional language prediction. The observed gap supports a description of the tested systems, and the source of the difference remains underdetermined.
Cross-network recurrence is more informative than simple activation statistics
Cross-model Correlation Analysis requires additional training runs, so the authors ask whether statistics from a single run would identify much the same neurons. They consider a ranking by activation variance and one by distance from the mean. Variance describes how much the observed activations fluctuate. Distance from the mean gives another way to order units by their activation behavior. Each statistic can be computed without pairing activation traces from independently trained networks.
The top 50 neurons in the cross-network ranking overlap by less than 10% with the top 50 in rankings that use statistics from individual networks. The low agreement shows that the criteria select different groups. To see which ordering better tracks reliance in translation, the authors zero units selected under each ranking. In the German-to-English comparison, masking from the top of the cross-network ranking does more damage than masking selections based on variance or distance from the mean. The comparison includes both directions of the single-network orders, guarding against the possibility that their low-ranked end identifies the more consequential coordinates.
The evidence ties the success of the method to information the single-network statistics lack. Variance can reveal that a neuron changes sharply across inputs. Cross-network correlation asks whether another independently trained network changes in a similar way on those inputs. The ablation result supports recurrence as a useful predictor of which coordinates matter to the trained translation system in this comparison. It leaves the observed activation trace as a starting point for finding out what those coordinates do.
Linguistic usefulness and translation reliance partly overlap
The authors also compare rankings produced by the two branches of the method. They take the English part-of-speech and semantic rankings derived from the auxiliary classifiers and use them to choose encoder coordinates to remove from the English-to-French system. The resulting translation losses are greater than those from ablating the bottom of the cross-network ranking. Removing the top-ranked cross-network coordinates does more damage than either linguistically selected removal. The translation system is slightly more sensitive to the semantic ranking than to the part-of-speech ranking in this comparison.
The difference follows from what each ranking has been asked to optimize. A linguistic ranking prioritizes a coordinate with a large role in distinguishing labels that the researchers supplied. A cross-network ranking prioritizes a coordinate with a close activation counterpart in another network trained for the same task. Both routes can identify coordinates that matter for translation. The relative damage in this experiment shows why the auxiliary label should remain part of the description of a supervised rank. Its neuron order answers a narrower question about which dimensions help recover that label set.
The semantic comparison also has a specific scope. When entire coordinates are disabled, the intervention removes every contribution those coordinates make, including any contributions unrelated to their strong classifier weights for semantic tags. The relative BLEU losses show that the groups selected by the two linguistic tasks differ in their effects. Identifying which semantic distinctions mediate those effects would require a finer intervention. The paper’s comparison provides the connection between a ranked group and translation performance.
Some labels have concentrated readouts
The authors examine localization by choosing the leading neurons whose weights together account for 25% of a label’s total absolute weight. This gives every label the same criterion. The number of neurons needed to reach it becomes a measure of how concentrated the classifier’s evidence is. The paper reports several dozen for some noun, verb, and adjective categories. A sentence-ending marker, a category for interrogative adverbs, and German postpositions require fewer than 10 neurons under this rule.
The semantic tags give a related comparison. A location label has a dispersed readout, while the month-of-year category concentrates weight on very few units. The distinction has a concrete linguistic interpretation. Months form a bounded set of names, while locations span a wider range of expressions. The paper uses these results to organize its observations about closed and open categories. The counts measure how the particular regularized classifiers allocate weight in the translation representations.
A label can also share its high-ranked neurons with related labels. The authors intersect sets of salient coordinates and observe some shared across adjective categories, alongside others especially prominent for comparative or superlative adjectives. In a comparison across tag sets, several neurons associated with fine-grained future verb forms align with a neuron prominent for a broader future-tense part-of-speech tag. The observations are compatible with representations that support both shared grammatical distinctions and more specific ones. They give a local view of the hierarchy the authors describe.
Activation traces help explain what the ranking found
The paper uses activation visualizations to move from rankings to individual examples. One neuron, #1902, responds with strong positive activity to a third-person singular present-tense verb in the examples and strong negative activity to a past-tense verb. The examples include “Supports” and “misappropriated.” The sign difference makes the response more informative than a simple on-or-off description. Another displayed unit focuses on German articles.
The position classifier yields a particularly clear trace. Its leading coordinate tends to be strongly negative near the beginning of a sentence, near zero in the middle, and strongly positive toward the end. Position was supplied to the supervised method as an explicit label. The cross-network ranking also highlights position-sensitive neurons, including the same top position neurons identified by the supervised procedure. The authors additionally associate some leading cross-network units with relations, conjunctions, determiners, and punctuation.
The cross-network agreement on position shows how a recurring activity pattern can be connected to an interpretable property. The position labels explain the activity in terms a reader can recognize. The cross-network method selects related dimensions based on their observations alone. The comparison connects the supervised and unsupervised views for a concrete case. It does not require the two methods to agree across the whole ranking.
The paper also inspects the words that activate a neuron most strongly. For neuron #1925, the top 10 words include multiple month names, among them August, July, and January, and also include “presidential.” The list for neuron #1960 contains several negation-related words, including “not” and “nor,” along with other words. The list for neuron #1590 consists of numbers. These examples show how the authors generate an interpretation to investigate. The ranked words make an association visible, and the entries outside an apparent theme help define how far the description can be taken.
Limitations
Limits identified by the authors
The experiments concentrate on recurrent architectures. The paper explicitly leaves variants such as the Transformer and QRNN for future investigation. In translation, the authors restrict their main neuron analysis to encoder activations for simplicity. Its conclusions about dependence during translation therefore concern interventions on the source-side representations presented to the rest of the system. Transformer and attention
The paper also flags an architectural confound in the comparison between translation and word prediction. The translation encoder is bidirectional, and the word-prediction network is unidirectional. Differences in the spread of recoverable linguistic information could reflect that difference in access to context. The training task changes at the same time. The authors present broader distribution in translation as a possible explanation of the measured results.
Linguistic Correlation Analysis needs a labeled version of the property being studied. This limits the method to properties that researchers can define and annotate at the level of the examples. The paper’s semantic annotation is restricted to English. Its use of part-of-speech and morphology resources for additional languages supplies evidence for those particular tasks and tag sets. Cross-model Correlation Analysis dispenses with linguistic annotation by comparing activation series, at the cost of requiring multiple trained instances and common evaluation inputs.
The authors present distillation, architecture search, and behavior control as potential applications. The paper reports preliminary manipulation of verb-tense neurons that steered generation towards present or past tense, and it points to related work for details. The quantitative tests here principally establish the effects of zeroing coordinates and the recoverability of labels from subsets. A smaller translation system trained or rebuilt around the rankings would call for its own evaluation. Identifying and Controlling Important Neurons in Neural Machine Translation
Limits implied by the experimental design
The linguistic ranking is specific to the classifier, the labels, and the chosen coordinate system. A large absolute weight measures how the fitted linear classifier uses a coordinate, in combination with the scale of that coordinate’s activations and the other inputs it receives. The elastic net shapes that allocation. Classification accuracy and subset comparisons give checks on the rankings as used in the paper. They do not establish that the exact order would survive a rescaling of the coordinates, a change in the regularization, or another equally accurate readout.
The localization comparisons have a similarly operational meaning. Needing few neurons to reach 25% of the absolute weight mass tells the reader that a substantial portion of the fitted weight is concentrated near the top. It says relatively little about the evidence available after those dimensions are removed. The refitting experiments show why that distinction matters. Lower-ranked subsets often support far more accurate prediction after their weights are fitted separately. A sharply focused readout and a distributed supply of related evidence can occur in the same representation.
Automatic labels set another boundary. In the part-of-speech and morphology experiments, test accuracy measures agreement with the tags used by the evaluation. The word-level majority baseline also shows that a large share of correct decisions can follow from associations with word identity. The comparison establishes what can be recovered on the tested sentences, with context potentially contributing alongside type-level information. It leaves open how well the classifier handles difficult cases that require contextual disambiguation, since the main comparisons average accuracy over the test examples.
For the cross-network ranking, a high score establishes that there is a good coordinate-level match somewhere among the other trained instances. The best-match rule permits matches to differ across pairs of runs. A pattern can also be represented by a combination of coordinates in one network and concentrated in a single coordinate in another. The reported search tests pairs of scalar activation series and gives no direct measure of those group-level correspondences. Because the score uses signed correlation, a pattern with its direction reversed would need another positively matching counterpart to score well under the displayed rule.
The zeroing experiments establish dependence under a particular intervention on a trained network. An activation set to zero on every occurrence may change how several downstream computations interact. A large loss shows that the trained network performs poorly with the selected signals suppressed. Pinpointing which information in those signals drives the loss would require separating the contributions of different features and contexts. Likewise, a small loss at the bottom of the ranking describes the tested budget, evaluation data, and metric. It gives limited evidence about a unit’s value to particular rare outputs or about what would happen after permanent removal and retraining.
Finally, the qualitative interpretations carry the scope of the examples that support them. The high-activation word lists give convenient evidence for associations with months, numbers, or negation. Those associations can coexist with other patterns, as the mixed word lists illustrate. The activated words, the classifier weights, and the effects of masking each answer a different empirical question. Agreement among them strengthens an interpretation for a specific neuron, while a general account of the computations that use that neuron remains a further task.
What came after
Surveys and accounts of internal representations
Later citations place the paper in several overlapping lines of work. The closest survey is Sajjad and colleagues’ account of neuron-level interpretation in deep natural language processing. Its organizing subject is the same unit of analysis used by Dalvi and colleagues, the individual dimension in a trained representation. Belinkov and Glass take a broader view of analysis methods across neural language processing. These scopes situate the paper both as a study of single neurons and as part of the wider practice of using supervised analyses and interventions to examine representations. Neuron-level Interpretation of Deep NLP Models, Analysis Methods in Neural Language Processing
Other citing surveys address explainability for large language systems or put interpretability in the context of safety. Their citation places neuron ranking among the methods relevant to those broader questions. Ferrando and colleagues’ primer approaches internal behavior through Transformer-based architectures, one of the architectural extensions Dalvi and colleagues left open. Anwar and colleagues address foundational questions about assuring alignment and safety. These citing works widen the setting in which the early neuron-level experiments are discussed. Explainability for Large Language Models, Mechanistic Interpretability for AI Safety, A Primer on Transformer Internals, Foundational Challenges in Assuring Alignment and Safety
Readouts, individual units, and groups
Gurnee and colleagues take up the problem of finding individual neurons through sparse probing. That question is close to the supervised half of Dalvi and colleagues’ study. In both cases the investigator wants to learn something about a small collection of dimensions by examining a readout from a much larger representation. Dalvi and colleagues use an elastic net and then order dimensions by their contributions to the classifier. The later case studies make sparse probing the organizing approach. Finding Neurons in a Haystack
Other citing studies ask about structure at different scales. Marks and Tegmark examine linear structure in representations of true and false examples. The connection is to Dalvi and colleagues’ use of a linear readout, with the later work framed around the geometry of the representations. Arps and colleagues use probing to investigate constituency, bringing the inquiry to hierarchical syntactic structure. Dar and colleagues analyze Transformers in embedding space, offering a different setting for asking how a representation can be interpreted. The Geometry of Truth, Probing for Constituency Structure, Analyzing Transformers in Embedding Space
The later work on compositional neuron groups puts groups at the center of the account. Dalvi and colleagues encountered groups when they found related information spread among dimensions or shared across labels. Shafran and colleagues’ work concerns constructing interpretable features from neuron groups. Foote and colleagues address interpretation at scale through a neuron-to-graph framing. Arieh and colleagues focus on output-centric descriptions of features, shifting the descriptive emphasis towards what features contribute to outputs. These are distinct ways of making the object of interpretation more informative than a list of leading coordinates. Constructing Interpretable Features from Compositional Neuron Groups, Neuron to Graph, Output-Centric Feature Descriptions
From grammatical properties to languages, skills, and emotions
In multilingual research, Kudugunta and colleagues investigate translation representations at scale, and Tang and colleagues focus on language-specific neurons in multilingual language systems. The first takes the representation-level question into a multilingual translation setting. The second keeps the individual neuron as its subject and makes language specificity the property under investigation. Singh and colleagues bring a neuron-level view to the encoders used for cross-lingual emotion detection. Together these topics extend the setting beyond relating an activation to a grammatical label within one language. Investigating Multilingual NMT Representations at Scale, Language-Specific Neurons, Lost in Activations
Wang and colleagues frame their search around skill neurons in pretrained Transformers. Hanna and colleagues investigate how GPT-2 computes a particular mathematical comparison, and Christ and colleagues study isolation of mathematical reasoning abilities using forward passes. Suzgun and colleagues examine dynamic counting in LSTMs, keeping the recurrent architecture that figures in Dalvi and colleagues’ experiments. The change across these questions is from using labels to describe properties of words towards investigating internal components associated with a capability or computation. Finding Skill Neurons, How Does GPT-2 Compute Greater-Than?, Math Neurosurgery, LSTM Networks Can Perform Dynamic Counting
The citing work also includes searches for culture-sensitive neurons in vision-language systems and for emotion-sensitive neurons in audio-language systems. The audio-language study explicitly pairs discovery with causal validation in its framing, echoing the distinction between identifying an association and testing the effect of an intervention. Wei and colleagues study sensitivity to pruning and low-rank modifications in the context of safety alignment. Altinisik and colleagues study the effects of adversarial training on robustness and generalizability. These works cite the neuron study from settings where the measured behavior, the representation, or the intervention differs from its original translation and word-prediction experiments. Finding Culture-Sensitive Neurons, Discovering and Causally Validating Emotion-Sensitive Neurons, Assessing the Brittleness of Safety Alignment, Impact of Adversarial Training on Robustness and Generalizability
Cite
Cite as Fahim Dalvi, Nadir Durrani, Hassan Sajjad, Yonatan Belinkov, Anthony Bau and James Glass. 2019. What Is One Grain of Sand in the Desert? Analyzing Individual Neurons in Deep NLP Models. AAAI Publications (The Association for the Advancement of Artificial Intelligence (AAAI)).
@inproceedings{dalvi2019what,
title = {{What Is One Grain of Sand in the Desert? Analyzing Individual Neurons in Deep NLP Models}},
author = {Fahim Dalvi, Nadir Durrani, Hassan Sajjad, Yonatan Belinkov, Anthony Bau and James Glass},
booktitle = {AAAI Publications (The Association for the Advancement of Artificial Intelligence (AAAI))},
year = {2019},
doi = {10.1609/aaai.v33i01.33016309},
url = {https://doi.org/10.1609/aaai.v33i01.33016309}
}This page in Markdown https://md.research.elamur.ai/free/en/papers/dalvi-2019-what-is-one-grain-sand/