What do tokens know about their characters and how do they know it?

Ayush Kaushal, Kyle Mahowald
6/6/2022
cs.CL

Official code: Ayushk4/character-probing-pytorch (4 stars, Python, last commit 2022-05-03).

Abstract

Pre-trained language models (PLMs) that use subword tokenization schemes can succeed at a variety of language tasks that require character-level information, despite lacking explicit access to the character composition of tokens. Here, studying a range of models (e.g., GPT- J, BERT, RoBERTa, GloVe), we probe what word pieces encode about character-level information by training classifiers to predict the presence or absence of a particular alphabetical character in a token, based on its embedding (e.g., probing whether the model embedding for "cat" encodes that it contains the character "a").

Show full abstract

We find that these models robustly encode character-level information and, in general, larger models perform better at the task. We show that these results generalize to characters from non-Latin alphabets (Arabic, Devanagari, and Cyrillic). Then, through a series of experiments and analyses, we investigate the mechanisms through which PLMs acquire English-language character information during training and argue that this knowledge is acquired through multiple phenomena, including a systematic relationship between particular characters and particular parts of speech, as well as natural variability in the tokenization of related strings.

View on arXivView PDF

Code Implementations(1)

NAACL 2022, What do tokens know about their characters and how do they know it?

40PythonMay 3, 20224 years ago

Similar Papers

Cite this paper

@article{kaushal2022what,
  title  = {What do tokens know about their characters and how do they know it?},
  author = {Ayush Kaushal and Kyle Mahowald},
  year   = {2022},
  eprint = {2206.02608},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2206.02608}
}

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

Discussion