Operads for compositional reasoning in LLMs


Abstract

Question decomposition, i.e. breaking a complex query into simpler sub-queries whose answers are composed to produce a final answer, is a widely used strategy for improving LLM reasoning, yet it currently lacks a rigorous mathematical foundation. In this paper, we propose operads, mathematical structures that model many-in, one-out operations and compositions thereof, as a natural framework for describing question decomposition. We define the questions operad \(\mathcal{Q}\), in which operations correspond to question templates and composition corresponds to substitution of sub-answers, and show how QA models can be interpreted as algebras over \(\mathcal{Q}\). Beyond reframing existing practice, this operadic perspective points toward new methods, in particular a notion of operadic consistency, which measures whether a QA model’s answers agree across the partial collapses of a question decomposition tree. Empirical evaluation of operadic consistency is reported in our companion paper (Bottman, Liu, and Richardson, 2026), which finds it strongly correlated with accuracy across twelve LLMs and four multi-hop QA datasets and outperforming standard temperature-based self-consistency baselines. We argue that operads are the natural mathematical home for question decomposition, and that invariants such as operadic consistency open new directions for analyzing and improving the reliability of multi-step reasoning.

1 Question decomposition in practice↩︎

Large Language Models (LLMs) have demonstrated remarkable reasoning capabilities, particularly when prompted to break problems down into intermediate steps. Such an idea was first popularized in work on chain-of-thought prompting [1] and its many subsequent extensions [2][6]. In practice, this process involves transforming a complex query into simpler sub-queries whose answers are sequentially composed to derive a final solution — for instance, answering How long was it between when the Titanic hit the iceberg and when it sank completely?by first resolving the timestamps of the collision and the sinking.

Despite its intuitive appeal and widespread adoption, question decomposition currently lacks a rigorous mathematical foundation. This matters: without a formal account of composition structure, it is difficult to define what it means for a decomposition to be correct or well-formed, to reason about how errors propagate through a chain of sub-queries, or to compare decomposition strategies in a principled way — all independently of any particular model implementation.

In this paper, we propose operads as the right mathematical framework for this problem. Operads were introduced by mathematicians to study systems built by iterated substitution — how many-input operations compose coherently into larger operations — and they provide a compact language for tree-shaped composition. In our setting, operations correspond to question templates with blanks, and composites correspond to decompositions into sub-queries. Relatedly, [7] have applied operadic and associahedral structures to model syntactic Merge and the syntax-semantics interface in generative linguistics, further supporting the view that operads are a natural framework for compositional structure in language. Beyond developing the formalism, we point to our companion paper [8] for an empirical evaluation of operadic consistency across twelve LLMs and four multi-hop QA datasets.

2 Operads↩︎

Operads are structures for organizing collections of “morphisms”, i.e.operations that take \(k\geq0\) inputs and return one output. They are closely related to categories, which are better-known objects that organize one-in, one-out operations.

In this section, we will introduce the reader to operads, and then explain how question decomposition and chain-of-thought can be described in terms of the questions operad. We assume no prior knowledge of category theory or operads, and prioritize accessibility. Throughout, the objects we call “operads” are, more precisely, “non-symmetric non-unital operads in \(\textsf{Set}\)”.

2.1 Operads in mathematics↩︎

We begin this section with a concise explanation of the notion of an operad. There are few approachable references; we suggest the curious reader consult Markl–Shnider–Stasheff’s Operads in Algebra, Topology and Physics [9], and Loday–Vallette’s Algebraic Operads [10].

