TensorX
返回文献探索

Paper · arXiv 2404.14994

Transformers Can Represent n-gram Language Models

Anej Svete, Ryan Cotterell

20 upvotesApril 23, 2024arXiv 预印本
AI 摘要

Transformer models using hard or sparse attention mechanisms can represent any $n$-gram model, providing insight into their probabilistic representational capacity.

transformer architecturelanguage modelsprobability distributions$n$-gram modelshard attentionsparse attention

Abstract

Plenty of existing work has analyzed the abilities of the transformer architecture by describing its representational capacity with formal models of computation. However, the focus so far has been on analyzing the architecture in terms of language acceptance. We contend that this is an ill-suited problem in the study of language models (LMs), which are definitionally probability distributions over strings. In this paper, we focus on the relationship between transformer LMs and n-gram LMs, a simple and historically relevant class of language models. We show that transformer LMs using the hard or sparse attention mechanisms can exactly represent any n-gram LM, giving us a concrete lower bound on their probabilistic representational capacity. This provides a first step towards understanding the mechanisms that transformer LMs can use to represent probability distributions over strings.

北京市昌平区探索星信息技术及软件开发工作室

京ICP备2026059466号
Transformers Can Represent n-gram Language Models | TensorX