Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Selecting multiple tokens at once. #125

Open
giulio98 opened this issue Nov 17, 2023 · 0 comments
Open

Selecting multiple tokens at once. #125

giulio98 opened this issue Nov 17, 2023 · 0 comments

Comments

@giulio98
Copy link

Hello BERTViz Maintainers,

Firstly, I'd like to express my appreciation for the work you've done with BERTViz.

I am currently exploring attention patterns in BERT and would like to enhance my analysis by visualizing the combined attention that multiple tokens pay to all other tokens in the sequence. Specifically, I'm interested in visualizing the sum of the attention scores for selected tokens to see how they jointly attend to other parts of the input.

From my understanding, the current implementation of BERTViz allows for attention visualization on a per-token basis. I am looking for guidance on how to modify BERTViz to support the following:

  1. Selecting multiple tokens simultaneously.
  2. Summing the attention scores across these selected tokens.
  3. Visualizing the cumulative attention in the UI.

As an example, see the figure attached, the visualization shows the attention score for a single token ("What"), however, I would like to have the possibility to interactively select multiple tokens (e.g "Capital" and "France") and visualize the sum of the attention scores
image

If this feature is not already available, could you provide some pointers on how to implement this with minimal code changes? Any advice on where to start, which parts of the code to focus on, or a high-level approach would be greatly appreciated.

Thank you for your time and assistance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant