Approximating CKY with Transformers

Ghazal Khalighinejad, Ollie Liu, Sam Wiseman


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 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.
Anthology ID:
2023.findings-emnlp.934
Volume:
Findings of the Association for Computational Linguistics: EMNLP 2023
Month:
December
Year:
2023
Address:
Singapore
Editors:
Houda Bouamor, Juan Pino, Kalika Bali
Venue:
Findings
SIG:
Publisher:
Association for Computational Linguistics
Note:
Pages:
14016–14030
Language:
URL:
https://aclanthology.org/2023.findings-emnlp.934
DOI:
10.18653/v1/2023.findings-emnlp.934
Bibkey:
Cite (ACL):
Ghazal Khalighinejad, Ollie Liu, and Sam Wiseman. 2023. Approximating CKY with Transformers. In Findings of the Association for Computational Linguistics: EMNLP 2023, pages 14016–14030, Singapore. Association for Computational Linguistics.
Cite (Informal):
Approximating CKY with Transformers (Khalighinejad et al., Findings 2023)
Copy Citation:
PDF:
https://aclanthology.org/2023.findings-emnlp.934.pdf