Skip to content
Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


Code for ACL 2019 paper (oral): Searching for Effective Neural Extractive Summarization: What Works and What's Next

If you use our code or data, please cite our paper:

  title={Searching for Effective Neural Extractive Summarization: What Works and What’s Next},
  author={Zhong, Ming and Liu, Pengfei and Wang, Danqing and Qiu, Xipeng and Huang, Xuan-Jing},
  booktitle={Proceedings of the 57th Conference of the Association for Computational Linguistics},


  • Python 3.7
  • PyTorch 1.1.0
  • gensim
  • cytoolz
  • tensorboardX
  • pyrouge
  • pytorch-pretrained-bert 0.6.1
    • now is pytorch-transformers, you can use pip to install pytorch-pretrained-bert (0.6.1)
    • You should download the BERT model(bert-large-uncased) and convert it to a pytorch version, get a folder called uncased_L-24_H-1024_A-16

All code only supports running on Linux.


We have already processed CNN/DailyMail dataset, you can download it through this link, unzip and store it in the current path (contrains train, val, test, refs, word2vec folders and vocab_cnt.pkl, you should put them in ./CNNDM)


You should fill in the three paths in the files before running the code.

  1. path to RELEASE-1.5.5 ( line 14), example: /home/ROUGE/RELEASE-1.5.5
  2. path to vocab.txt ( line 67 and data/ line 13), example: /home/pretrain_model/uncased_L-24_H-1024_A-16/vocab.txt
  3. path to BERT model (model/ line 255), example: /home/pretrain_model/uncased_L-24_H-1024_A-16


We currently provide a variety of options to combine into a model. For the encoder, we provide BiLSTM/Transformer/DeepLSTM. For the decoder, we provide Sequence Labeling/Pointer Network. For the type of word embedding, we provide Word2Vec/BERT. We only tested the code on the GPU, and we strongly recommend using the GPU to train your model because of the long training time.

To run BiLSTM + Pointer Network + Word2Vec model, run

CUDA_VISIBLE_DEVICES=0 python --mode=train --encoder=BiLSTM --decoder=PN --emb_type=W2V

To run Transformer + Sequence Labeling + Word2Vec model, run

CUDA_VISIBLE_DEVICES=0 python --mode=train --encoder=Transformer --decoder=SL --emb_type=W2V

To run DeepLSTM + Pointer Network + BERT model (models with BERT have a long training time), run

CUDA_VISIBLE_DEVICES=0 python --mode=train --encoder=DeepLSTM --decoder=PN --emb_type=BERT

You can try any other combination to train your own model.


After completing the training process, you can test the five best models and obtain ROUGE score by the following instructions. You only need to switch mode to test, leaving other commands unchanged.

For example, when you test BiLSTM + Pointer Network + Word2Vec model, run

CUDA_VISIBLE_DEVICES=0 python --mode=test --encoder=BiLSTM --decoder=PN --emb_type=W2V

The results will be printed on the screen and saved in the BiLSTM_PN_W2V folder.


You can find the outputs produced by our different models in this paper on CNN/DailyMail through this link.


  1. Part of our code uses the the implementation of fast_abs_rl and Transformer. Thanks for their work!
  2. For the code of reinforcement learning, we use the implementation in fast_abs_rl. The only difference is that we changed the parameter reward in their file to ROUGE-1-precision and the parameter stop to 8.5. If you are interested in the implementation of this part, please directly refer to their code.


Code for ACL 2019 paper: "Searching for Effective Neural Extractive Summarization: What Works and What's Next"






No releases published


No packages published