Operads model properties of many-in, one-out morphisms. One feature that such morphisms have is that we can compose them. Indeed, consider mappings \(f\) and \(g\), which take \(k\) and \(\ell\) inputs, respectively. For any \(1 \leq i \leq k\), we can form the composition \[\begin{align} \label{eq:function95composition} f\Bigl(\underbrace{-,\ldots,-}_{i-1},g\Bigl(\underbrace{-,\ldots,-}_\ell\Bigr),\underbrace{-,\ldots,-}_{k-i}\Bigr), \end{align}\tag{1}\] i.e.the result of feeding the output of \(g\) into the \(i\)-th input slot of \(f\). The result is a mapping that takes \(k+\ell-1\) inputs, which we denote \(f\circ_ig\). Iterated compositions are unambiguous — for instance, when we write the expression \[\begin{align} \label{eq:classical95assoc} f(\ldots,g(\ldots,h(\ldots),\ldots),\ldots), \end{align}\tag{2}\] the meaning is independent of whether we first compose \(f\) with \(g\) and then feed in \(h\), or first compose \(g\) with \(h\) and then feed the result into \(f\).

These observations lead us to the definition of an operad.

Definition 1. A (non-unital) operad \(\mathcal{O}\) is the following data:

  • A collection \(\mathcal{O}(0), \mathcal{O}(1), \mathcal{O}(2), \ldots\) of sets. (Elements of \(\mathcal{O}(k)\) are thought of as arity-\(k\) morphisms, i.e.operations with \(k\) inputs and one output.)

  • For every \(k, \ell \geq 0\) and \(1 \leq i \leq k\), a “composition map” \(\circ_i\colon \mathcal{O}(k) \times \mathcal{O}(\ell) \to \mathcal{O}(k+\ell-1)\). (When \(\mathcal{O}\) is literally a collection of morphisms, and we are given \(f \in \mathcal{O}(k)\) and \(g \in \mathcal{O}(\ell)\), \(f \circ_i g\) is obtained by plugging the output of \(g\) into the \(i\)-th input slot of \(f\). The result is a \((k+\ell-1)\)-ary operation.)

These data must satisfy the following conditions:

  • Composition is sequentially associative. That is, for every \(k, \ell, m \geq 0\), \(f \in \mathcal{O}(k), g\in\mathcal{O}(\ell), h\in\mathcal{O}(m)\), and \(1 \leq i \leq k\), \(1 \leq j \leq \ell\), the compositions \[\begin{align} f \circ_i (g \circ_j h), \quad (f \circ_i g) \circ_{i+j-1} h \end{align}\] agree. (Compare 2 .)

  • Composition into disjoint slots commutes (parallel associativity). For \(f \in \mathcal{O}(k)\), \(g \in \mathcal{O}(\ell)\), \(h \in \mathcal{O}(m)\), and \(1 \leq i < j \leq k\), the compositions \[\begin{align} (f \circ_i g) \circ_{j+\ell-1} h, \quad (f \circ_j h) \circ_i g \end{align}\] agree. (The shifted index \(j+\ell-1\) accounts for \(g\)’s \(\ell\) blanks displacing the \(j\)-th slot of \(f\).) \(\triangle\)

In the rest of the subsection, we describe two operads with connections to classical computer science and formal language theory.

Example 1. Given an alphabet \(\Sigma\), we can form the set \(\Sigma^*\) of finite strings over \(\Sigma\). We define the text processing operad over \(\Sigma\), denoted \(\mathcal{F}_\Sigma\), like so:

  • \(\mathcal{F}_\Sigma(k)\) is the set of all mappings from \((\Sigma^*)^k\) to \(\Sigma^*\), i.e.all mappings that take \(k\) inputs, all lying in \(\Sigma^*\), and return one element of \(\Sigma^*\).

  • Composition is ordinary composition of mappings, as in 1 .

For instance, \(\mathcal{F}_\Sigma(0)\) can be identified with \(\Sigma^*\) itself; \(\mathcal{F}_\Sigma(1)\) contains the operator sending a string to its all-caps version; \(\mathcal{F}_\Sigma(2)\) contains the binary concatenation operator \((x,y)\mapsto xy\); and \(\mathcal{F}_\Sigma(3)\) contains ternary operations such as the map sending \((x,y,z)\) to the string obtained by joining \(x\), \(y\), and \(z\) with the separator “\(\mathtt{,}\)”. Let \(f\) and \(g\) denote the binary and ternary operators just introduced, respectively. Then \(f \circ_1 g\) (i.e., \(f\) with \(g\) plugged into its first input slot) and \(f \circ_2 g\) (i.e., \(f\) with \(g\) plugged into its second input slot) are distinct elements of \(\mathcal{F}_\Sigma(4)\). \(\triangle\)

