Abstract
We give a general framework for inference in spanning tree models. We propose unified algorithms for the important cases of first-order expectations and second-order expectations in edge-factored, non-projective spanning-tree models. Our algorithms exploit a fundamental connection between gradients and expectations, which allows us to derive efficient algorithms. These algorithms are easy to implement with or without automatic differentiation software. We motivate the development of our framework with several cautionary tales of previous research, which has developed numerous inefficient algorithms for computing expectations and their gradients. We demonstrate how our framework efficiently computes several quantities with known algorithms, including the expected attachment score, entropy, and generalized expectation criteria. As a bonus, we give algorithms for quantities that are missing in the literature, including the KL divergence. In all cases, our approach matches the efficiency of existing algorithms and, in several cases, reduces the runtime complexity by a factor of the sentence length. We validate the implementation of our framework through runtime experiments. We find our algorithms are up to 15 and 9 times faster than previous algorithms for computing the Shannon entropy and the gradient of the generalized expectation objective, respectively.- Anthology ID:
- 2021.tacl-1.41
- Volume:
- Transactions of the Association for Computational Linguistics, Volume 9
- Month:
- Year:
- 2021
- Address:
- Cambridge, MA
- Editors:
- Brian Roark, Ani Nenkova
- Venue:
- TACL
- SIG:
- Publisher:
- MIT Press
- Note:
- Pages:
- 675–690
- Language:
- URL:
- https://aclanthology.org/2021.tacl-1.41
- DOI:
- 10.1162/tacl_a_00391
- Cite (ACL):
- Ran Zmigrod, Tim Vieira, and Ryan Cotterell. 2021. Efficient Computation of Expectations under Spanning Tree Distributions. Transactions of the Association for Computational Linguistics, 9:675–690.
- Cite (Informal):
- Efficient Computation of Expectations under Spanning Tree Distributions (Zmigrod et al., TACL 2021)
- PDF:
- https://preview.aclanthology.org/naacl24-info/2021.tacl-1.41.pdf