The magnitude of categories of texts enriched by language models

Tai-Danae Bradley, Juan Pablo Vigneaux
1/11/2025
math.CTcs.CL

No confident code implementation found for this paper.

Abstract

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.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{bradley2025magnitude,
  title  = {The magnitude of categories of texts enriched by language models},
  author = {Tai-Danae Bradley and Juan Pablo Vigneaux},
  year   = {2025},
  eprint = {2501.06662},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2501.06662v2}
}

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

Discussion