2.1.0.1 Colored operads

Colored (or typed) operads are like operads, except that each morphism takes inputs of specific colors, and returns an output of a specific color (or type). If \(\mathcal{O}\) is a colored operad, we denote by \(\mathcal{O}(c_1,\ldots,c_k;d)\) the morphisms that take \(k\) inputs with colors \(c_1, \ldots, c_k\), respectively, and return an output of color \(d\). (A category can be interpreted as a colored operad with only unary operations; for this reason, colored operads are sometimes called multicategories.)

Example 2. Suppose that \(G = (V,\Sigma,R,S)\) is a context-free grammar, as in §2.1 of [11]. We define a derivation tree with non-terminal leaves for \(G\) to be a rooted planar tree \(T\) such that:

  • Every node is labeled by a non-terminal \(A \in V\);

  • If an internal node is labeled \(A\), and its children are labeled \(B_1, \ldots, B_k\), then \(A \to B_1,\ldots,B_k\) must be a production rule in \(R\).

We define \(D_G\) to be the colored operad of derivation trees with non-terminal leaves for \(G\), with colors \(V\). That is:

  • Given \(B_1, \ldots, B_k \in V\) and \(A \in V\), \(D_G(B_1,\ldots,B_k;A)\) consists of the derivation trees for \(G\) whose \(k\) leaves have labels \(B_1, \ldots, B_k\) and whose root has label \(A\).

  • Composition in \(D_G\) is given by grafting the root of one derivation tree to a leaf of another — a common operation in context-free parsing — subject to the requirement that the labels at the two nodes being identified must match.

For instance, suppose that \(G\) is a context-free grammar modeling English, with non-terminals {S, NP, VP, PP, Det, N, V, P} (standing for “sentence”, “noun phrase”, etc.). Here are two derivation trees, called \(T_1\) and \(T_2\), which define elements of \(D_G(\text{Det},\text{N},\text{VP};\text{S})\) and \(D_G(\text{V},\text{Det},\text{N},\text{P},\text{Det},\text{N};\text{VP})\), respectively:

] [VP] ] [VP [V] [NP [Det] [N] ] [PP [P] [NP [Det] [N] ] ] ] ]

We can form the composition \(T_1\circ_3T_2\), which grafts the trees at their unique VP node to yield an element of \(D_G(\text{Det},\text{N},\text{V},\text{Det},\text{N},\text{P},\text{Det},\text{N};\text{S})\):

] [VP [V] [NP [Det] [N] ] [PP [P] [NP [Det] [N] ] ] ] ]

\(\triangle\)

2.1.0.2 Why operads are helpful.

The appeal of operads is that they allow us to separate the abstract forms of composition from any particular interpretation of those forms. For example, Examples 12 talk about very different objects (i.e., \(k\)-ary string processing functions vs.derivation trees in formal grammars), yet operads package both as instances of the same underlying idea: an operation with multiple inputs and one output, together with a notion of plugging one operation into an input slot of another.

Operads were originally introduced by Peter May in algebraic topology [12], where one motivating problem was to understand the algebraic structure of loopspaces. The basic idea of a loop is simple: fix a point \(x_0\) in a space \(X\), and consider continuous paths \(\gamma\colon [0,1] \to X\) that start at \(x_0\) (i.e. \(\gamma(0)=x_0\)), trace out a route through \(X\), and return to \(x_0\) at the end of their interval (i.e.\(\gamma(1)=x_0\)). The loopspace \(\Omega X\) is the collection of all such loops.

Loopspaces are compositional because one can traverse one loop \(\gamma_1\) and then a second \(\gamma_2\), resulting in the concatenation \(\gamma_1*\gamma_2\). We can depict this concatenation as the unit interval \([0,1]\), with a tick mark indicating the transition from \(\gamma_1\) to \(\gamma_2\):

Figure 1: image.

Concatenation, however, is not associative. Indeed, \((\gamma_1 * \gamma_2) * \gamma_3\) and \(\gamma_1 * (\gamma_2 * \gamma_3)\) traverse the same loops, but do so with different speeds and are therefore distinct as loops. These concatenations are nevertheless deformable into one another by reparametrizing time, which corresponds to moving the tick marks on the interval. There are thus two ways to concatenate three loops, related by a single deformation; we organize them into the endpoints of an interval, the associahedron \(\mathcal{K}(3)\):

Figure 2: image.

For four loops, there are five parenthesizations. This time, the deformations that relate these concatenations are organized into a pentagon, the associahedron \(\mathcal{K}(4)\):

Unlike the purely combinatorial operad \(D_G\), the associahedra are polytopes — topological spaces whose cells record not merely that parenthesizations are related, but the continuous geometry of how they deform into one another. One might instead simply identify all parenthesizations as homotopy-equivalent and work with the quotient; but this would discard the finer structure that concatenation naturally carries.

May’s insight was that these coherence data are precisely the kind of structure operads encode. In modern terms, loopspaces are naturally algebras over the associahedra operad, and May’s Recognition Principle says, roughly, that under suitable hypotheses this operadic structure characterizes loopspaces. This illustrates the “operadic mantra”:

Objects with extra structure should be understood as algebras over an appropriate operad.

This example also connects to the grammar and question-decomposition examples below. The associahedra organize different parenthesizations of a composite expression; derivation trees similarly record different histories for composing constituents into a string; and question decompositions record different histories for composing subquestions into a final query. In all three cases, the compositional history itself carries information. Operads provide a language for studying that history, rather than only the final output.

We have two purposes to bring the language of operads to bear in the context of question decomposition and machine learning more generally. First, we believe that operads are simply the natural formal structure for question decomposition, and therefore that their introduction in this context is innately worthwhile. Second, reformulating question decompositions and QA models in operadic terms can lead to new results and tools — for instance, a new notion of “operadic consistency” for QA models (see §2.3.2). Even in the well-studied context of context-free grammars, we describe in Remark 1 how the operadic point of view can point to new tools.

2.1.1 Algebras over operads↩︎

Operads do not necessarily have to literally be collections of operations (for instance, consider \(D_G\) from Example 2). A realization of an operad in terms of actual operations is called an algebra.

Definition 2. Suppose that \(\mathcal{O}\) is a colored operad. An algebra \(\mathcal{A}\) over \(\mathcal{O}\) is:

  • For every color \(c\), a set \(\mathcal{A}(c)\).

  • For every \(f \in \mathcal{O}(c_1,\ldots,c_k;d)\), a map \[\begin{align} \varphi_f\colon \mathcal{A}(c_1)\times\cdots\times\mathcal{A}(c_k)\to\mathcal{A}(d). \end{align}\]

We require that \(\varphi_{f \circ_i g}\) is the same operation as inserting the output of \(\varphi_g\) into the \(i\)-th input of \(\varphi_f\); this condition is also referred to as “associativity”. \(\triangle\)

For instance, \(\Sigma^*\) is naturally an algebra over \(\mathcal{F}_\Sigma\): for each \(f \in \mathcal{F}_\Sigma(k)\), the corresponding algebra operation is simply the map \(f : (\Sigma^*)^k \to \Sigma^*\). We describe another example of an algebra, this time over the colored operad \(D_G\) from Example 2, below.

Example 3. Given a context-free grammar, we can define an algebra \(L_G\) over the operad \(D_G\) of derivation trees for \(G\), like so:

  • For \(A \in V\), \(L_G(A)\) is the language generated by \(A\), i.e.the language of the subgrammar with \(A\) as the start symbol.

  • If \(T\) is a derivation tree for \(G\), with root label \(A\) and leaf labels \(B_1,\ldots,B_k\), then it defines a map \[\begin{align} \varphi_T\colon L(B_1)\times\cdots\times L(B_k) \to L(A) \end{align}\] by concatenation. For instance, the operation associated to the derivation tree described near the end of Example 2 could take as inputs {“The”, “dog”, “saw”, “the”, “cat”, “in”, “the”, “park”} and return the sentence “The dog saw the cat in the park”. \(\triangle\)

