Approximating CKY with Transformers

Ghazal Khalighinejad, Ollie Liu, Sam Wiseman
5/3/2023
cs.CLcs.LG

No official code found. Best implementation: ghazalkhalighinejad/approximating-cky (8 stars, MIT, last commit 2023-10-31).

Abstract

We investigate the ability of transformer models to approximate the CKY algorithm, using them to directly predict a sentence's parse and thus avoid the CKY algorithm's cubic dependence on sentence length. We find that on standard constituency parsing benchmarks this approach achieves competitive or better performance than comparable parsers that make use of CKY, while being faster. We also evaluate the viability of this approach for parsing under \textit{random} PCFGs. Here we find that performance declines as the grammar becomes more ambiguous, suggesting that the transformer is not fully capturing the CKY computation. However, we also find that incorporating additional inductive bias is helpful, and we propose a novel approach that makes use of gradients with respect to chart representations in predicting the parse, in analogy with the CKY algorithm being a subgradient of a partition function variant with respect to the chart.

View on arXivView PDF

Code Implementations(1)

MIT

The official repository for "Approximating CKY with Transformers"

80PythonMay 2, 20232 years agoMIT

Similar Papers

Cite this paper

@article{khalighinejad2023approximating,
  title  = {Approximating CKY with Transformers},
  author = {Ghazal Khalighinejad and Ollie Liu and Sam Wiseman},
  year   = {2023},
  eprint = {2305.02386},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2305.02386v2}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2305.02386.svg)](https://codeofpaper.com/paper/2305.02386)

Discussion