This agent is a (partial) implementation of the DrQA Document Reader from:

Danqi Chen, Adam Fisch, Jason Weston, Antoine Bordes. 2017. Reading Wikipedia to Answer Open-Domain Questions. In Association for Computational Linguistics (ACL).

Read more about DrQA here.

Basic Examples

Train a DrQA model on SQuAD.

python projects/drqa/train.py

Evaluate a pre-trained model on SQuAD.

python projects/drqa/eval_pretrained.py

DrqaAgent Options

DrQA Arguments


Default: False.


Default: -1.


Default: 1013.


File of space separated embeddings: w e1 … ed


Load dict/features/weights/opts from this file



Default: True.


Train the K most frequent word embeddings

Default: 0.


Default embedding size if embedding_file is not given

Default: 300.


Hidden size of RNN units

Default: 128.


Number of RNN layers for passage

Default: 3.


Number of RNN layers for question

Default: 3.


RNN type: lstm (default), gru, or rnn

Default: lstm.


Metric for choosing best valid model

Choices: accuracy, f1.

Default: f1.


The max span allowed during decoding

Default: 15.


Default: False.


Print train error after every<display_iter> epoches (default 10)

Default: 10.


Dropout rate for word embeddings

Default: 0.4.


Dropout rate for RNN states

Default: 0.4.


Whether to dropout the RNN output

Default: True.


Optimizer: sgd or adamax (default)

Default: adamax.

--learning-rate, -lr

Learning rate for SGD (default 0.1)

Default: 0.1.


Gradient clipping (default 10.0)

Default: 10.


Weight decay (default 0)

Default: 0.


Momentum (default 0)

Default: 0.


When given paragraphs (separated by

) will take only a subset of them, including the one with the answer for training.

Default: 0.


Default: True.


The way of computing question representation

Default: self_attn.


Whether to use weighted question embeddings

Default: True.


Whether to use in_question features

Default: True.


Whether to use tf features

Default: True.


Time features marking how recent word was said

Default: 0.

Dictionary Arguments


Use only words found in provided embedding_file

Default: True.

SimpleDictionaryAgent Options

Dictionary Arguments


Use only words found in provided embedding_file

Default: True.