The content of a context-free grammar can therefore be repackaged as the operad \(D_G\) and its algebra \(L_G\). Importantly, \(L_G\) is only one possible algebra over \(D_G\). Indeed, besides the string yield algebra, one can define algebras for computing derivation probabilities, best-parse computations, or derivation counts. This connects to classical work on weighted and semiring parsing [13], [14], where different computations are obtained by varying the value algebra while keeping the underlying derivational machinery fixed. The operadic viewpoint complements this line of work by treating the grafting structure of derivations as a first-class algebraic object. This is useful not only for computing values over derivations, but also for defining more complex algebraic constructions that capture properties of the derivational system itself, such as the ambiguity algebra introduced below and, later, our notion of operadic consistency for question decomposition.

Remark 1. At least as early as the foundational work of [15], ambiguity has been regarded as a central notion in the theory of context-free grammars and languages. One treatment can be found in §5.4 of [16], where the authors define a CFG \(G\) to be unambiguous if each string has at most one derivation tree in \(G\). This definition is binary and has no internal algebraic structure.

Our reformulation of a CFG as an operad \(D_G\) and an algebra \(L_G\) enables us to define a new avatar of ambiguity, called the ambiguity algebra \(\ker\varphi\). This is a canonical object that recovers the usual definition of ambiguity as the condition \(\ker\varphi \neq 0\), while additionally encoding the compositional structure of ambiguity.

To define the ambiguity algebra, we first linearize \(D_G\) and \(L_G\) to form \(D_G^\mathbb{R}\) and \(L_G^\mathbb{R}\). That is, we define \(D_G^\mathbb{R}(B_1,\ldots,B_k;A)\) to consist of formal \(\mathbb{R}\)-linear combinations of elements of \(D_G(B_1,\ldots,B_k;A)\), and \(L_G^\mathbb{R}(A)\) similarly. \(L_G^\mathbb{R}\) is then an algebra over \(D_G^\mathbb{R}\). We can define a second \(D_G^\mathbb{R}\)-algebra, \(F_G^\mathbb{R}\), which is the linearization of the \(D_G\)-algebra \(F_G\) consisting of those complete derivation trees whose leaves are all labeled by terminals, and where the \(D_G\)-action is defined by grafting. There is a forgetful map, \(\varphi\colon F_G^\mathbb{R}\to L_G^\mathbb{R}\), which sends a derivation tree to its yield. We now define the ambiguity algebra to be the kernel \(\ker\varphi\), i.e.those elements of \(F_G^\mathbb{R}\) that are sent to zero by \(\varphi\). \(\triangle\)

2.2 Operads for question decomposition↩︎

We will now apply the language of operads to the context of question decomposition. Our proposal takes particular inspiration from variants of chain-of-thought prompting, particularly the decomposed prompting approach of [3] and uncertainty of thoughts approach of [17] that decompose input problems to sets of sub-questions. We first define an operad, \(\mathcal{Q}\), in terms of questions and how they can be de- and re-composed. Then we will explain how QA models can be interpreted as algebras over \(\mathcal{Q}\).

Definition 3. The questions operad \(\mathcal{Q}\) consists of the following data:

  • For every \(k \geq 0\), \(\mathcal{Q}(k)\) is the set of questions with \(k\) blanks.

  • For every \(k, \ell \geq 0\) and \(1 \leq i \leq k\), we define a composition operation \[\begin{align} \circ_i\colon \mathcal{Q}(k)\times \mathcal{Q}(\ell) \to \mathcal{Q}(k+\ell-1) \end{align}\] that plugs the output of the second question into the \(i\)-th blank of the first. \(\triangle\)

It is natural to construct \(\mathcal{Q}\) as a colored operad. This involves a choice of answer types, defined by the user. For instance, we could set \[\begin{align} \mathrm{Color}(\mathcal{Q}) \mathrel{\vcenter{:}}= \{\text{time},\text{duration},\text{place},\text{person},\text{other}\}. \end{align}\]

