Token Alignment via Character Matching for Subword Completion
Ben Athiwaratkun, Shiqi Wang, Mingyue Shang, Yuchen Tian, Zijian Wang, Sujan Kumar Gonugondla, Sanjay Krishna Gouda, Robert Kwiatkowski
Abstract
Generative models, widely utilized in various applications, can often struggle with prompts corresponding to partial tokens. This struggle stems from tokenization, where partial tokens fall out of distribution during inference, leading to incorrect or nonsensical outputs. This paper examines a technique to alleviate the tokenization artifact on text completion in generative models, maintaining performance even in regular non-subword cases. The method, termed token alignment, involves backtracking to the last complete tokens and ensuring the model’s generation aligns with the prompt. This approach showcases marked improvement across many partial token scenarios, including nuanced cases like space-prefix and partial indentation, with only a minor time increase. The technique and analysis detailed in this paper contribute to the continuous advancement of generative models in handling partial inputs, bearing relevance for applications like code completion and text.
BibTeX
@inproceedings{athiwaratkun-etal-2024-token,
title = "Token Alignment via Character Matching for Subword Completion",
author = "Athiwaratkun, Ben and
Wang, Shiqi and
Shang, Mingyue and
Tian, Yuchen and
Wang, Zijian and
Gonugondla, Sujan Kumar and
Gouda, Sanjay Krishna and
Kwiatkowski, Robert and
Nallapati, Ramesh and
Bhatia, Parminder and
Xiang, Bing",
editor = "Ku, Lun-Wei and
Martins, Andre and
Srikumar, Vivek",
booktitle = "Findings of the Association for Computational Linguistics: ACL 2024",
month = aug,
year = "2024",
address = "Bangkok, Thailand",
publisher = "Association for Computational Linguistics",
url = "https://aclanthology.org/2024.findings-acl.929/",
doi = "10.18653/v1/2024.findings-acl.929",
pages = "15725--15738"
}