Search arXivSearch

arXiv · 2501.06662

The magnitude of categories of texts enriched by language models

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.

Explore related subjects

Keep this discovery

Explore connections, maps & timelines

BibTeXRIS

Tai-Danae Bradley, Juan Pablo Vigneaux. 2025-11-24. The magnitude of categories of texts enriched by language models. https://arxiv.org/abs/2501.06662

Cite the original work for its findings. Save a collection to share your selection of sources.

KEEP EXPLORING

Related papers

Hochschild cohomology of the second kind: Koszul duality and Morita invariance

We define Hochschild cohomology of the second kind for differential graded (dg) or curved algebras as a derived functor in the twisted derived category. The Hochschild cohomology of the second kind of a curved or curved algebra $A$ is then equivalent to the classical Hochschild cohomology of the twisted derived dg category of $A$, which is often geometrically meaningful. Examples include the category of $\infty$-local systems on a topological space, the bounded derived category of a complex manifold and the category of matrix factorizations. We also show that Hochschild cohomology of the second kind is preserved under (nonconilpotent) Koszul duality and weak equivalences of curved algebras. The main technical ingredient is a new bimodule version of Koszul duality.

math.CT

Localization of lax symmetric monoidal categories

In this note, we explain in some detail how one can fiberwise localize a (co)lax symmetric monoidal infinity-category. This construction was tacitly used in Section 5 of our recent paper "On the equivalence of the Lurie's infinity-operads and dendroidal infinity-operads". Version 2: A stronger version of the result is proven. Given a locally cocartesian fibration $f:X\to B$ and a collection of marked arrows $X^\circ\subset f^{-1}(B^{eq})$ in $X$ closed under locally cocartesian liftings, we prove that the localization $\mathcal{L}(X,X^\circ)\to B$ is also a locally cocartesian fibration whose fibers are localizations of the fibers of $f$. This result is applied to the description of localizations of lax symmetric monoidal categories.

math.CT

Cocompactness and Presentability

We give a short proof that $κ$-cocompact objects in a presentable category are subterminal. As our main result, we extend this to the setting of presentable $\infty$-categories. A consequence is that an $\infty$-category $\mathcal{C}$ such that both $\mathcal{C}$ and $\mathcal{C}^\mathsf{op}$ are presentable is a small complete lattice, extending a classical theorem of Gabriel-Ulmer. Along the way, we prove a nilpotence result for phantom maps in general pointed presentable $\infty$-categories. Additionally, we show that a strengthening of our main result is equivalent to the existence of a proper class of measurable cardinals.

math.CT