Exploiting Compositionality in Sequence Models