Operads for compositional reasoning in LLMs

Nathaniel Bottman, Kyle Richardson

TL;DR

This paper provides a rigorous mathematical foundation for question decomposition in LLMs using operads—structures from category theory that model how parts compose into wholes. By formalizing reasoning as an algebraic process, the authors introduce "operadic consistency," a new metric that predicts model accuracy significantly better than standard self-consistency.

What Problem Does This Paper Address?

We know that Large Language Models (LLMs) perform better on complex tasks when they break them down into smaller steps (e.g., Chain-of-Thought or decomposed prompting). For example, to answer "How long was it between when the Titanic hit the iceberg and when it sank?", a model might first find the two specific timestamps and then calculate the difference.

However, this "decomposition" strategy is currently an ad-hoc engineering trick. We lack a formal mathematical way to define what a "well-formed" decomposition looks like, how errors propagate through these steps, or how to compare different reasoning strategies. Without a rigorous framework, it is difficult to build truly reliable multi-step reasoning systems.

Methods

The authors turn to operads, a branch of mathematics originally developed to study iterated substitutions in topology and algebra.

  1. The Questions Operad ($\mathcal{Q}$): The authors define an operad where "operations" are question templates with blanks (e.g., "Who was the wife of [A1]?"). "Composition" is the act of plugging the answer of one question into the blank of another.
  2. Models as Algebras: They interpret a QA model as an "algebra" over this operad. In simple terms, the model is the engine that assigns actual values (answers) to these abstract compositional structures.
  3. Reasoning Robustness: This is the paper's most novel contribution. If a model is "robust," it should give the same final answer regardless of how the question is "collapsed." For instance, asking the full complex question directly should yield the same result as asking the sub-questions and composing them.
  4. Operadic Consistency: To test this, the authors developed a scalar metric that compares a model’s "greedy direct answer" to its "greedy decomposed answer." If they match, the model is operadically consistent.

Datasets

The researchers evaluated eight state-of-the-art models (ranging from 4B to 671B parameters, including Llama 3, Qwen2.5, DeepSeek V3.1, and Cogito 671B) across four multi-hop QA datasets:

  • HotpotQA and DROP: Using Break QDMR-high-level annotations.
  • MuSiQue and StrategyQA: Using native human-authored decompositions.

Key Insights and Ideas

  • Consistency as a Proxy for Truth: The "aha moment" is that internal logical consistency is a powerful signal for accuracy. If a model’s direct answer contradicts its own step-by-step logic, it’s likely wrong.
  • Structure Over Noise: Standard "self-consistency" (asking the same question multiple times with different random seeds) only measures how "sure" a model is. Operadic consistency measures how "logical" the model's internal world-model is.
  • The "Operadic Mantra": The authors argue that reasoning isn't just a sequence of tokens, but a tree-shaped composition. Operads are the "natural mathematical home" for this structure, allowing us to use tools from algebraic topology to study AI.

Key Results

  • Strong Correlation with Accuracy: Operadic consistency is a massive predictor of model performance. It showed a Pearson correlation ($r$) between 0.70 and 0.98 across all four datasets.
  • Failure of Standard Baselines: In contrast, standard temperature-based self-consistency showed almost no significant correlation with accuracy ($|r| \leq 0.37$). This suggests that being "consistent across different levels of logic" is a much more meaningful signal than just being "consistent across different random samples."
  • Scale Independence: This relationship held true across models of vastly different sizes, from small 4B parameter models to the massive 671B DeepSeek and Cogito models.

Limitations and Future Work

  • Across-Model vs. Within-Model: Currently, the results show that better models are more operadically consistent. The authors haven't yet proven that this can be used to pick the best answer for a single question within one model (though they suggest this is the next step).
  • Human-Authored Trees: The study relied on human-authored decomposition trees. Future work will need to explore how to extract these structures automatically from "thinking" models (like Qwen3-235B) that generate their own internal reasoning traces.
  • Advanced Invariants: The authors hint at using "cohomology"—a sophisticated tool from category theory—to distinguish between simple mistakes and fundamental failures in a model's reasoning capabilities.

Summary updated

BibTeX
@inproceedings{bottman2026operads,
  author = {Nathaniel Bottman and Kyle Richardson},
  title = {{Operads for compositional reasoning in LLMs}},
  booktitle = {CTB @ ICML},
  year = {2026},
  url = {https://openreview.net/forum?id=UdNuBMXlgm},
}
Figure