Token Alignment via Character Matching for Subword Completion

Ben Athiwaratkun, Shiqi Wang, Mingyue Shang, Yuchen Tian, Zijian Wang +5 more
3/13/2024
cs.CLcs.AI

No official code found. Best implementation: amazon-science/tokenalign (7 stars, last commit 2024-08-05).

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 autocompletion.

View on arXivView PDF

Code Implementations(1)

Token Alignment via Character Matching for Subword Completion (ACL Findings 2024)

71PHP, JavaAug 5, 20242 years agoNOASSERTION
llmllm-inference

Cite this paper

@article{athiwaratkun2024token,
  title  = {Token Alignment via Character Matching for Subword Completion},
  author = {Ben Athiwaratkun and Shiqi Wang and Mingyue Shang and Yuchen Tian and Zijian Wang and Sujan Kumar Gonugondla and Sanjay Krishna Gouda and Rob Kwiatowski and Ramesh Nallapati and Bing Xiang},
  year   = {2024},
  eprint = {2403.08688},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2403.08688v1}
}

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/2403.08688.svg)](https://codeofpaper.com/paper/2403.08688)

Discussion