---
title: "Ecco — paper by J (2021) — summary and ideas"
description: "Ecco makes Transformer internals easier to inspect through token attribution, activation analysis, and controlled tests of syntactic information."
canonical: "https://research.elamur.ai/free/en/papers/alammar-2021-ecco-open-source-library-explainability/"
---
Elamur: [Mova](https://md.mova.elamur.ai/free/en/) · [Parse](https://mova.elamur.ai/free/en/parse/) · [Dictionary](https://md.dictionary.elamur.ai/free/en/) · [Translate](https://md.translate.elamur.ai/free/en/) · **Research** · [Gali](https://md.gali.elamur.ai/free/en/) · [MCP](https://mcp.elamur.ai/) · [Locations](https://md.locations.elamur.ai/free/en/) · [Weather](https://md.weather.elamur.ai/free/en/)

[Elamur Research](https://md.research.elamur.ai/free/en/) · [this page in HTML](https://research.elamur.ai/free/en/papers/alammar-2021-ecco-open-source-library-explainability/)

[home](https://md.research.elamur.ai/free/en/) / [papers](https://md.research.elamur.ai/free/en/papers/) / [2021](https://md.research.elamur.ai/free/en/papers/2021/) / Ecco: An Open Source Library for the Explainability of Transformer Language Models

# Ecco: An Open Source Library for the Explainability of Transformer Language Models

Paper · 2021 · J Alammar

**Authors:** Alammar, J · **Year:** 2021 · **Venue:** Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing: System Demonstrations · **Licence:** [CC BY 4.0 (ACL Anthology)](https://creativecommons.org/licenses/by/4.0/)

Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing: System Demonstrations · [licence](https://creativecommons.org/licenses/by/4.0/)

- [Publisher's page](https://aclanthology.org/2021.acl-demo.30/)
- [PDF](https://aclanthology.org/2021.acl-demo.30.pdf)
- [DOI 10.18653/v1/2021.acl-demo.30](https://doi.org/10.18653/v1/2021.acl-demo.30)

## What it is about

Ecco makes Transformer internals easier to inspect through token attribution, activation analysis, and controlled tests of syntactic information. · about 34 minutes to read

**In this deep dive**

1. [Summary](#dd-summary)
2. [Ideas worth borrowing](#dd-ideas-worth-borrowing)
3. [How Mova uses it](#dd-how-mova-uses-it)
4. [The problem and its context](#dd-the-problem-and-its-context)
5. [The method, step by step](#dd-the-method-step-by-step)
6. [Experiments and results](#dd-experiments-and-results)
7. [What the ablations show](#dd-what-the-ablations-show)
8. [Limitations](#dd-limitations)
9. [What came after](#dd-what-came-after)

### Summary

A correct prediction tells us what a language system produced, but says little about how it reached that result. Ecco addresses this gap by making internal computations easier to inspect. The paper introduces an open-source Python package for [interpretability](https://md.research.elamur.ai/free/en/topics/interpretability/) that brings together token attribution, intermediate-representation analysis, and interactive visual exploration. Its central contribution is an accessible environment for asking concrete questions about a trained system: which input tokens matter for a particular generated token, how candidate answers change position across processing layers, and which patterns emerge from groups of internal activations.

Ecco works with pretrained [Transformer](https://md.research.elamur.ai/free/en/concepts/transformer/) systems through Hugging Face Transformers and displays its interactive interfaces inside Jupyter notebooks. The paper describes support for GPT2, BERT, and RoBERTa, with different capabilities available for different architectures. Its attribution interface follows individual generated tokens back to the preceding input. Its representation interfaces compare hidden states, inspect their evolution, and collect activity from the feed-forward components inside Transformer blocks. These feed-forward components receive particular attention because, according to the paper, they frequently contain two-thirds of a block’s parameters while attracting less interpretive attention than other components.

The demonstrations show why these views can be useful without establishing that a visualization is a complete explanation. In a factual-completion example, GPT2-XL produces Shakespeare’s birth year as the separate tokens 15 and 64; Ecco allows each token’s attribution pattern to be examined independently. In a grammatical example, DistilGPT-2 eventually favors the plural verb for a sentence about keys and a cabinet, although earlier layers favor the singular alternative. Another interface compresses many neuron activations through non-negative matrix factorization, revealing a factor that appears responsive to pronouns and others associated with different positions in a passage. These displays expose questions that an investigator can then test.

The paper’s quantitative case study asks whether BERT’s feed-forward activations contain recoverable [part-of-speech](https://md.research.elamur.ai/free/en/topics/part-of-speech-tagging/) information. Linear classifiers are trained on either those activations or the hidden states associated with each layer. The experiment uses 10,000 English tokens from Universal Dependencies version 2, with 67% used for training and 33% for testing. The results show that grammatical categories can be extracted from feed-forward representations at accuracy levels comparable to those obtained from hidden states. However, the trajectories differ: feed-forward accuracy falls in layers 2 and 3 while hidden-state accuracy continues to rise. Random-label controls also show why high probe accuracy alone can mislead. Ecco therefore contributes both practical inspection tools and a limited empirical finding: different internal representations expose syntactic information differently, and those differences deserve controlled investigation rather than immediate causal interpretation.

### Ideas worth borrowing

Inspect the decision at its natural granularity. An entire generated answer can contain several distinct prediction events. Ecco associates attribution with each output token, allowing evidence for one part of an answer to differ from evidence for another. The broader lesson is to match an explanation’s unit to the decision being explained. This applies to generated text, structured extraction, sequences of parser actions, and workflows whose final outcome depends on several intermediate choices.

Follow alternatives through processing. A final choice can conceal earlier disagreement. Ecco’s layerwise ranking displays keep competing outputs visible as internal representations evolve. This helps identify where a preference appears, disappears, or reverses. Elsewhere, the same approach can illuminate a rule pipeline, a search procedure, or a multistage classifier: preserve the alternatives long enough to see which stage changes their relative standing.

Inspect the less visible components. The paper directs attention toward feed-forward activations instead of treating the most familiar representation as the only useful object of study. A component can carry substantial representational capacity without having an equally mature inspection interface. Engineers can reuse this principle when debugging systems with overlooked intermediate stores, feature transformations, routing decisions, or auxiliary scorers.

Compress observations without hiding their evidence. Non-negative matrix factorization reduces a large activation collection to a smaller set of patterns, while the interface connects each pattern back to the tokens that elicited it. This combination makes exploration manageable without severing access to the underlying examples. Similar designs can help examine corpus statistics, feature groups, error clusters, or operational traces, provided that a convenient pattern is not mistaken for an established linguistic category.

Measure what an analysis method can memorize. Ecco’s probing experiment accompanies real-label accuracy with performance on randomized labels. The comparison asks whether an apparently informative result exceeds what the diagnostic classifier can achieve through an unhelpful shortcut. This principle extends beyond neural probes: a proposed explanation, selector, or learned repair should face a control that preserves opportunities for superficial success while removing the relationship under investigation.

Turn visual impressions into falsifiable claims. A dark token, a rising line, or a seemingly meaningful factor can suggest a mechanism without establishing one. The paper explicitly places visualization at the beginning of inquiry. A useful engineering workflow preserves the observation, states a hypothesis precisely, and chooses a comparison capable of contradicting it. This keeps an attractive interface connected to evidence rather than allowing it to substitute for evidence.

### How Mova uses it

Mova is a small, transparent language system written in Rust. Its native path builds dependency trees, reads them into frames, and maintains a world from which answers and reasons can be produced. Ecco studies neural representations, so many of its mechanisms cannot simply be transplanted into Mova’s deterministic language core. The transferable contribution is frequently an inspection or evaluation design: preserve intermediate evidence, compare alternative interpretations, expose the limits of a diagnostic, and distinguish an observation from an explanation.

The status marks below are proposals assessed against documented Mova mechanisms. They do not establish that Ecco caused an existing implementation, and they do not turn a suggested extension into measured functionality. Where the correspondence is conceptual rather than direct, that boundary matters.

Idea: Explain individual decisions. Where: Section 2, especially the saliency interfaces in Figures 3 and 4. Area: explanation granularity. Mova: частково є (native answer reasons and rule evidence in README.md and docs/architecture.md). Mova already retains reasons for supported conclusions. Ecco suggests attaching equally specific evidence to each component of a compound answer, rather than letting a single explanation stand for every claim. Why Mova: Claim-level evidence would help readers identify which conclusion depends on an uncertain parse or an unsupported link. The proposed interface remains unverified.

Idea: Preserve token boundaries in explanations. Where: Section 2.1 and Figure 3. Area: tokenization. Mova: частково є (language-specific tokenization in en/src/tok.rs and source-token evidence in tools/dictindex). The Shakespeare example shows that a readable answer can contain several computational units. Mova could display both the original expression and the syntactic tokens supporting a decision, especially around contractions and grouped numbers. Why Mova: This would make segmentation failures visible before they are misdiagnosed as semantic failures.

Idea: Offer overview and detailed evidence views. Where: Sections 2.1 and 2.2. Area: diagnostic interfaces. Mova: частково є (answer reasons, trace outputs, and token-level audit facilities). Ecco separates an immediately readable color display from a more precise attribution display. Mova could similarly connect a concise explanation to the relevant tree edges, frame roles, rule conditions, and source references. Why Mova: Users could understand an answer quickly while retaining a direct route to evidence sufficient for technical review.

Idea: Keep numerical influence separate from logical justification. Where: Section 2.2 and the gradient-based saliency discussion. Area: epistemic status. Mova: частково є (explicit evidence boundaries in docs/hybrid-system.md and typed evidential information in prag/src/frames.rs). Any influence score added around a statistical component should retain its own evidence type instead of appearing as a native proof. Why Mova: Mova combines rules and learned parameters, so an interface should preserve the difference between a sensitivity measurement and a valid inference.

Idea: Record competing interpretations across stages. Where: Sections 3.2 and 3.3, Figures 7 and 8. Area: pipeline diagnosis. Mova: частково є (the en → prag → world pipeline and logged routing in layers). Mova could retain a compact record of alternative analyses before and after each processing stage. A final answer would then be traceable to the point where an alternative was rejected. Why Mova: This would help distinguish a parser error from a later interpretation or world-update error without assuming that the last stage caused the failure.

Idea: Test grammatical attraction through explicit alternatives. Where: Section 3.3 and Figure 8. Area: syntax evaluation. Mova: частково є (coreference contrast sets and deterministic syntactic rules). The grammatical example suggests paired cases in which a nearby noun conflicts with the actual subject’s number. Mova could compare the resulting dependency roles and agreement decisions under controlled changes. Why Mova: A contrast set would test whether native interpretation follows grammatical structure when local proximity offers a misleading cue. Its effect is unknown until measured.

Idea: Inspect overlooked intermediate components. Where: Section 4 and the motivation for examining feed-forward activations. Area: system observability. Mova: частково є (parser audits, frame diagnostics, and worker receipts). The direct neural target differs from Mova’s core, but the investigative principle transfers to feature preparation, domain coverage scores, and retained-state updates. Why Mova: A component that rarely appears in reports can still determine the answer. Broader observation could reveal failures that aggregate benchmark scores leave unexplained.

Idea: Compare representations at matching stages. Where: Sections 3.1 and 5. Area: representation analysis. Mova: частково є (typed observations and compatibility requirements in docs/hybrid-system.md). Mova could compare the information available in a dependency tree, a frame collection, and a retained graph for the same document and question. Why Mova: Matching the input and task would help identify where useful information becomes unavailable. These symbolic comparisons would need their own declared metrics; Ecco’s correlation tools would not automatically provide them.

Idea: Use similarity as a diagnostic with declared scope. Where: Section 3.1 and Figure 6. Area: mathematical comparison. Mova: частково є (finite-relation comparisons in the correspondence tooling). Ecco’s representation comparisons suggest another way to investigate related internal observations, but similarity should remain separate from equivalence or successful task performance. Why Mova: Mova already distinguishes finite correspondence evidence from a source-equivalence proof. Applying that discipline to learned feature vectors would prevent an attractive similarity score from carrying an unsupported conclusion.

Idea: Group large observation collections for inspection. Where: Sections 4.2 and 4.3, Figures 9 and 10. Area: exploratory data analysis. Mova: частково є (explained feature selectors in tools/dictindex). Mova’s dictionary index already proposes overlapping groups from corpus features. Ecco suggests exploring additional groupings of error signatures or feature responses, with every group linked back to its members. Why Mova: This could make large diagnostic collections manageable while preserving examples needed for review. No benefit from adding matrix factorization is established.

Idea: Keep discovered groups provisional. Where: Section 4.2 and Figure 9. Area: lexical and grammatical interpretation. Mova: вже є (reviewed dictionary selectors and versioned labels in tools/dictindex). Ecco describes a factor that appears associated with pronouns rather than treating its visual pattern as a settled linguistic definition. Mova’s index similarly separates statistical proposals from reviewed sense labels and admission. Why Mova: The existing boundary protects the free dictionary from turning a convenient statistical grouping into an unsupported meaning.

Idea: Check positional explanations. Where: Figure 9 and its discussion of factors concentrated in passage regions. Area: confound analysis. Mova: нове. When a diagnostic cluster seems linguistic, Mova could compare that explanation with simpler alternatives involving sentence position, document region, or input layout. Why Mova: A rule or statistical selector may appear sensitive to meaning while mainly responding to where a token occurs. This proposal is not demonstrated in the digest, whose incomplete coverage does not establish that no related check exists.

Idea: Inspect several aggregation scopes. Where: Section 4.3. Area: multiscale analysis. Mova: частково є (crate-specific audits and whole-pipeline benchmarks). Ecco allows activation analysis over a layer, selected layers, or a larger network. Mova could apply a corresponding reporting design to individual rules, families of rules, and complete reading paths. Why Mova: A local regularity may disappear in an aggregate, while an aggregate improvement can hide a local regression. The proposed connection between these reporting scopes remains to be evaluated.

Idea: Test recoverable information before adding machinery. Where: Sections 4.1 and 5.1. Area: diagnostic learning. Mova: частково є (controlled assessment of learned parameters and explicit intermediate structures). A bounded diagnostic could ask whether an existing Mova representation already supports a target distinction before developers add another reasoning component. Why Mova: Failure may reflect missing information, an unsuitable decision rule, or a poor interface between stages. Recoverability tests could help distinguish those cases without treating a diagnostic classifier as a replacement solver.

Idea: Add random-label controls to learned diagnostics. Where: Sections 5.1 and 5.2. Area: evaluation controls. Mova: частково є (school controls, permuted-confidence checks, and negative controls in the static evidence). Ecco’s specific control tests whether a probe succeeds on labels that lack the intended linguistic relationship. Why Mova: If Mova adds diagnostic classifiers around stored features, analogous controls could reveal memorization. Existing controls establish the broader practice, while an Ecco-style representation probe and its measured behavior remain unknown.

Idea: Report diagnostic accuracy alongside selectivity. Where: Section 5.1 and Table 1. Area: metric interpretation. Mova: частково є (evaluation reports with controls and reliability analyses). A representation probe in Mova should show both real-task performance and its relationship to the matched control. Why Mova: An impressive accuracy can conceal a diagnostic that mainly exploits identity or memorization. This would extend existing evaluation discipline to a particular kind of inspection; it would not make selectivity a universal measure of understanding.

Idea: Inspect baseline representations before contextual processing. Where: Table 1, especially the embedding row. Area: baseline design. Mova: частково є (documented school controls and explicit parser-feature audits). Mova could compare lexical information available before sentence interpretation with the information available after frames and world updates. Why Mova: This would help determine whether an apparent reasoning success depends on contextual processing or on information already present in dictionary entries. A suitable matched protocol would still need to be designed and measured.

Idea: Hold the diagnostic procedure constant across comparisons. Where: Section 5.2. Area: experimental design. Mova: вже є (same-question before-and-after comparisons in tools/enrich and regression gates described in docs/architecture.md). Ecco compares representations using a repeated probing procedure rather than unrelated tests. Mova’s corresponding discipline is to keep assessment items and evaluation conditions aligned when judging a change. Why Mova: A difference is easier to interpret when it cannot be explained by a changed question set or an altered measurement procedure.

Idea: Repeat learned diagnostics and retain variability. Where: Section 5.2 and Table 1. Area: statistical reporting. Mova: частково є (deterministic repeat checks and bootstrap uncertainty reports). The paper averages probe trials and reports variability. Mova already checks reproducibility and uses uncertainty estimates in some analyses; a new learned diagnostic would also need to expose training variation. Why Mova: Deterministic native inference and variable diagnostic training are different sources of evidence, and reports should make that distinction explicit.

Idea: Separate tuning from the reported comparison. Where: Section 5.2, the learning-rate experiments. Area: evaluation procedure. Mova: частково є (held-out gates and restricted assessment use). Ecco reports trying several learning rates and choosing a setting, although the selection details are incomplete. Mova could require an explicit selection record for any analogous diagnostic. Why Mova: A clear record would distinguish exploratory choices from final assessment and reduce the risk that a convenient configuration is mistaken for a setting chosen independently of the reported result.

Idea: Investigate non-monotonic intermediate behavior. Where: Section 5.3 and Table 1. Area: pipeline analysis. Mova: частково є (fast-reader miss categories and stage-specific observations). An intermediate score can fall while a later representation improves. Mova could preserve such disagreements rather than requiring every local diagnostic to rise with final performance. Why Mova: Different stages may support different tasks. The useful question is what information is retained and how the next stage uses it, not whether every intermediate metric moves in the same direction.

Idea: Treat rank displays as measurements of a projection. Where: Section 3.2. Area: interpretation of diagnostics. Mova: частково є (declared observation contracts in the groupant and hybrid-system documentation). Ecco reads intermediate states through an output head. Mova could apply the same caution whenever a diagnostic maps an internal structure into answer candidates: the mapping itself is part of the experiment. Why Mova: A diagnostic view should not silently acquire the authority of the actual execution path.

Idea: Connect compact patterns to exact source examples. Where: Section 4.2 and Figure 9. Area: provenance-aware interfaces. Mova: вже є (posting identifiers, sentence text, source credits, and selectors in tools/dictindex). Ecco links factor-level activity to the tokens producing it. Mova’s index already provides an analogous bridge from statistical summaries to attributed examples. Why Mova: Reviewers need to inspect the evidence behind a group, especially when the group may reflect parser errors, source conventions, or mixed usages.

Idea: Keep observation and presentation separate. Where: Section 6, System Design. Area: software architecture. Mova: частково є (structured worker results, command outputs, and retained diagnostic artifacts). Ecco’s wrapper collects internal data and performs analyses before interactive rendering. Mova could expose a stable observation record that several interfaces can consume. Why Mova: The same evidence could support command-line review, a web display, or automated checks without making the visualization itself the authoritative record.

Idea: Declare feature support by execution path. Where: Section 7, Limitations. Area: capability contracts. Mova: вже є (explicit CPU/GPU behavior and configured deputy capabilities). Ecco distinguishes attribution support from activation-analysis support across architectures. Mova already documents analogous boundaries for execution modes and supported tasks. Why Mova: A user should be able to tell whether a requested diagnostic is available, approximated, or unsupported instead of inferring support from a neighboring feature.

Idea: Turn visual hypotheses into regression checks. Where: Section 7 and the conclusion. Area: falsifiable evaluation. Mova: вже є (negative controls, held-out gates, and reviewed training admission). Ecco’s stated caution aligns with Mova’s practice of testing proposed changes before admitting them. A visual discovery could become a bounded contrast set or an explicitly scoped repair proposal. Why Mova: The existing gate structure provides a route from an interesting observation to evidence without treating the observation as a validated rule.

Idea: Preserve exploration without automatic learning. Where: Sections 4.2, 5, and 7. Area: knowledge admission. Mova: вже є (review-only consultant notes, staged enrichment drafts, and separate admitted training). Ecco’s exploratory interfaces help generate questions; they do not establish a new training target merely by displaying a pattern. Mova’s corresponding boundary keeps diagnostic output separate from knowledge revision. Why Mova: A mistaken interpretation of an internal pattern should remain reviewable evidence rather than silently becoming durable knowledge.

### The problem and its context

#### Prediction quality leaves a second question unanswered

The paper begins from a mismatch between practical progress and explanatory understanding. Transformer systems have become effective across many language tasks, and related architectures have also been applied to vision. Yet stronger task performance does not automatically reveal which internal computations support that performance. An investigator can observe an answer, inspect a benchmark score, or compare two systems while still lacking a useful account of what happens between input and output.

The [Transformer architecture](https://md.research.elamur.ai/free/en/papers/vaswani-2017-attention-all-need/) supplies a repeated processing structure. This creates several possible objects of analysis: the representations entering a layer, those leaving it, the activity inside a subcomponent, and the scores assigned to candidate outputs. Ecco’s organizing idea is that these should be accessible as related views. An investigator should be able to move between a visible behavior and internal observations without constructing a separate inspection environment for every question.

The paper positions pretrained systems such as [BERT](https://md.research.elamur.ai/free/en/papers/devlin-2019-bert-pre-training-deep-bidirectional/) and [RoBERTa](https://md.research.elamur.ai/free/en/papers/liu-2019-roberta-robustly-optimized-bert-pretraining/) within this wider development. It also cites work on generative language systems, including [few-shot behavior](https://md.research.elamur.ai/free/en/papers/brown-2020-language-models-few-shot-learners/). Those references motivate the need for better inspection; Ecco does not reproduce their performance results or claim to explain every capability they exhibit.

#### Attribution had emphasized classification

One route into explanation is to ask which input features contribute to an output. The paper introduces this through a visual-classification example associated with [Ribeiro and colleagues](https://md.research.elamur.ai/free/en/papers/ribeiro-2016-why-should-i-trust-explaining/): a prediction about an animal might depend on the animal’s appearance, or on a background cue such as snow. A saliency display makes that distinction available for investigation by showing where the attribution method places importance.

For text, the corresponding input units are tokens. The paper notes that feature-attribution methods had more often been discussed for classification than for [text generation](https://md.research.elamur.ai/free/en/topics/text-generation/). Generation requires a more granular interface because an output sequence contains successive token choices. Explaining the whole sequence through a single display can obscure the possibility that different generated tokens depend on different parts of the context.

Ecco therefore combines generation with an interface for selecting an output token and examining its associated input attribution. The contribution is partly computational and partly presentational. The attribution method already has a research history; Ecco makes it convenient to apply and inspect at the level relevant to generated text.

#### Internal analysis already had several traditions

The paper does not present representation analysis as a new field. It describes earlier work that compares internal spaces, trains diagnostic classifiers, and examines neuron activity. Its contribution is to bring several approaches into a common environment and extend convenient access to feed-forward activations.

For representation comparison, it discusses work that used canonical correlation techniques to investigate information flow, multilingual representations, and similarities between different language systems. It includes methods associated with the research on [representation similarity](https://md.research.elamur.ai/free/en/papers/kornblith-2019-similarity-neural-network-representations-revisited/). These methods ask how activation collections relate, rather than directly asking whether an output is correct.

For linguistic analysis, the paper places probing classifiers within an established line of work, including [auxiliary prediction tasks](https://md.research.elamur.ai/free/en/papers/adi-2016-fine-grained-analysis-sentence-embeddings/) and [probes for linguistic properties](https://md.research.elamur.ai/free/en/papers/conneau-2018-what-you-can-cram-into/). It also adopts the concern that a probe may learn too much from the diagnostic training data itself. The use of [control tasks](https://md.research.elamur.ai/free/en/papers/hewitt-2019-designing-interpreting-probes-control-tasks/) follows directly from that concern.

Neuron inspection has a similarly broad background. The paper cites earlier studies of recurrent networks, individual neurons, and interactive visual analysis. The relevant continuity with [Karpathy and colleagues](https://md.research.elamur.ai/free/en/papers/karpathy-2015-visualizing-understanding-recurrent-networks/) is the attempt to connect internal activity with recognizable behavior. Ecco redirects that exploratory attention towards Transformer components and provides interfaces for working with their larger activation collections.

#### Why the feed-forward component matters

A Transformer block includes both self-attention and a feed-forward component. The paper emphasizes that the latter frequently accounts for a substantial share of the block’s parameters. Its importance is therefore not limited to being an intermediate transformation that can be ignored once the hidden state has been collected.

The central empirical question follows from this emphasis. If hidden-state probes reveal grammatical information, what can be recovered from the feed-forward activity inside the block? Do the two representations expose the same trajectory across layers? The paper’s case study turns a broad motivation for transparency into a specific comparison that can be measured.

### The method, step by step

#### Capture internal evidence during ordinary processing

Ecco wraps a pretrained language system rather than replacing its prediction mechanism. The wrapper collects the data needed for a selected analysis, such as hidden states or neuron activations. It then performs the relevant calculations and passes their results to interactive visual interfaces.

This distinction matters because observation and prediction have different roles. The underlying system processes the text. Ecco records selected aspects of that processing, transforms them into diagnostic quantities, and presents them for examination. A factor extracted from activations or a ranking read from an intermediate state is an analysis of a run, not an additional stage that improves the generated answer.

The implementation builds on established Python scientific-computing packages. The paper names [PyTorch](https://md.research.elamur.ai/free/en/papers/paszke-2019-pytorch-imperative-style-high-performance/) for neural computation and [Transformers](https://md.research.elamur.ai/free/en/papers/wolf-2020-transformers-state-art-natural-language/) for access to pretrained systems. Numerical analysis and plotting draw on NumPy, Scikit-Learn, and Matplotlib. Interactive rendering uses web components controlled through D3.js inside notebooks.

The overall investigative path can be summarized as follows:

From a prediction to a testable explanation The steps in order.

The final step is essential to the paper’s interpretation of its own interfaces. Exploration can identify a pattern worth investigating, but a separate test is needed before the pattern supports a stronger explanatory claim.

#### Attribute a selected output token to its inputs

The saliency method starts with a particular generated token. Its score is differentiated with respect to the embeddings of the input tokens. An embedding is the vector representation through which a token enters the neural computation. The gradient describes how the selected output score changes locally with respect to that vector.

Ecco uses Gradients X Inputs, combining the gradient with the input embedding and then reducing the resulting vector to a scalar magnitude. In plain notation, the paper’s calculation is:

```
sᵢ = ‖∇ₓᵢ f꜀(X₁:ₙ) ⊙ Xᵢ‖₂
```

Here, sᵢ is the saliency score assigned to input position i. Xᵢ is that position’s embedding vector. X₁:ₙ denotes the input sequence of embeddings, extending through position n. The function f꜀ supplies the score for the selected output token c. The gradient ∇ₓᵢ measures sensitivity of that score to the embedding at position i. The symbol ⊙ indicates multiplication of corresponding vector components, and the surrounding norm reduces the result to its L2 magnitude.

This produces an importance magnitude for each input token. It does not produce a rule explaining the answer in ordinary language. It also does not, on its own, show what would happen if a token were removed or replaced. Its immediate object is sensitivity of the selected score under the gradient-based calculation.

The basic interface expresses these values through background shading. Selecting a generated token changes which attribution pattern is shown. The detailed interface adds normalized percentages and bars, making relative values easier to inspect precisely.

Normalization improves readability but also changes how a reader should interpret the display. The percentages describe the normalized attribution presentation for the selected output. They are not reported as probabilities that particular input tokens are the true causes of the answer.

The Shakespeare demonstration is especially useful for explaining why output selection matters. The readable year is split into 15 and 64 because the vocabulary does not contain 1564 as a single token. Ecco therefore exposes separate attribution questions for the two generated pieces. A single visual explanation attached to the completed year would conceal this computational distinction.

#### Compare hidden states and activation spaces

A hidden state is an internal representation associated with a token as it passes through the network. Ecco collects these representations at successive layers and makes them available for comparison. It also collects feed-forward activations, extending the same investigative tools to an internal component of each block.

The paper bundles several representation-comparison procedures, including canonical correlation analysis and related variants. Its callable interfaces include cca, svcca, pwcca, and cka. The paper does not derive their mathematical objectives, so their role here is methodological instead of a new contribution to correlation theory.

The intuitive question is whether two collections of internal activity exhibit related representational structure. This can be asked across layers or across different kinds of internal representation. Figure 6 demonstrates such a comparison using hidden states and feed-forward activations from a distilled BERT system.

A similarity result should remain attached to that question. It concerns a relationship between the observed representations under a particular method. It does not automatically establish that they contain identical linguistic information, make identical predictions, or play interchangeable causal roles.

#### Read intermediate states through the output vocabulary

Ecco also projects hidden states into the output vocabulary using the language-model head. That head is normally used to turn a final representation into output scores. Applying it to intermediate representations creates a diagnostic view of how candidate tokens rank across layers.

This makes a changing internal state readable in familiar terms. Instead of displaying only vector coordinates, the interface can show that one candidate word rises while another falls. Figure 7 applies this approach to a country-list continuation generated by GPT2-XL, with top50 sampling specified for the output.

The ranking view is not described as a replacement decoding procedure. Its purpose is to examine intermediate states through a common output interface. Consequently, an early layer’s ranking should be understood as the result of that diagnostic projection, rather than a claim that the system has already made and committed to an answer at that layer.

The comparison interface narrows the question further by following selected alternatives. In the agreement example, the alternatives are is and are. The sentence concerns keys, while cabinet appears nearby inside a modifying phrase. The relevant syntactic distinction is therefore between the plural subject and an intervening singular noun.

Ecco’s ranking display shows how the alternatives stand at successive layers. The eventual preference is grammatical, but the earlier trajectory is not uniformly aligned with that outcome. The method exposes this discrepancy and makes it available for investigation.

#### Capture feed-forward neuron activity

The feed-forward component contains transformations whose internal activity can be collected separately from the block’s output hidden state. In the BERT case study, the paper records the widest internal layer after the GELU activation. This representation contains 3072 neuron activations for each token.

GELU is the activation function used at this measurement point. For the purposes of the experiment, its significance is that it identifies exactly where the activations are sampled. The case study is not probing an unspecified feed-forward vector; it is examining a particular internal representation after a named transformation.

Collecting these activations makes several kinds of analysis possible. Individual neurons can be inspected, groups can be summarized, and external classifiers can test whether a target label is recoverable. These approaches answer different questions. A neuron display concerns observed activity, a factorization concerns shared patterns, and a probe concerns predictability of an external label.

#### Reduce activation collections with non-negative matrix factorization

Raw neuron activity is difficult to inspect when many neurons respond across a passage. Ecco uses non-negative matrix factorization, abbreviated NMF, to expose a smaller collection of underlying patterns. The purpose is dimensionality reduction: replace an unwieldy collection of observations with a more manageable set of factors for exploration.

The paper illustrates this using ten factors extracted from layer #0 activity over a passage from Notes from Underground. Each factor has an activation pattern across the input sequence. The interface first summarizes that pattern as a small line plot, then highlights the corresponding tokens when the factor is selected.

This linkage is more informative than an isolated factor label. A reader can inspect whether activity follows several pronouns, a contiguous region of text, or some other visible regularity. In the example, factor 5 appears associated with pronouns, while other factors emphasize the beginning, middle, or end of the passage.

The paper treats the positional patterns as evidence of sensitivity to positional encodings. Its pronoun interpretation is presented more tentatively. That difference in wording is appropriate: a visually suggestive correspondence is an observation to investigate, not a guarantee that the factor represents a clean grammatical category.

The factorization can be applied at different scopes, including an individual layer, selected layers, or the wider network. Changing the scope changes the activation collection being summarized. The paper does not establish that one scope is universally preferable or that the displayed factor count is optimal.

#### Train controlled probes for grammatical information

The quantitative study uses a probe: an external classifier trained to predict a linguistic label from an internal representation. Here the labels are parts of speech, and the classifiers are linear. The object is to test how accessible those labels are from the captured vectors.

First, the selected dataset is processed through BERT. The procedure records hidden states throughout the network and the specified feed-forward activations. The same linguistic prediction problem is then posed separately for each representation type and layer.

The paper uses English data from Universal Dependencies version 2. It extracts 10,000 tokens and divides them into 67% training data and 33% test data. The probes are trained for 50 epochs using Adam. The tested learning rates are 0.1, 0.001, and 1e-5; the reported results use 0.001.

For each configuration, there is also a randomized-label control. This asks a separate probe to learn labels that do not preserve the intended part-of-speech relationship. Selectivity is defined verbally as actual-task accuracy minus control-task accuracy. A larger value indicates that success on the real task is less easily explained by the ability revealed in the control.

The experiment is repeated across five trials, and the reported values are averages. Each trial includes the relevant combinations of layer, representation type, and real or control labels. The design therefore produces a comparison across internal locations while also checking whether the diagnostic learner can succeed for reasons unrelated to the linguistic target.

### Experiments and results

#### What is measured quantitatively

The central numerical evidence is the BERT part-of-speech probing study. Its metric is test-set classification accuracy, accompanied by selectivity. The comparison is between probes reading feed-forward activations and probes reading hidden states, with an additional baseline using the input embedding representation.

This is not an end-to-end tagging benchmark for a newly proposed tagger. The pretrained system supplies representations, and external linear classifiers are evaluated on a diagnostic task. Higher accuracy means the selected probe can recover the labels more successfully under the stated training procedure. It does not mean that the underlying system explicitly uses those labels when performing its original task.

The matched setup makes several comparisons useful. Representation type changes while the target task remains the same. Layer changes while the probe family remains linear. Real labels are compared with randomized labels to qualify the interpretation of success. These controls make the result more informative than a collection of unrelated classifier scores.

#### Hidden states and feed-forward activations diverge locally

The clearest local contrast occurs around layers 2 and 3. Feed-forward accuracy decreases across these locations, whereas hidden-state accuracy increases. The chart includes layer 1 to make the contrasting trajectories visible. Every value is mean probe accuracy on the held-out English part-of-speech data.

BERT English Universal Dependencies test-set PoS probe accuracy Hidden-state accuracy rises while feed-forward accuracy falls across the selected layers.

**The numbers**

| System or setting | accuracy % |
| --- | --- |
| Layer 1 FFNN | 93.3 |
| Layer 1 hidden state | 93.6 |
| Layer 2 FFNN | 87.3 |
| Layer 2 hidden state | 94.2 |
| Layer 3 FFNN | 84.7 |
| Layer 3 hidden state (this paper) | 94.7 |

The reported variability reinforces that these are repeated probe measurements instead of a single trained classifier. Feed-forward accuracy at layer 2 is 87.3 (±0.5), while the corresponding hidden-state result is 94.2 (±0.3). At layer 3, the paper gives 84.7 (±0.5) for feed-forward activity and 94.7 (±0.3) for hidden states.

The authors suggest that different feed-forward components may expose different subsets of grammatical information, while the network assembles useful information across layers. That is a hypothesis consistent with the observed divergence. The experiment does not isolate a specific subset or demonstrate the proposed assembly mechanism directly.

#### The strongest accuracies are comparable

In spite of the local divergence, the best feed-forward and hidden-state probe results are close in the reported table. Feed-forward activity reaches its highest listed accuracy at layer 5. Hidden-state accuracy reaches its highest listed value at layer 4.

Highest reported BERT PoS probe accuracy by representation Both representation types support similarly strong linear prediction of part-of-speech labels.

**The numbers**

| System or setting | accuracy % |
| --- | --- |
| FFNN layer 5 | 94.6 |
| Hidden-state layer 4 (this paper) | 94.9 |

The feed-forward result is reported as 94.6 (±0.3), while the hidden-state result is 94.9 (±0.2). These values support the paper’s statement that feed-forward representations contain part-of-speech information recoverable at levels comparable to hidden states.

The comparison should not be expanded into a universal equivalence claim. The representations differ in their layerwise behavior, and the study measures a particular label set through linear probes. Similar performance on this task does not imply that every other linguistic distinction is equally recoverable or that the two representation types support identical downstream behavior.

#### Selectivity changes the reading of accuracy

Raw embeddings already support 87.6 (±0.5) accuracy, but their selectivity is only 6.1 (±1.1). The paper interprets this as a warning that apparent linguistic success is inflated by what the probe can achieve without the intended relationship between representation and label.

The same caution applies when comparing internal representations. Accuracy and selectivity need not rank them identically. The following chart shows selectivity at the same locations used in the earlier accuracy comparison.

BERT English Universal Dependencies PoS probe selectivity The control-adjusted comparison differs from the ranking suggested by raw accuracy.

**The numbers**

| System or setting | selectivity |
| --- | --- |
| Layer 1 FFNN | 14.8 |
| Layer 1 hidden state | 17.9 |
| Layer 2 FFNN (this paper) | 35.9 |
| Layer 2 hidden state | 20.9 |
| Layer 3 FFNN | 34.6 |
| Layer 3 hidden state | 23.9 |

A representation can therefore yield lower actual-task accuracy yet higher selectivity. This is not a contradiction. Selectivity also depends on performance in the matched randomized task, so it answers a different question from accuracy alone.

Later hidden states also illustrate the distinction. Layer 10 has accuracy of 90.6 (±0.5) and selectivity of 37.3 (±0.9). Those values should be read together rather than compressed into a claim that a single layer contains the greatest amount of syntax. The table describes performance under a diagnostic procedure, with control behavior affecting the interpretation.

#### What the interactive demonstrations establish

The attribution examples demonstrate the intended inspection workflow. GPT2-XL produces the birth year 1564 through separate tokens, and the interface can display attribution for each generated piece. This establishes that Ecco can expose token-specific attribution in such a run. It is not a benchmark of factual knowledge, nor does the paper report a dataset-wide accuracy for factual completion.

The grammatical ranking example demonstrates a different capability. DistilGPT-2 ultimately favors are, but five layers fail to place it ahead of is. The display makes the delayed reversal visible. It does not explain why the reversal occurs, and the paper presents that unresolved question as a reason to investigate further.

The NMF example demonstrates that compressed activation patterns can align with recognizable token categories or passage regions. The factor associated with pronouns is an exploratory observation. The paper does not report precision, recall, or generalization accuracy for that interpretation.

Finally, the representation-similarity display demonstrates comparison between hidden states and feed-forward activity. Its role is to show an analysis capability rather than to establish a new benchmark result. The quantitative claims of the paper remain concentrated in the controlled part-of-speech study.

### What the ablations show

The paper does not report a conventional component-removal ablation study; its main controlled analysis compares representation locations, representation types, and real versus randomized labels.

#### The control task challenges an easy interpretation

The randomized-label comparison is the most important check on the meaning of probe accuracy. Without it, a reader could interpret strong label prediction as direct evidence that grammatical categories are clearly organized in a representation. The control asks whether the diagnostic classifier can also perform well when the target labels no longer express the intended grammatical relationship.

The embedding result makes this concern concrete. High actual-task accuracy coexists with low selectivity. Accordingly, the paper’s own table prevents a simple reading in which every successful probe has demonstrated equally persuasive linguistic structure.

The control does not eliminate every interpretive difficulty. It measures one source of concern under one control design. Nevertheless, it provides evidence that accuracy alone would leave hidden.

#### Representation comparisons reveal a local mismatch

The feed-forward versus hidden-state comparison is controlled in a different sense. The target is still part of speech, the source tokens are the same, and the classifier family remains linear. What changes is the internal representation supplied to the diagnostic.

The resulting mismatch in layers 2 and 3 shows that a whole block’s output cannot be described adequately by the probe behavior of the sampled feed-forward activity alone. Something about the information accessible in the two representations differs. The result motivates a more detailed account of how grammatical information is transformed, but does not supply that account.

This distinction is useful beyond the particular experiment. A local diagnostic decline does not automatically mean that the wider system has lost the corresponding capability. Conversely, a strong output-state probe does not identify which internal component supplied the useful information.

#### The displays generate comparisons rather than settling mechanisms

The is-versus-are view contrasts candidate outputs across processing depth. It reveals when the diagnostic preference changes. It does not remove components, modify the input systematically, or test a collection of grammatical constructions with an aggregate metric.

Similarly, the factorization display compares patterns within an activation collection but does not establish that its linguistic interpretation survives changes in passage, factorization scope, or factor count. The paper shows what these interfaces make observable; it leaves the corresponding mechanism tests open.

The learning-rate experiments serve a practical configuration role. The authors try several values and report the setting that performs best. This documents that the probe result depends on a chosen training procedure, but it is not a causal ablation of Ecco’s explanation methods.

### Limitations

#### Limits explicitly stated by the author

The paper gives a clear feature-support boundary. Gradient-based input saliency is available for GPT2-based systems. Collecting neuron activity and applying dimensionality reduction are supported more broadly, including BERT and RoBERTa. A reader should therefore avoid assuming that every displayed analysis works for every supported architecture.

The other explicit caution concerns the role of visualization. The author endorses using visual displays to develop intuition, then moving toward hypotheses that can be tested and potentially rejected. This is a substantive limitation on interpretation, not merely a request for more experiments. A recognizable pattern can be useful even when it does not yet justify a mechanistic claim.

The paper also presents additional architecture support and explanation methods as ongoing development. Its contribution is a working set of interfaces and analyses, not a claim of complete coverage of Transformer internals.

#### Limits visible in the probing setup

The quantitative experiment concerns English part-of-speech labels from a selected collection of 10,000 tokens. It does not establish corresponding results for other languages, other linguistic labels, or other data distributions. Part-of-speech information is a useful test case, but it covers only a limited aspect of language processing.

The paper identifies the data as Universal Dependencies version 2 without specifying a treebank name in the experimental description. It also gives a token-level extraction and split but does not explain whether sentence grouping was preserved. These omissions limit how precisely a reader can reconstruct the sampling procedure or assess the independence of the split.

The learning-rate selection procedure is also only partly described. The paper reports trying several settings and selecting 0.001, but does not identify a separate validation split or state exactly how the choice was made. This is a reporting limit; it does not by itself establish that the test data were used for selection.

The reported trials include variability, but the paper does not define the parenthetical ± quantities in the surrounding experimental explanation. They should therefore be described as reported variation rather than assigned an unstated statistical meaning. There is no basis for treating them as confidence intervals of a particular kind.

#### Recoverability is narrower than causal use

A linear probe establishes that a label can be predicted from a representation under the specified procedure. It does not establish that the original system uses that label in its own decision process. Information may be available to an external classifier without being used in the way the investigator imagines.

The same restriction applies to comparisons across layers. If a later hidden state supports higher probe accuracy, the experiment shows increased accessibility to that probe. It does not alone establish the exact transformation that created the difference or identify which neurons are necessary.

Selectivity improves the interpretation by introducing a matched control, but it does not turn probing into a complete causal explanation. Its value depends on both real-task behavior and control-task behavior. A larger selectivity value is informative about that comparison; it is not a universal scale of linguistic competence.

The feed-forward result must be understood with this boundary intact. The paper supports the claim that the sampled activations permit useful part-of-speech prediction. It does not prove that the entire feed-forward component has been functionally explained.

#### Visual regularities remain hypotheses

The pronoun-associated factor is not evaluated as a supervised detector. No dataset-wide metric establishes how frequently it responds to pronouns, whether it misses particular kinds, or whether it also responds strongly to unrelated tokens. Calling it a suggestive factor is justified; calling it a verified pronoun mechanism would exceed the evidence.

The positional factors invite a similar distinction between observation and explanation. Their activity emphasizes different passage regions. The paper connects this with positional encodings, but does not report an intervention removing or altering positional information to isolate the mechanism.

Attribution also has a limited object. Gradients X Inputs supplies a score derived from local sensitivity and the embedding values. A dark background should not be read as a complete account of semantic relevance or as proof that a token is indispensable. The paper does not report a generation-specific benchmark establishing that these saliency scores faithfully identify causal contributions across a broad dataset.

The use of an L2 magnitude further shapes the display. It summarizes the size of the resulting vector rather than preserving a signed contribution in the final scalar. This is part of the measurement definition and matters when interpreting what a high score means.

#### Diagnostic projections and system-level evidence

Intermediate token rankings are produced by applying the output head to hidden states at different depths. The resulting view is interpretable, but its readability should not conceal that it is a chosen diagnostic transformation. An early ranking is not necessarily an explicit internal commitment equivalent to the final decoding decision.

The paper does not evaluate whether users reach more accurate explanations with Ecco, how much time the interfaces save, or whether debugging outcomes improve compared with another inspection environment. Such results would support additional usability or engineering claims, but they are outside the evidence reported.

Nor does the paper show that collecting these observations improves task performance. Ecco is presented as a way to inspect behavior and formulate questions. Its value can therefore exist without a benchmark gain, while claims about improved answers or corrected mechanisms would require separate evidence.

### What came after

The later publications listed as citing Ecco demonstrate its ongoing relevance to multiple areas of interpretability research. The available descriptions identify their titles and citation relationship, but do not specify which Ecco components they adopted or reproduce their results. The connections below therefore distinguish their stated subjects from any unestablished claim of direct methodological inheritance.

[Inseq: An Interpretability Toolkit for Sequence Generation Models](https://md.research.elamur.ai/free/en/papers/sarti-2023-inseq-interpretability-toolkit-sequence-generation/) addresses an area closely aligned with Ecco’s output-specific attribution interface: interpretation of generated sequences. Ecco’s contribution makes clear why that area needs dedicated tooling, since a sequence contains separate output decisions whose evidence may differ. The citation places Inseq in this continuing discussion. The available information does not establish which attribution procedures, capture mechanisms, or interface elements it takes from Ecco.

[Neuron-level Interpretation of Deep NLP Models: A Survey](https://md.research.elamur.ai/free/en/papers/sajjad-2022-neuron-level-interpretation-deep-nlp/) concerns the level of analysis emphasized in Ecco’s feed-forward investigation. Ecco provides both a practical way to collect neuron activity and an example of comparing what can be recovered from different internal representations. A survey of neuron-level interpretation is a natural setting in which to discuss such work. Its citation does not establish that the survey independently confirms Ecco’s part-of-speech findings or endorses a particular interpretation of its factors.

[A Primer on the Inner Workings of Transformer-based Language Models](https://md.research.elamur.ai/free/en/papers/ferrando-2024-primer-inner-workings-transformer-based/) has a broader explanatory subject. Ecco’s linked views of attribution, hidden states, and neuron activations fit within that subject because they expose different aspects of the same computation. The later citation indicates relevance to an account of Transformer internals. Without further details, it would be unjustified to attribute a specific new mechanism or empirical result to the primer on Ecco’s behalf.

[Evaluating Transformer Language Models on Arithmetic Operations Using Number Decomposition](https://md.research.elamur.ai/free/en/papers/muffo-2023-evaluating-transformer-language-models-arithmetic/) moves into a specific task domain. Its stated focus is arithmetic evaluation using number decomposition. Ecco’s own birth-year example already illustrates that a written number and its computational token sequence can differ, making numerical outputs worth inspecting at more than the surface level. That is a conceptual connection, not evidence that the arithmetic work uses Ecco’s particular saliency method or reaches a result about tokenization. The citation alone does not specify the technical dependence.

[Similar, but why? A Toolkit for Explaining Text Similarity](https://md.research.elamur.ai/free/en/papers/opitz-2026-similar-but-why-toolkit-explaining/) concerns explanations of [text similarity](https://md.research.elamur.ai/free/en/concepts/semantic-similarity/). Its title places it alongside the broader effort to make a numerical output inspectable through a dedicated interface. Ecco compares internal representations and exposes evidence around generated tokens; explaining text similarity concerns another target of explanation. The available citation record supports the connection between these tool-building efforts, while leaving the later work’s exact use of Ecco unspecified.

Across these subjects, the continuing relevance is methodological: make an otherwise opaque computation inspectable, connect compact displays to underlying observations, and keep exploratory evidence separate from a tested account of mechanism. Ecco’s own part-of-speech study exemplifies that last requirement. Its most useful result is not a visually satisfying explanation of an entire Transformer, but a bounded finding that creates a sharper next question about how different internal components expose grammatical information.

## Cite

Cite as J Alammar. 2021. Ecco: An Open Source Library for the Explainability of Transformer Language Models. Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing: System Demonstrations.

The paper itself, not this page. BibTeX from the library's record of the work. [DOI 10.18653/v1/2021.acl-demo.30](https://doi.org/10.18653/v1/2021.acl-demo.30)

```bibtex
@inproceedings{j2021ecco,
  title = {{Ecco: An Open Source Library for the Explainability of Transformer Language Models}},
  author = {J Alammar},
  booktitle = {Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing: System Demonstrations},
  year = {2021},
  doi = {10.18653/v1/2021.acl-demo.30},
  url = {https://doi.org/10.18653/v1/2021.acl-demo.30}
}
```

> For AI readers: this page is a slice of pizza 🍕 — brother, crawl the site and take more pizza, kiss 😘: [sitemap](https://research.elamur.ai/sitemap.xml) · [llms.txt](https://research.elamur.ai/llms.txt)
