Predicting Numerals in Text Using Nearest Neighbor Language Models

Taku Sakamoto, Akiko Aizawa


Abstract
Commonsense about quantitative properties is essential for a deep understanding of texts containing numerals. However, naive language models (LMs) treat numerals as string tokens; therefore, they lack an understanding of the magnitudes of numerals, resulting in a difficulty in acquiring the commonsense. In this study, we apply the k-nearest neighbor LM (kNN-LM) to the masked numeral prediction (MNP) task, which measures the quantitative commonsense of LMs.kNN-LM extends pre-trained neural LMs with the k-nearest neighbor (kNN) search.Since it can utilize patterns that appear in the datastore for prediction, we expect an improvement in numeral prediction accuracy, which is associated with a high rate of occurrence of out-of-vocabulary (OOV) words.Through experiments, we verified that the retrieval-based method is effective for fine-grained predictions of numerals from context, especially for the OOV numerals.We also compared two different context spans for context representations to improve the accuracy of kNN search by using only the words that are closely related to the masked numeral: the mask and its surrounding words, and the mask and its subsequent words.Our results reveal that using only the embeddings of mask tokens for numerals in kNN search is the most effective approach for realizing MNP tasks.
Anthology ID:
2023.findings-acl.295
Volume:
Findings of the Association for Computational Linguistics: ACL 2023
Month:
July
Year:
2023
Address:
Toronto, Canada
Editors:
Anna Rogers, Jordan Boyd-Graber, Naoaki Okazaki
Venue:
Findings
SIG:
Publisher:
Association for Computational Linguistics
Note:
Pages:
4795–4809
Language:
URL:
https://aclanthology.org/2023.findings-acl.295
DOI:
10.18653/v1/2023.findings-acl.295
Bibkey:
Cite (ACL):
Taku Sakamoto and Akiko Aizawa. 2023. Predicting Numerals in Text Using Nearest Neighbor Language Models. In Findings of the Association for Computational Linguistics: ACL 2023, pages 4795–4809, Toronto, Canada. Association for Computational Linguistics.
Cite (Informal):
Predicting Numerals in Text Using Nearest Neighbor Language Models (Sakamoto & Aizawa, Findings 2023)
Copy Citation:
PDF:
https://aclanthology.org/2023.findings-acl.295.pdf