Example 4. Consider the following questions: \[\begin{gather} \mathtt{Q1} \mathrel{\vcenter{:}}= \text{``When did World War 2 end?''} \in \mathcal{Q}(;\text{time}), \\ \mathtt{Q2} \mathrel{\vcenter{:}}= \text{``Who was President at } -\text{?''} \in \mathcal{Q}(\text{time};\text{person}), \\ \mathtt{Q3} \mathrel{\vcenter{:}}= \text{``Who was } -\text{'s wife?''} \in \mathcal{Q}(\text{person};\text{person}). \end{gather}\] The composition \(\mathtt{Q3}\circ_1\mathtt{Q2}\circ_1\mathtt{Q1}\) is “Who was First Lady when World War 2 ended?” (or a semantic equivalent). In this case, the associativity of \(\mathcal{Q}\) says that this composition is independent of whether we first compose \(\mathtt{Q3}\) and \(\mathtt{Q2}\) or \(\mathtt{Q2}\) and \(\mathtt{Q1}\). \(\triangle\)

Remark 2. Definition 3 should be understood at an abstract level: the composition \(\circ_i\) is formal substitution of one typed question template into the \(i\)-th blank of another. Operationally, however, one may wish to render such substitutions as fluent natural-language questions, and that surface-realization step will depend on a model. Accordingly, associativity is best understood up to semantic equivalence. \(\triangle\)

We can interpret question decomposition in terms of composition in \(\mathcal{Q}\). For instance, consider the question \(\mathtt{Q}\), “How long was it between when the Titanic hit the iceberg and when it sank completely?” We can decompose \(\mathtt{Q}\) into the following tree of questions:

\[\tag{3}\begin{figure}\includegraphics[width=0.8\textwidth]{_pdflatex/twshmyeg.png}\tag{4}\end{figure}\]

We can reinterpret this in terms of the questions operad:

  • \(\mathtt{Q}\) is an element of \(\mathcal{Q}(;\text{duration})\). \(\mathtt{Q1}\) and \(\mathtt{Q2}\) lie in \(\mathcal{Q}(;\text{time})\), and \(\mathtt{Q3}\) lies in \(\mathcal{Q}(\text{time},\text{time};\text{duration})\).

  • The fact that 3 is a legitimate decomposition of \(\mathtt{Q}\) is witnessed by the fact that \(\mathtt{Q1}\), \(\mathtt{Q2}\), and \(\mathtt{Q3}\) compose to \(\mathtt{Q}\) — that is, \(\mathtt{Q} = \mathtt{Q3} \circ_1 \mathtt{Q1} \circ_1 \mathtt{Q2}\).

2.2.1 ML models as algebras over operads↩︎

Now that we have interpreted question decomposition in terms of the questions operad, we can interpret a QA model as an algebra over \(\mathcal{Q}\). In the following definition, we use the term value to mean something that can be used to fill in a blank, or something that can occur as the output of a question.

Definition 4. Suppose that \(m\) is a general-purpose question answering model, that takes a question \(q\) and returns an answer \(v\). We can use \(m\) to define a \(\mathcal{Q}\)-algebra, \(\mathcal{V}_m\):

  • As a set, \(\mathcal{V}_m\) consists of all possible values.

  • Given a question \(q \in \mathcal{Q}(k)\) with \(k\) blanks, along with \(k\) values \(v_1,\ldots,v_k\), we can produce a value \(v'\) by the following procedure:

    • Fill in the \(k\) blanks in \(q\) with \(v_1,\ldots,v_k\), then process in order to form a question \(q'\).

    • Define \(v'\) to be the output of \(m\) on \(q'\). \(\triangle\)

2.3 Operadic consistency↩︎

Operads do not only provide a new language for describing question decomposition — they also point the way toward new methods. In this subsection, we will define operadic consistency, given a model \(m\) and a tree of questions \(T\).

2.3.1 Trees of questions and partial collapses thereof↩︎

Fix an instantiation of the questions operad \(\mathcal{Q}\). By a “tree of questions” (or “ToQ”) \(T\), we mean the following:

  • A rooted tree \(T\). By convention, (1) we orient all trees toward the root, (2) each leaf has a single incoming edge, and (3) the root has a single outgoing edge.

  • For every edge \(e\) in \(T\), a color \(t_e \in \mathrm{Color}(\mathcal{Q})\).

  • For every vertex \(v \in T\), a question \(q \in \mathcal{Q}(t_{e_1},\ldots,t_{e_k};t_{e'})\), where \(e_1,\ldots,e_k\) are the incoming edges of \(v\) and \(e'\) is the outgoing edge of \(v\).

One example is the ToQ in 3 . Another is formed by the questions in Ex. 4, which we use as a running example in this subsection: \[\tag{5}\begin{figure}\includegraphics[width=0.8\textwidth]{_pdflatex/kzfotjlc.png}\tag{6}\end{figure}\]

Any ToQ \(T\) has the property that the questions can be composed to form a question with no blanks. We call this the total collapse of \(T\). On the other hand, we can form a partial collapse by composing some, but not all, of the questions involved. Indeed, given a ToQ \(T\) and a choice, for every edge, of whether to compose along that edge, we can produce a partial collapse of \(T\). The total number of partial collapses of \(T\) is \(2^{\#T-1}\), where \(\#T\) is the number of vertices of \(T\).

Example 5. There are 4 partial collapses of 5 : \[\begin{figure}\includegraphics[width=0.8\textwidth]{_pdflatex/qsuvigfe.png}\label{dnquplij}\end{figure}\tag{7}\] \[\begin{figure}\includegraphics[width=0.8\textwidth]{_pdflatex/mylkshfb.png}\label{npdxartf}\end{figure}\tag{8}\] \(\triangle\)

2.3.2 Definition↩︎

Suppose that \(T\) is a tree of questions and \(m\) is a QA model. We can use \(m\) to answer the questions in \(T\): we start at the leaves and work our way toward the root, finally finishing by producing an answer to the root question. If \(\mathcal{V}_m\) is associative on the nose, then the final answer produced by \(m\) on \(T\) agrees with \(m\)’s final answer on the total collapse of \(T\). Moreover, if \(T'_1\) and \(T'_2\) are two partial collapses of \(T\), then the final answers produced by \(m\) on \(T_1'\) and \(T_2'\) must agree. This leads to our definition of operadic consistency.

Definition 5. We say that \(m\) is operadically consistent on \(T\) if, for any partial collapses \(T'_1, T'_2\) of \(T\), the final answers produced by \(m\) when executed on \(T'_1\) and \(T_2'\) agree. \(\triangle\)

Example 6. Consider \(m\mathrel{\vcenter{:}}=\) Llama 3 8B Instruct. When we execute \(m\) on the four partial collapses of the ToQ \(T\) in 5 , three yield “Bess Truman” and one yields “Eleanor Roosevelt” — the total collapse, \(m\)’s answer to the single-pass question “Who was First Lady when World War 2 ended?”. This disagreement witnesses operadic inconsistency. \(\triangle\)

3 Further directions↩︎

The framework introduced in this paper opens several directions for future work, both theoretical and experimental.

3.0.0.1 Extracting operadic structure from chain-of-thought.

A natural extension is to apply the framework to thinking models, whose extended reasoning traces make the implicit decomposition structure explicit. This requires first formalizing the model’s reasoning as a structured object — a tree of questions, a more general program, or some other algebraic representation of the trace — on which a suitable instantiation of operadic consistency can be evaluated. The depth-2 chain extraction used in our companion paper [8] is a minimal first attempt; richer formalisms open the possibility of consistency checks that capture more of the trace’s compositional content.

3.0.0.2 Cohomological invariants.

Algebras over operads admit a notion of cohomology, and we believe that the cohomology of the \(\mathcal{Q}\)-algebra associated to a QA model may carry meaningful information about the structure of a model’s inconsistencies — distinguishing, for instance, between correctable inconsistencies and more fundamental failures of multi-step reasoning.

3.0.0.3 Other algebras over \(\mathcal{Q}\).

The operadic perspective suggests that question decompositions need not be interpreted only by their final answers. They may also be interpreted by likelihoods, confidence scores, evidence bundles, costs, latent representations, or robustness profiles, each giving an algebra over the same underlying compositional structure.

3.0.0.4 Companion paper.

A first empirical installment of this program already exists: our companion paper [8] evaluates operadic consistency across twelve instruction-tuned LLMs and four multi-hop QA datasets, where it is strongly correlated with accuracy and yields selective-prediction improvements over temperature-based self-consistency at equal inference cost. We refer the reader there for protocols, baselines, and full results.

Acknowledgements↩︎

N.B.was supported by the Defense Advanced Research Projects Agency (DARPA) through the Artificial Intelligence Quantified (AIQ) program, under Cooperative Agreement HR00112520028. The views, opinions, and/or findings expressed are those of the authors and should not be interpreted as representing the official views or policies of the Department of Defense or the U.S.Government.

N.B.thanks AI2 for its hospitality during this collaboration.

Impact Statement↩︎

This paper develops a mathematical framework for question decomposition in language models. We foresee no direct negative societal impacts; operadic consistency could in principle be used to audit deployed QA systems.

References↩︎

[1]
J. Wei et al., “Chain-of-thought prompting elicits reasoning in large language models,” Advances in neural information processing systems, vol. 35, pp. 24824–24837, 2022.
[2]
S. Yao et al., “Tree of thoughts: Deliberate problem solving with large language models,” Advances in neural information processing systems, vol. 36, pp. 11809–11822, 2023.
[3]
T. Khot et al., “Decomposed prompting: A modular approach for solving complex tasks,” Proceedings of ICLR, 2023.
[4]
X. Wang et al., “Self-consistency improves chain of thought reasoning in language models,” Proceedings of ICLR, 2023.
[5]
L. Yang et al., “Buffer of thoughts: Thought-augmented reasoning with large language models,” Advances in Neural Information Processing Systems, vol. 37, pp. 113519–113544, 2024.
[6]
M. Besta et al., “Graph of thoughts: Solving elaborate problems with large language models,” in Proceedings of the AAAI conference on artificial intelligence, 2024, vol. 38, pp. 17682–17690.
[7]
M. Marcolli, R. C. Berwick, and N. Chomsky, “Syntax-semantics interface: An algebraic model,” arXiv preprint arXiv:2311.06189, 2023.
[8]
N. Bottman, Y. Liu, and K. Richardson, arXiv preprint.“Operadic consistency: A label-free signal for compositional reasoning failures in LLMs.” 2026.
[9]
M. Markl, S. Shnider, and J. Stasheff, “Operads in algebra, topology and physics,” Mathematical surveys and monographs, vol. 96, 2002.
[10]
J.-L. Loday and B. Vallette, Algebraic operads, vol. 346. Springer Science & Business Media, 2012.
[11]
M. Sipser, Introduction to the theory of computation. PWS Publishing Company, 1996.
[12]
J. P. May, The geometry of iterated loop spaces, vol. 271. Berlin, Heidelberg: Springer-Verlag, 1972.
[13]
J. Goodman, “Semiring parsing,” Computational Linguistics, vol. 25, no. 4, pp. 573–606, 1999.
[14]
M.-J. Nederhof, “Weighted deductive parsing and knuth’s algorithm,” Computational Linguistics, vol. 29, no. 1, pp. 135–143, 2003.
[15]
N. Chomsky and M. P. Schützenberger, “The algebraic theory of context-free languages,” in Studies in logic and the foundations of mathematics, vol. 26, Elsevier, 1959, pp. 118–161.
[16]
J. E. Hopcroft, R. Motwani, and J. D. Ullman, Introduction to automata theory, languages, and computation, 2nd ed. Addison-Wesley, 2001.
[17]
Z. Hu et al., “Uncertainty of thoughts: Uncertainty-aware planning enhances information seeking in large language models,” arXiv preprint arXiv:2402.03271, 2024.