Bidirectional Long-Short Term Memory tagger (bi-LSTM) (in DyNet) -- hierarchical (with word and character embeddings)
Python Shell
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.

bi-LSTM tagger

Bidirectional Long-Short Term Memory tagger

If you use this tagger please cite our paper:



Download and install dynet in a directory of your choice DYNETDIR:

git clone

Follow the instructions in the Dynet documentation (use -DPYTHON, see

And compile dynet:

cmake .. -DEIGEN3_INCLUDE_DIR=$HOME/tools/eigen/ -DPYTHON=`which python`

(if you have a GPU, use: [note: non-deterministic behavior]):

cmake .. -DEIGEN3_INCLUDE_DIR=$HOME/tools/eigen/ -DPYTHON=`which python` -DBACKEND=cuda

After successful installation open python and import dynet, you can test if the installation worked with:

>>> import dynet
[dynet] random seed: 2809331847
[dynet] allocating memory: 512MB
[dynet] memory allocation done.
>>> dynet.__version__

(You may need to set you PYTHONPATH to include Dynet's build/python)

DyNet supports python 3

The old bilstm-aux had a patch to work with python 3. This is no longer necessary, as DyNet supports python 3 as of

Example command

Training the tagger:

python src/ --dynet-mem 1500 --train data/da-ud-train.conllu --dev data/da-ud-dev.conllu --test data/da-ud-test.conllu --iters 10 --pred_layer 1 --save model

Training and saving in two steps (--save for storing and --model for loading):

python src/ --dynet-mem 1500 --train data/da-ud-train.conllu --iters 10 --pred_layer 1 --save model

python src/ --pred_layer 1 --model model --test data/da-ud-test.conllu --output predictions/test-da.out


The Polyglot embeddings (Al-Rfou et al., 2013) can be downloaded from here (0.6GB)


You can see the options by running:

python src/ --help

A great option is DyNet autobatching (Neubig et al., 2017). It speeds up training considerably ( ~20%). You can activate it with:

python src/ --dynet-autobatch 1

A couple of remarks

The choice of 22 languages from UD1.2 (rather than 33) is described in our TACL parsing paper, Section 3.1. (Agić et al., 2016). Note, however, that the bi-LSTM tagger does not require large amounts of training data (as discussed in our ACL 2016 paper).

The bilty code is a significantly refactored version of the code originally used in the paper. For example, bilty supports multi-task learning with output layers at different layers (--pred_layer), as well as stacked LSTMs (see e.g., Ballesteros et al., 2015, Dyer et al., 2015).

DyNet 2.0 switched the default LSTM implementation to VanillaLSTMBuilder. We observe slightly higher POS tagging results with the earlier CoupledLSTMBuilder, which is the current default.


  title={{Multilingual Part-of-Speech Tagging with Bidirectional Long Short-Term Memory Models and Auxiliary Loss}},
  author={Plank, Barbara and S{\o}gaard, Anders and Goldberg, Yoav},
  booktitle={ACL 2016, arXiv preprint arXiv:1604.05529},