HackerPapers

arXiv:2501.06662math.CT

The magnitude of categories of texts enriched by language models

Tai-Danae Bradley, Juan Pablo Vigneaux

Early discovery. Linked by one identifiable commenter. This paper is outside the main ranking; a mention is not an endorsement.

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.

arXiv comments
26 pages
Journal reference
Theory and Applications of Categories, Vol. 44, 2025, No. 37, pp 1256-1281
DOI
Subjects
math.CTCategory Theory cs.CLComputation and Language

On Hacker News

Linked by 1 identifiable commenter in 1 comment across 1 thread, from Feb 2025 to Feb 2025.

Comments linking this paper, per year.

Discussed in comments1 thread

    • That's right! This is secretly about doing calculus on posets. You can actually generalise some notions from incidence algebras to other settings, like groupoids and categories, where you can play the same games. This is something I mostly haven't looked at yet, but I think it…

      abelaerView on HNParent context

Submitted to Hacker News

Connected through shared HN threads, not inferred similarity or a recommendation.