Skip to content

Pytorch implementation for ACL 2020 Paper: "Evaluating and Enhancing the Robustness of Neural Network-based Dependency Parsing Models with Adversarial Examples"

Notifications You must be signed in to change notification settings

zjiehang/DPAttack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

83 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DPAttack

TODO: Code refactoring

Pytorch implementation for ACL 2020 Paper: "Evaluating and Enhancing the Robustness of Neural Network-based Dependency Parsing Models with Adversarial Examples", URL.

You may cite our paper by:

@inproceedings{zheng-etal-2020-evaluating,
    title = "Evaluating and Enhancing the Robustness of Neural Network-based Dependency Parsing Models with Adversarial Examples",
    author = "Zheng, Xiaoqing  and
      Zeng, Jiehang  and
      Zhou, Yi  and
      Hsieh, Cho-Jui  and
      Cheng, Minhao  and
      Huang, Xuanjing",
    booktitle = "Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics",
    year = "2020",
    publisher = "Association for Computational Linguistics"
}

Requirements:

Python: 3.7

PyTorch: 1.4.0

Usage

Train

$ python run.py -mode=train -conf=config.ini

You can configure the model in config.ini

Evaluate

$ python run.py -mode=evaluate -conf=config.ini

Attack

Blackbox

$ python run.py -mode=attack_type -conf=config.ini

where attack_type includes blackbox, blackbox_phrase, whitebox_phrase

blackbox: black-box on sentence-level attack

blackbox_phrase: black-box on phrase-level attack

whitebox_phrase: white-box on phrase-level attack

Whitebox

$ python run_whitebox.py -mode=hackwhole|hackchar|hacksubtree

where hackwhole denotes attack a parser at word level, hackchar denotes attack a parser at char level, and hacksubtree denotes attack a subtree in a parser by modifying another one.

The settings for attacking can be found in run_whitebox.py, some basic configuration for the parser can be found in config.ini. If there exists some conflictions, the config in *.py will override that in *.ini.

Acknowledgement

The implementation is based on yzhangcs's code in biaffine-parser. Thanks for his implementation of "Deep Biaffine Attention for Neural Dependency Parsing".

The nlpaug library is based on makcedward's libary in nlpaug, a python library for data augmentation in NLP. Thanks for their awesome library.

About

Pytorch implementation for ACL 2020 Paper: "Evaluating and Enhancing the Robustness of Neural Network-based Dependency Parsing Models with Adversarial Examples"

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages