---
title: 'Compositional Complexity: Theory & Practice'
url: https://www.emergentmind.com/topics/compositional-complexity
type: topic
---

# Compositional Complexity: Theory & Practice

Compositional complexity denotes the complexity induced by constructing a global object from interacting parts, but the literature uses the term in several technically distinct senses. In decision-tree complexity it refers to exact laws for composites of the form \(h=g(f^1,\ldots,f^n)\) [1302.4207]; in Boolean lower bounds it measures how many \(k\)-local summaries are needed to realize majority [2205.02374]; in optimization it names objectives such as \(h(g(x))\) and finite-sum analogues [1806.00458]; in contemporary machine learning it can refer to hierarchical computation structure, multilevel novelty, or the number of atomic capabilities required by a task [2405.02350, 2412.13636, 2504.21850]; and in materials science it describes multicomponent chemistry, defect compensation, and near-atomic-scale heterogeneity [2601.14807, 2603.25865]. Taken together, these uses suggest a common theme: compositional complexity concerns the costs, constraints, and structural consequences of mediating a global phenomenon through intermediate components rather than treating it monolithically.

## 1. Exact composition theorems in query and Boolean complexity

In deterministic decision-tree complexity, compositional complexity is characterized exactly for a broad class of boolean-valued inner relations. If \(g \subseteq \{0,1\}^n \times Z\), each \(f^i \subseteq X^{m_i}\times\{0,1\}\) is non-trivial, and \(h=g\circ(f^1,\ldots,f^n)\), then
\[
D(h)=D(\bar g,[D(f^1),\ldots,D(f^n)]),
\]
where \(\bar g\) is obtained by substituting any constant inner relations into \(g\) [1302.4207]. This is an exact formula, not merely an upper or lower bound, and it shows that in the boolean-inner regime the composite problem is completely characterized by weighted outer complexity. The same paper derives \(D(g\circ(f,\ldots,f))=D(f)D(g)\), \(D(f^{(k)})=D(f)^k\), and a deterministic direct-sum theorem \(D(h)=\sum_i D(f^i)\) for \(h=(f^1,\ldots,f^n)\) [1302.4207].

The restriction to boolean-valued inner objects is essential. The paper gives counterexamples showing that nonboolean inner outputs can expose richer structure than a single interface bit, so naive multiplication or black-box substitution fails [1302.4207]. A second line of work makes the same point from the opposite direction: in the local-function composition model
\[
\mathrm{Maj}_n=h(g_1,\ldots,g_m),
\]
where each \(g_j:\{0,1\}^n\to\{0,1\}\) is \(k\)-local and \(h\) is arbitrary, majority provably requires a superconstant composition overhead. The optimal lower bound is
\[
CC_k(\mathrm{Maj}_n)\ge \Omega\!\left(\frac{n}{k}\log k\right)
\]
for \(k\le n^{1-\varepsilon}\), with the more general form
\[
CC_k(\mathrm{Maj}_n)\ge \Omega\!\left(\frac{n}{k}\min\!\left(\log k,\log \frac{n}{k}\right)\right),
\]
and a matching upper bound in the same regime [2205.02374]. Here the ideal baseline \(n/k\) is unattainable: majority needs \(\Theta(\log k)\) extra local summaries per block. The proof proceeds through sharp lower bounds for Hamming weight, information-loss estimates through the inner functions \(g_j\), and a bootstrap from a multi-output function to a single-output one [2205.02374].

These results formalize two complementary facts. In some models the cost of composition collapses to a clean weighted outer problem; in others, even an unrestricted outer combiner cannot recover information discarded by too-aggressive local compression. This suggests that compositional complexity is often controlled by the informational sufficiency of the interface between inner and outer levels.

## 2. Compositional optimization and oracle complexity

In optimization, compositional complexity refers to objectives whose gradient structure is harder than that of ordinary stochastic optimization because the gradient of a composition requires both the inner map and its Jacobian. A canonical finite-sum problem is
\[
\min_{x\in X}\ \Phi(x)=\frac1n\sum_{i=1}^n f_i\!\left(\frac1m\sum_{j=1}^m g_j(x)\right)+r(x),
\]
for which
\[
\nabla F(x)=[\partial g(x)]^\top \nabla f(g(x)).
\]
The difficulty is that one must estimate the inner average \(g(x)\), the inner Jacobian \(\partial g(x)\), and the outer gradient simultaneously [1806.00458]. For the convex finite-sum regime, SCVRG achieves
\[
O\!\left((m+n)\log(1/\epsilon)+\frac{1}{\epsilon^3}\right)
\]
sample complexity, improving the dependence on \(m+n\) up to a logarithmic factor [1806.00458].

For non-convex finite-sum compositions
\[
\Phi(x)=f(g(x)),\qquad f(y)=\frac1n\sum_{i=1}^n f_i(y),\qquad g(x)=\frac1m\sum_{j=1}^m g_j(x),
\]
STORM-Compositional tracks three recursive estimators—\(\mathbf g_t\) for \(g(x_t)\), \(\mathbf G_t\) for \(\partial g(x_t)\), and \(\mathbf F_t\) for the compositional gradient—and obtains IFO complexity
\[
\mathcal O(\epsilon^{-3})
\]
for producing \(\widehat x\) with \(\mathbb E\|\nabla\Phi(\widehat x)\|\le \epsilon\) [2006.01688]. Its contribution is not a better asymptotic exponent than the best prior result, but a single-loop recursive-momentum scheme that avoids checkpointing and large/small batch alternation [2006.01688].

A distinct deterministic line studies non-smooth, non-convex compositional objectives with additional structure. For
\[
\min_x h(g(x)),
\]
where \(g\) is smooth and \(h\) is Lipschitz, non-smooth, non-convex, and proximable, a smoothing compositional gradient method finds a chain-rule \((\delta,\epsilon)\)-stationary point in
\[
O\!\left(\frac{1}{\delta\epsilon^2}\right)
\]
iterations [2411.14342]. For the DC-structured class
\[
f(x)=h_2(g_2(x))-h_1(g_1(x)),
\]
with convex Lipschitz \(h_i\) and smooth \(g_i\), a prox-linear method finds a nearly \(\epsilon\)-critical point in
\[
O\!\left(\frac{1}{\epsilon^2}\right)
\]
iterations [2411.14342]. In this literature, compositional complexity is therefore primarily algorithmic: it is the extra burden imposed by nested structure on gradient estimation, stationarity notions, and oracle complexity.

## 3. Hierarchical computation and compositional generalization

A theoretical account of compositional functions for sequence models defines
\[
f(X)=h\left(g^{\otimes D(X)}(e(x_1,1),\ldots,e(x_L,L))\right),
\]
where \(e\) is a token encoder, \(D(X)\) is a computation DAG, \(g\) is a recursively reused span processor, and \(h\) is a final read-out [2405.02350]. The corresponding compositional complexity is measured through the locus of influence:
\[
\delta_i=\sum_{P\in P(x_i)} c^{|P|}, \qquad \beta_i=\frac{\delta_i}{\sum_j \delta_j},
\]
where \(P(x_i)\) is the set of all source-to-sink paths from token \(x_i\) [2405.02350]. This yields architecture-dependent complexity profiles. A balanced binary-tree recurrence has
\[
\delta=c^{\lceil \log_2 L\rceil},\qquad \beta=1/L,
\]
whereas a dense transformer with \(M\) blocks has
\[
\delta=L^{M+1}c^{M+1},\qquad \beta=1/L
\]
[2405.02350]. The same framework proves sensitivity bounds, an input-agnostic versus input-dependent expressivity gap, and systematic generalization guarantees whose dependence on \(\delta\) is explicit [2405.02350].

A separate benchmark-oriented literature treats compositional complexity as hierarchical novelty. One proposal distinguishes word-word, phrase-word, and phrase-phrase levels, and defines “consistency” as simultaneous generalization across a phrase-phrase composition and the derived phrase-word and word-word compositions [2412.13636]. The associated framework partitions training data by a longest-phrase-length proxy, introduces multiple meta-weight-nets, and optimizes them sequentially from simple to complex in a multilevel optimization procedure [2412.13636]. On the GQA-CCG dataset, this improves not only levelwise accuracies but also the stricter triplet consistency score, supporting the claim that compositional complexity is structured internally rather than being a single undifferentiated OOD phenomenon [2412.13636].

This body of work reframes compositional complexity as a property of computation graphs and generalization regimes. The central issue is not only whether a model composes, but whether its induced composition structure matches the latent structure of the task.

## 4. Capability-count, architectural, and solution-complexity views in modern machine learning

Several recent empirical papers treat compositional complexity as an explicitly controllable design variable. In COMPACT, a visual-language task \(T\) is assigned a capability set \(\{c_1,\dots,c_k\}\), and the number \(k\) of required atomic visual capabilities is defined as its compositional complexity [2504.21850]. The paper introduces 10 atomic capabilities, balances training data across \(k\in\{1,2,3\}\), and evaluates on benchmark questions whose inferred complexity extends to \(k=4\) and \(k=5\) [2504.21850]. The reported finding is that balancing training by compositional complexity, rather than relying on scale alone, improves performance especially on multi-capability questions; for example, at \(k=4\), COMPACT reports 57.5 versus 32.5 on MM-Vet and 64.7 versus 35.3 on MMStar relative to full LLaVA-665K VIT [2504.21850].

In language-conditioned reinforcement learning, CERLLA treats compositional complexity as an architectural and empirical problem rather than a formal theorem. Tasks are generated from colors, object types, and Boolean operators, yielding 162 unique tasks in an augmented BabyAI/MiniGrid environment [2501.12539]. CERLLA pretrains nine basis World Value Functions, one for each attribute, and composes them with Boolean operations:
\[
Q_{R \vee K}^*=\max\{Q_R^*,Q_K^*\},\qquad
Q_{R \wedge K}^*=\min\{Q_R^*,Q_K^*\},\qquad
Q_{\neg R}^*=(Q_{MAX}^*+Q_{MIN}^*)-Q_R^*,
\]
while an LLM-based parser maps instructions to Boolean expressions over abstract symbols [2501.12539]. The method reaches 92% success, matching the oracle upper bound, whereas the non-compositional baseline reaches about 80% under the same total environment-step budget [2501.12539]. The paper explicitly presents this as a reduction in sample complexity through reusable policy structure.

A third strand studies the complexity of the learned solution itself. On synthetic compositional tasks, smaller initialization scale and larger weight decay bias Transformers toward reasoning-based solutions rather than memory-based solutions [2501.08537]. The reported indicators of lower solution complexity include lower stable rank,
\[
R_{\text{stable}}(A)=\frac{\|A\|_F^2}{\|A\|_2^2},
\]
stronger neuron condensation in first-layer query weights, and internal masked-circuit behavior consistent with computing primitive anchor-level rules rather than memorizing composite mappings [2501.08537]. This suggests that compositional complexity in model behavior can refer not only to task structure but also to the effective complexity of the representation learned by optimization.

## 5. Structured decomposition in verification, representation, and cognition

In structured model checking, compositional complexity is controlled by decomposing a global concurrent system into components with typed interfaces. Petri Nets with Boundaries assign each component a two-labelled transition-system semantics, and sequential composition is governed by
\[
\frac{a \xrightarrow{\alpha/\beta} a' \quad b\xrightarrow{\beta/\gamma}b'}
{(a,b) \xrightarrow{\alpha/\gamma} (a',b')}.
\]
Weak language equivalence is a congruence for the composition operators, so intermediate automata can be minimized safely during bottom-up reachability checking [1603.00976]. On the \(n\)-bit counter family, whose global automaton has \(2^n\) states and shortest accepting path length \(2^n-1\), the paper states that the compositional procedure solves the family in linear time [1603.00976]. Here compositional complexity is not a new complexity class; it is the practical reduction of state explosion through interface-aware decomposition and equivalence-based minimization.

A related representation-theoretic viewpoint appears in hierarchical compositional object models with part sharing. For serial inference with shared dictionaries, the cost is
\[
N_{p_s}=|\mathcal D_0| C_r \sum_{h=1}^{\mathcal H} |\mathcal M_h| q^h,
\]
whereas without sharing the multiple-object cost is
\[
N_{m_o}=|\mathcal M_{\mathcal H}|\,|\mathcal D_0| C_r \frac{q\,r^{\mathcal H-1}}{1-q/r}.
\]
In favorable dictionary-scaling regimes, part sharing yields serial inference linear in the number of levels for an exponential number of objects; in less favorable regimes it offers little serial advantage but still supports linear-time parallel inference at the cost of many nodes [1301.3560]. The explicit lesson is that compositional complexity is reduced only when the number of distinct reusable parts is much smaller than the number of part instances.

At a broader conceptual level, a radically compositional approach to cognitive concepts treats composition as primitive via applied category theory. The paper develops categories, monoidal categories, string diagrams, compositional probability via \(\mathbf{BayesNets}\), dynamical systems via \(\mathbf{DDS}\), and a functor
\[
\mathcal F : \mathbf{BayesNets}\to \mathbf{NeurCirc} \hookrightarrow \mathbf{DDS}
\]
to relate compositional probabilistic models to neural circuits [1911.06602]. This work does not define computational complexity quantitatively; rather, it argues that complexity in cognition and neuroscience is managed by preserving typed compositional structure across representational levels [1911.06602].

## 6. Message-like structure and non-trivial semantics

In emergent communication, compositionality is often formalized by the condition
\[
f((d_i,d_j))=f(d_i)\circ f(d_j),
\]
where derivations \(d\) are recursively structured and \(\circ\) composes representations [2010.15058]. This paper distinguishes trivial compositionality, where semantic composition is set intersection, from non-trivial compositionality (NTC), where composition may be order-sensitive, context-sensitive, entangled, or operator-like, as in negation or “biggest apple” [2010.15058]. Its central empirical result is that most popular metrics—generalization, positional disentanglement, bag-of-words disentanglement, context independence, topographic similarity, and conflict count—fail to detect NTC, whereas tree reconstruction error (TRE) succeeds because it is explicitly grounded in recursive derivation structure [2010.15058]. The point is not that NTC is non-compositional, but that many metrics encode only a narrow, slot-wise notion of composition.

A different communicative notion appears in Local Compositional Complexity (LCC), which targets data that could support a human-readable message. LCC splits the shortest exact description into a structured part and an unstructured residual, and for discrete data defines
\[
LCC(S)=L(C)+L(I)
\]
for the codebook-model \(C\) and index \(I\) in the minimizing exact encoding \((C,I,X)\) [2501.03664]. The paper proposes local compositionality—tree-like reuse of nearby parts—as the relevant structure, and implements it with substring aliasing for text and recursive local GMM clustering for continuous data [2501.03664]. Reported experiments show that the method distinguishes meaningful signals from noise and repetitive signals in text, images, and audio, and that the Arecibo message receives its highest score at the correct \(23\times 73\) aspect ratio [2501.03664]. In this setting, compositional complexity measures the size of reusable hierarchical structure rather than unpredictability or raw Kolmogorov-style incompressibility.

These works widen the concept substantially. Compositional complexity can refer not only to how a system computes, but also to how a representation supports semantics, interpretation, and message-like organization.

## 7. Compositional complexity in materials science

In materials science, compositional complexity denotes chemically heterogeneous composition and the local structural or functional consequences of that heterogeneity. A 2D transition-metal oxide nominally written as \(\mathrm{Ti_{0.87}O_2}\) is shown by atom probe tomography to exhibit several coupled forms of compositional complexity: oxygen deficiency relative to the precursor, retained alkali content, intrinsic Ti-sublattice vacancies, and near-atomic-scale spatial variation, especially for potassium [2601.14807]. The measured residual concentrations in the final nanosheets are \(0.39(1)\) at.% Li, \(1.16(2)\) at.% K, and \(1.14(1)\) at.% C, and frequency-distribution analysis gives \(\mu_{\mathrm{Li}}=0.064\) and \(\mu_{\mathrm{K}}=0.392\), supporting homogeneous Li but clustered K [2601.14807]. The paper interprets these observations as evidence for a reconstruction mechanism involving oxygen vacancies and residual alkali cations that compensates negatively charged Ti-sublattice vacancies [2601.14807].

In medium-entropy MXenes, compositional complexity refers to multimetal occupation of the carbide lattice, as in TiVNbMoC\(_3\) and TiVCrMoC\(_3\), rather than single-metal Ti-based MXenes [2603.25865]. The work reports that annealing at \(200^\circ\)C converts OH terminations to O terminations, reduces adhesion and friction, and, together with higher out-of-plane bending stiffness in the thicker multimetal sheets, leads to ultralow friction. The minimum reported coefficient of friction is 0.0022 for annealed TiVCrMoC\(_3\), below the superlubricity threshold \(<0.01\) and lower than graphene, MoSe\(_2\), and other MXenes measured by the same method [2603.25865]. Here compositional complexity is a design lever coupling chemistry, surface termination, mechanics, and tribology.

A compositionally complex double perovskite,
\[
(\mathrm{La}_{0.4}\mathrm{Nd}_{0.4}\mathrm{Sm}_{0.4}\mathrm{Gd}_{0.4}\mathrm{Y}_{0.4})\mathrm{NiMnO}_6,
\]
illustrates a related but distinct phenomenon [2511.02485]. The rare-earth-site cation-size variance is reported as
\[
\sigma^2 \sim 23.3\ \mathrm{pm}^2,
\]
yet the material still shows robust ferromagnetic ordering with \(T_\mathrm{c}\approx 150\) K, close to the expectation from the average rare-earth ionic radius and consistent with a mean-field picture at high temperature [2511.02485]. Raman spin-phonon renormalization follows the mean-field scaling \(\Delta\omega(T)\propto -M(T)^2/M_{\max}^2\) below \(T_\mathrm{c}\), while at lower temperature the system exhibits reentrant spin-glass-like behavior with \(T^*\sim 35\) K and a magnetic memory effect [2511.02485]. This combination of self-averaging long-range order and disorder-driven low-temperature frustration is a characteristic materials-science manifestation of compositional complexity.

Taken together, these materials papers suggest a usage quite different from the algorithmic one. Compositional complexity is not primarily the cost of nested computation, but the presence of multicomponent chemistry, defect-rich reconstruction, and spatially heterogeneous local environments whose effects may preserve average macroscopic behavior while reshaping microscopic physics.

Source: https://www.emergentmind.com/topics/compositional-complexity