Code Monkey home page Code Monkey logo

attentionguidance's Introduction

Attention Guidance: Guiding Attention for Self-Supervised Learning with Transformers

This repository contains code for Guiding Attention for Self-Supervised Learning with Transformers. [Paper][arXiv]

Paper in a nutshell

Recent studies have shown that bi-directional language models exhibit simple patterns of self-attention. Some examples of such patterns are, paying attention to the previous or next token, paying attention to the first token, and paying attention to delimiters. We show that inducing such patterns by adding an auxiliary loss (AG loss) improves convergence speed, robustness to different hyperparameters, and downstream performance. The gains are particularly high for low-resource languages. More details are in the paper!

Attention patterns of our model (left) and the default RoBERTa model (right) after 0% (top), 1% (middle) and 100% (bottom) of pre-training.

Installation instructions

Please follow the instructions in respective sub-folders, e.g., attention_guidance, linguistic_probing.

Code structure

  1. attention_guidance - Code for running language modeling using attention guidance.
  2. linguistic_probing - Code for running coreference analysis from section 5.3 of the paper.

Citation

Paper accepted at Findings of EMNLP 2020 Please use the citation below till the official one appears!

@misc{deshpande2020guiding,
      title={Guiding Attention for Self-Supervised Learning with Transformers}, 
      author={Ameet Deshpande and Karthik Narasimhan},
      year={2020},
      eprint={2010.02399},
      archivePrefix={arXiv},
      primaryClass={cs.CL}
}

Contact

Ameet Deshpande (@ameet-1997) Email: [email protected]

attentionguidance's People

Contributors

ameet-1997 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.