The magnitude of categories of texts enriched by language models

Fuente: arXiv
Enregistré dans:
Détails bibliographiques
Auteurs principaux: Bradley, Tai-Danae, Vigneaux, Juan Pablo
Format: Preprint
Publié: 2025
Sujets:
Accès en ligne:
Tags: Ajouter un tag
Pas de tags, Soyez le premier à ajouter un tag!
_version_ 1866914169536643072
author Bradley, Tai-Danae
Vigneaux, Juan Pablo
author_facet Bradley, Tai-Danae
Vigneaux, Juan Pablo
contents The purpose of this article is twofold. Firstly, we use the next-token probabilities given by a language model to explicitly define a category of texts in natural language enriched over the unit interval, in the sense of Bradley, Terilla, and Vlassopoulos. We consider explicitly the terminating conditions for text generation and determine when the enrichment itself can be interpreted as a probability over texts. Secondly, we compute the Möbius function and the magnitude of an associated generalized metric space of texts. The magnitude function of that space is a sum over texts (prompts) of the $t$-logarithmic (Tsallis) entropies of the next-token probability distributions associated with each prompt, plus the cardinality of the model's possible outputs. A suitable evaluation of the magnitude function's derivative recovers a sum of Shannon entropies, which justifies seeing magnitude as a partition function. Following Leinster and Shulman, we also express the magnitude function of the generalized metric space as an Euler characteristic of magnitude homology and provide an explicit description of the zeroeth and first magnitude homology groups.
format Preprint
id arxiv_https___arxiv_org_abs_2501_06662
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle The magnitude of categories of texts enriched by language models
Bradley, Tai-Danae
Vigneaux, Juan Pablo
Category Theory
Computation and Language
18D20, 68T50, 94A17
I.2.7; G.3
The purpose of this article is twofold. Firstly, we use the next-token probabilities given by a language model to explicitly define a category of texts in natural language enriched over the unit interval, in the sense of Bradley, Terilla, and Vlassopoulos. We consider explicitly the terminating conditions for text generation and determine when the enrichment itself can be interpreted as a probability over texts. Secondly, we compute the Möbius function and the magnitude of an associated generalized metric space of texts. The magnitude function of that space is a sum over texts (prompts) of the $t$-logarithmic (Tsallis) entropies of the next-token probability distributions associated with each prompt, plus the cardinality of the model's possible outputs. A suitable evaluation of the magnitude function's derivative recovers a sum of Shannon entropies, which justifies seeing magnitude as a partition function. Following Leinster and Shulman, we also express the magnitude function of the generalized metric space as an Euler characteristic of magnitude homology and provide an explicit description of the zeroeth and first magnitude homology groups.
title The magnitude of categories of texts enriched by language models
topic Category Theory
Computation and Language
18D20, 68T50, 94A17
I.2.7; G.3
url https://arxiv.org/abs/2501.06662