There is a problem sitting at the center of modern artificial intelligence that no amount of raw computation has resolved. You can hand a large language model a thousand examples of how to add numbers and a thousand examples of how to sort lists, and it will handle each task competently in isolation. But ask it to combine those operations in a way it has never quite seen before, and something wobbles. The model hesitates, conflates, or simply gets it wrong. For a system trained on more text than any human could read in a hundred lifetimes, this failure looks embarrassing. For the mathematicians who study how knowledge can be composed, it looks like a structural problem that more data and more parameters will not fix on their own.
In 1971, a mathematician named J. Peter May was working on a problem in algebraic topology that had nothing to do with computers. He wanted to understand the structure of spaces that can be looped around themselves repeatedly, and he needed a new algebraic object to keep track of how those loops compose. He called it an operad. For two decades the concept lived quietly inside a narrow corner of pure mathematics, useful for specialists and invisible to everyone else.
The quiet life ended when mathematicians began noticing that operads describe something far more universal than loop spaces. They describe, in precise formal terms, what it means to plug things together. Any collection of operations that can be combined according to consistent rules, where the output of one process feeds cleanly into the input of another and the connections carry declared types, turns out to be an algebra over some operad. This includes programming languages, database schemas, neural network architectures, and the memory pipelines of large AI models.
Consider a simplified version of the idea. Think about cooking. A chopping operation takes a vegetable and returns a chopped vegetable. A frying operation takes oil and a chopped vegetable and returns fried food. A plating operation takes fried food and a dish and returns a meal. Each operation has inputs and outputs of specific types, and the operations chain together because the output type of one matches the input type of the next. The abstract pattern of boxes and wires, with rules about which outputs may connect to which inputs and with the guarantee that combining two valid connections always produces another valid connection, is exactly what an operad formalizes.
Now scale that intuition up. A large language model is not a single computation. It is a chain of embedding layers, attention heads, feed-forward networks, normalization steps, and decoders, each producing typed outputs for the next stage. A retrieval-augmented generation pipeline is a wiring of a query encoder, an index searcher, a context formatter, and a generator. A mixture-of-experts architecture is a routing function that composes several specialist subnetworks. In every case the system has a hidden compositional structure, a grammar of combination that engineers built implicitly but never wrote down. The argument coming from a growing coalition of research groups is that writing it down explicitly, in the language of operads, is not an intellectual exercise. It is an engineering necessity.
The key refinement that makes this practical is the colored operad, also called a multicategory. The colors are types. A system designed with colored operads declares a vocabulary of interface types such as "token sequence," "embedding vector," "probability distribution," or "knowledge graph node," and then constrains which operations may connect to which. An architecture is valid if and only if every component respects its declared types and every composition of valid components is itself valid. This is not an exotic constraint. It is what every careful API designer tries to achieve. The operad makes it mathematically precise enough that automated tools can verify it, and that verification survives arbitrary composition depth.
Before getting into applications, it helps to understand exactly what is failing in current AI systems, because the failure is more specific and more serious than most coverage suggests. The technical name is compositional generalization, and it refers to a system's ability to handle combinations of things it already knows, even when those specific combinations have never appeared during training.
Human understanding is deeply compositional. Someone who knows the word "purple" and the concept of "jealousy" can immediately make sense of "purple jealousy," despite almost certainly never having encountered the phrase. A programmer who knows how to build a sorting function and how to build a web server can generally figure out how to build a web server that sorts its query results, without a dedicated tutorial on that specific combination. This flexibility is so fundamental to human reasoning that we rarely notice it. We assume it.
Current large language models fail this test in systematic ways. A series of papers published between 2022 and 2025, from groups at MIT, Stanford, and CMU among others, document consistent patterns: models trained on two distinct domains will frequently handle each domain correctly in isolation while getting confused when the two appear together in a genuinely novel combination. The failure is not random noise. It has a structure. The models are, in a meaningful sense, memorizing compositions rather than learning how to compose.
A theoretical analysis published at a major machine learning conference in 2025 made this precise. It showed that compositional generalization depends on a necessary and sufficient condition: the computational graph of the model must match the true compositional structure of the task it is trying to solve, and each component must encode exactly enough information about its piece of the problem. In plain language, the model's internal wiring diagram must match the wiring diagram of the world. When it does, the system generalizes. When it does not, the system interpolates poorly and breaks on combinations it has never seen.
Researchers at the Topos Institute in Berkeley, a nonprofit dedicated to applying category theory to computing and AI, have formalized this in a series of papers on dynamic operads: compositional structures whose algebra evolves as a system trains, but whose wiring rules stay constant. The key insight is that a model can learn an enormous amount and still generalize poorly if its wiring rules were never declared in the first place. No amount of additional training data specifies wiring rules that were never part of the architecture. The problem is not in the data. It is in the geometry.
Memory in AI systems is not a solved problem. This surprises people who have used modern large language models and found them impressively well-informed. The models have absorbed, in their billions of parameters, a compressed image of the text they trained on. But that parametric knowledge has two serious weaknesses. It is static: once training ends, the model cannot update what it knows without expensive retraining. And it conflates everything: specific facts, general reasoning patterns, and statistical correlations are all encoded in the same undifferentiated weight matrix, with no clean way to isolate or replace any particular piece.
The dominant workaround is retrieval-augmented generation, in which the model reaches out to an external index at query time, pulls back relevant passages, and incorporates them into its context before responding. Early retrieval pipelines were crude: retrieve the top passages by vector similarity, paste them in, and hope. Production deployments quickly discovered that this simple approach breaks in predictable ways. Retrieved passages can contradict each other. The model can ignore them and generate from its parametric memory anyway. Multi-step questions that require chaining several retrieval operations have no principled mechanism to support them.
The engineering response has been modular RAG: breaking the retrieval pipeline into explicit, independently tunable stages. A 2025 paper called MeVe decomposed the pipeline into five named phases: initial retrieval, relevance verification, fallback retrieval for queries where the first attempt fails, context prioritization to handle conflicting passages, and token budgeting to fit the result into the model's context window. Each phase is a typed operation. The output of one feeds into the input of the next. The overall system is an algebra over an operad of pipeline stages, even though the paper describes it entirely in engineering language without mentioning category theory. On a Wikipedia-heavy question-answering benchmark the modular decomposition cut context usage by 57 percent over standard RAG. On a multi-hop reasoning benchmark requiring chained retrieval, the reduction was 75 percent.
A parallel story is playing out in low-rank adapters. The technique known as LoRA lets practitioners fine-tune a frozen base model by training a compact correction to its weights, a thin layer of task-specific knowledge added without modifying the base. Because LoRA corrections are small and swappable, a single base model can host a library of hundreds of adapters encoding different domains. Microsoft Research published a system called Mixture of LoRA Experts that addressed this by learning gating functions to dynamically combine several adapters. A Chinese academic research group introduced RAMoLE, which treats the open-source ecosystem of community-trained adapters as a retrieval index, pulling in the most relevant ones at query time. Several 2025 papers extend the idea further, making routing differentiable end to end so gating and adapter parameters train jointly.
These systems collectively acknowledge a persistent failure they call subspace interference: adapters trained independently occupy different regions of the model's internal representation space, and naive combination lands the model in a region coherent for neither task. This is precisely what an operadic analysis predicts. Composition without explicit type constraints produces outputs whose meaning is not determined by the meanings of the parts. A 2025 research effort called MemOS proposed a full memory operating system for AI that treats all of these pieces as layers in a managed stack: parametric memory at the base, modular LoRA-style adapters in the middle, and explicit retrieval memory at the top. In doing so, the engineers behind MemOS are reinventing, from the demands of production AI, the same operadic structure that category theorists have been formalizing for decades.
A cross-section view of a glowing vertical stack representing the parametric, modular, and retrieval layers of a principled AI memory architecture. The structured light beams between layers encode the typed composition interfaces that operadic design makes explicit.
The most commercially proven application of operadic thinking in computing has nothing to do with neural networks. It is in data integration, and it has been running in production for nearly a decade.
Data integration is one of the most persistently painful problems in enterprise software. Organizations accumulate databases designed by different teams at different times using different assumptions about what counts as a customer, an account, or a transaction. Migrating data between schemas, or combining them into a unified view, requires translating not just the data but the structural assumptions baked into each design. Industry surveys put the failure rate for large-scale integration projects at 40 to 70 percent.
Conexus AI, a startup that grew out of research at MIT and Harvard, has been attacking this problem since around 2015 with a tool called the Categorical Query Language, or CQL. Its theoretical foundation is functorial data migration: a database schema is treated as a category, a database instance is a structure-preserving map from that schema to the universe of sets, and migrating data between schemas becomes finding the right such map between their categories. If it exists and satisfies the right properties, the migration automatically preserves all structural constraints declared in the source. CQL has been deployed in projects with the National Institute of Standards and Technology, the Defense Advanced Research Projects Agency, a major U.S. retirement-services provider, and the Stanford Chemistry Department. A joint paper with Uber applied algebraic property graph ideas to a graph database problem and contributed results back to Apache TinkerPop, the open-source graph computing framework.
The software engineering world has been absorbing similar ideas, mostly without realizing it. Functional programming languages like Haskell are built on monads, functors, and monoidal structures that sit in the same categorical family as operads. Dependent type systems, which underpin proof assistants like Lean and Coq, let composition of verified components automatically inherit both parties' correctness guarantees. A project connected to the DARPA V-SPELLS program formalized operads themselves inside the Coq proof assistant, so the system can verify that a proposed structure satisfies the operad axioms before any application code is written. For AI safety, this matters: if you design a pipeline using operads and formalize it in a proof assistant, you can get a machine-checked certificate that the composition rules are sound before any training begins.
The most accessible on-ramp for working engineers is the AlgebraicJulia ecosystem, centered at the University of Florida. Built in Julia, it includes Catlab.jl for categorical computation, AlgebraicDynamics.jl for composing dynamical systems using operads of wiring diagrams, and AlgebraicPetri.jl for distributed process models. On the Python side, DisCoPy and its companion library lambeq provide compositional infrastructure for natural language processing. Quantinuum, which grew out of quantum computing research at Oxford, has used these libraries to run compositional natural language processing experiments on trapped-ion quantum hardware, demonstrating that compositional semantics is not only theoretically sound but physically executable.
Across all of these applications the common thread is the same: composition that is declared explicitly and verified formally survives the stress of production. Composition that is implicit and unverified breaks in precisely the ways that data integration projects, LoRA adapter stacks, and retrieval pipelines have been breaking. The success stories are the ones where someone took the time to write down the wiring diagram.
Not everyone in AI research is convinced that operads are the right tool for the job. The objections are serious and deserve a fair hearing.
The first is empirical. After fifteen years of applied category theory work, the most successful applications are still in databases and software modeling, not in core machine learning. The compositional natural language processing work at Quantinuum is elegant but runs on small datasets that are not competitive with classical NLP benchmarks at any meaningful scale. The categorical reformulation of backpropagation, developed by researchers at Cambridge and subsequently extended to cover the full range of modern optimizers, is mathematically striking but has not produced a training algorithm that outperforms Adam in practice. The skeptics' question is simple: where is the benchmark win?
The second objection is architectural. Current large language models are not designed to be compositionally clean. They are dense, nonlinear systems where every parameter interacts with every other during training. Retrofitting operadic structure from the outside through routing functions, adapter libraries, and modular pipelines is, as one researcher at a major AI lab put it, like adding grammatically correct signage to a building that was never designed around the rooms those signs describe. The underlying composition still happens in a space that does not respect the declared types. Fully resolving this may require designing new architectures from scratch with operadic structure in place from the first layer, a much harder research program than any major lab is currently publicly committed to.
The third objection is sociological. Category theory is notoriously demanding. The notation is unfamiliar, the learning curve is steep, and the culture of the field has historically prized abstract generality over rapid application. Engineers building AI products at scale do not have time to learn monoidal double categories. If the categorical approach requires a fundamental change in how they think about software architecture, the adoption barrier may simply be too high regardless of the theoretical merits.
The middle position, which senior researchers at the Topos Institute and the applied category theory groups at Oxford and Cambridge have articulated publicly, is that the right role for operadic thinking in the near term is as a specification language rather than a replacement architecture. You do not need to redesign the transformer from scratch. You need to be explicit about the compositional structure of the systems built around it: the retrieval pipelines, the adapter libraries, the routing functions, the memory layers. Making that structure explicit lets you derive formal guarantees, deploy automated verification tools, and reason about failure modes before deployment. It is a modest claim. It may also be the one that is actually true.
The deepest question here is not really about operads. It is about what kind of knowledge a machine is allowed to have. The scaling paradigm treats knowledge as a substance that accumulates by making models bigger and feeding them more data. It lives in the weights, distributed across billions of parameters in a form that is not decomposable, not inspectable, and not updatable without expensive retraining. The operadic paradigm treats knowledge as a structure: a set of typed components and a set of rules for combining them. Knowledge grows by adding new components and new composition rules, not by enlarging a homogeneous weight mass. Any piece can be identified, inspected, updated, or replaced without disturbing the others, as long as it exposes the right typed interface.
The question the next decade of AI research will settle is whether neural networks can be made operadically principled without sacrificing the perceptual and generative power that makes them valuable. The early signals from modular RAG, from mixture-of-LoRA-experts systems, and from compositional NLP are cautiously encouraging. The failures of compositional generalization in current systems are sharp enough that no one is predicting scale alone will fix them. The mathematical framework has been road-tested for fifty years across a dozen disciplines and has survived every test. The engineering and the mathematics are converging on the same set of problems from opposite directions.
At the Topos Institute, at Oxford and Cambridge, at the University of Florida, and inside a handful of startups and research labs scattered across Europe and North America, a community of several hundred researchers is betting that this convergence is not accidental. They are betting that the next significant advance in artificial intelligence will come not from adding more parameters but from writing down, carefully and explicitly, the grammar of how the pieces fit together. That grammar has a name. It is fifty years old. And it is far from done revealing what it knows.
This article draws on published research from the Topos Institute, Conexus AI, Quantinuum, AlgebraicJulia, Microsoft Research, and academic groups at MIT, Stanford, CMU, Oxford, Cambridge, and the University of Florida, as well as papers and preprints published between 2013 and 2026 on applied category theory, modular AI architectures, and compositional generalization. Key works include: May, J.P., The Geometry of Iterated Loop Spaces, Springer, 1972. Spivak, D., "The operad of wiring diagrams," arXiv, 2013. Fong, B. and Spivak, D., An Invitation to Applied Category Theory, Cambridge University Press, 2019. Topos Institute, "Dynamic categories, dynamic operads," 2022. MeVe modular RAG framework, arXiv, 2025. MemOS memory operating system, arXiv, 2025. Mixture of LoRA Experts, Microsoft Research, arXiv, 2024. Categorical Query Language documentation, Conexus AI, conexus.com. AlgebraicJulia ecosystem, University of Florida, algebraicjulia.org. Applied Category Theory Conference proceedings, 2018–2025.
Daice Labs Inc.
Brookline, MA, USA
Roll the "daice"–exploration & programmable adaptation.