Measure the Coupling First: Interaction Screening for Compound AI Pipelines

Many AI systems are now built as pipelines of separate language-model calls, such as a retriever, a reasoner, a verifier and a formatter. Each stage has its own choices: which model to use, which prompt, which tool. Tuning all of these choices together is expensive, because the number of combinations grows exponentially with the number of stages. Tuning each stage on its own is cheap, but it is only correct when stages do not interact. The literature disagrees about which situation is typical. One study finds interactions between agents explain almost none of the variance in pipeline quality. Another builds elaborate machinery to route feedback through deep chains, on the premise that stages are tightly entangled.

We propose to settle this question empirically before spending the optimization budget. Run a small, statistically designed set of pipeline configurations, which we call a screening experiment. From it, estimate which stages matter at all and which pairs of stages genuinely interact. Then use that estimated "coupling map" to split the search into independent pieces. Tune uncoupled stages one at a time, tune coupled clusters jointly, and leave stages with no measurable effect untouched. The core idea fits in two sentences. Decomposition methods in combinatorial optimization work exactly when the subproblems are weakly coupled. We therefore measure the coupling of a modular AI pipeline cheaply and let the measurement decide how the search is broken up.

Core Claim

A screening budget of roughly a few dozen to a few hundred pipeline evaluations can recover the main effects and two-way interactions of an $N$-stage pipeline well enough for two outcomes. The resulting decomposed search should match the quality of full joint search, at a cost close to stage-by-stage search. It should also avoid the frequent case where optimization makes things worse than doing nothing. The claim is testable in both directions, and it makes a prediction that existing methods do not. Coupling should be concentrated at specific, identifiable boundaries. Examples are a stage that emits a format another stage must parse, a self-refine loop, or shared mutable state. It should not be spread evenly across the pipeline.

Where This Sits

Three lines of work motivate the proposal, and each leaves a specific hole.

Prompt Optimization Is a Coin Flip runs a two-way analysis of variance on two-agent feed-forward pipelines. It finds interaction terms explain only 0.18% to 2.15% of variance, and 49% of 72 optimization runs scored below zero-shot. It uses this as a go/no-go test for whether to optimize at all. We extend the same statistical idea from a whole-pipeline yes/no to a per-boundary map over $N$ stages. We also test it on structures that paper explicitly excludes: cycles, shared state and branching.

Optimizing Model Selection for Compound AI Systems (LLMSelector) turns a $K^N$ model-assignment search into a roughly linear one. It updates stages one at a time with an LLM diagnoser. That approach implicitly bets that stages are separable, and it never checks the bet.

AgentSquare searches jointly over four fixed module slots. It makes this affordable with an LLM surrogate that cuts evaluation cost to about 0.025% of full simulation. Its finding that recombining existing modules beats evolving new ones is itself weak evidence for low coupling.

TextResNet represents the opposite assumption. It treats stages as entangled and routes optimization signals through residual pathways, reaching 46.23 F1 versus 24.86 for TextGrad on a five-stage HotpotQA pipeline. Our screening is meant to say where TextResNet-style joint treatment is warranted. The aim is not to replace it.

The decomposition literature supplies both the method's logic and its main warning. Dogan's bilevel planning–scheduling decomposition and Benders subproblem decomposition for bilevel problems gain orders of magnitude by solving loosely linked subproblems separately. Dogan's method converged in 4.6 versus 525.9 CPU seconds in one regime. The research file also notes that it loses accuracy when tight couplings dominate. That pattern is the hypothesis we transfer: decomposition is a bet on weak coupling, so the bet should be measured.

SupervisorAgent and Test-Time Tool Evolution address runtime pruning. They are complementary, and we do not compete with them.

Research Program

Each stage $i \in \{1,\dots,N\}$ has a small set of candidate settings, such as models, prompt variants or few-shot sets. Let $f(x)$ be validation quality for a full configuration $x$. We use the standard functional decomposition

$$ f(x) = \mu + \sum_i g_i(x_i) + \sum_{i<j} h_{ij}(x_i, x_j) + r(x), $$

where $\mu$ is the mean quality, $g_i$ is the main effect of stage $i$, $h_{ij}$ is the pairwise interaction between stages $i$ and $j$, and $r$ collects higher-order terms. We define the coupling of a boundary as the share of variance carried by its interaction term, $c_{ij} = \mathrm{Var}(h_{ij}) / \mathrm{Var}(f)$.

Screening estimates $g_i$ and $c_{ij}$ from a fractional factorial design. This is a classical experimental design in which each stage is set to two contrasting levels across a structured subset of runs. With $N$ stages, a design able to separate main effects from two-way interactions needs a number of runs that grows roughly polynomially in $N$, far below $K^N$. Each design point is evaluated on a small validation batch with repeated sampling. Repetition is necessary because the Coin Flip study shows that much apparent improvement is noise.

The coupling map is a weighted graph over stages. We prune stages whose main-effect confidence interval includes zero; they keep their default setting. Edges whose coupling falls below a threshold $\tau$ are cut. Each remaining connected cluster becomes one subproblem. Singleton clusters are optimized independently, with LLMSelector-style coordinate updates. Multi-stage clusters are optimized jointly, by exhaustive search when small and by an AgentSquare-style surrogate otherwise. The total budget is fixed, so every API call spent on screening is charged against optimization.

The analysis has three parts. First, we check calibration: does predicted coupling match the interaction measured by exhaustive evaluation on small pipelines where exhaustive evaluation is affordable? Second, we characterize which boundary types produce coupling. Our hypothesis covers format contracts, loops, shared state and parallel branches that later merge. Third, we measure the cost–quality frontier of the decomposed search.

Baselines

The naive reference point is the default pipeline with zero-shot prompts and a single strong model at every stage. The Coin Flip results suggest this reference is often hard to beat. Any method that loses to it on held-out data has failed, whatever its validation score.

The strongest existing method on the model-assignment version of the question is LLMSelector. On TableArithmetic, its heterogeneous assignment reached 100% accuracy versus 44% for the best single model, using 60% fewer API calls than exhaustive evaluation (Optimizing Model Selection for Compound AI Systems). It is the strongest competitor because it already achieves near-linear cost by assuming separability. Our method only earns its keep if that assumption sometimes fails and we detect the failure. We will run it with its published procedure, the same model pool, the same validation and test splits, and the same total API-call budget, with screening calls included on our side.

For prompt-level optimization on HotpotQA, the strongest reported joint method in the file is TextResNet: 46.23 F1 at 21k optimization tokens on a five-component pipeline (TextResNet). We will reproduce it on the same pipeline and match token budgets.

The full joint ceiling is exhaustive search on pipelines small enough to enumerate. Beyond that size, we use a surrogate-guided joint search modeled on AgentSquare at the same budget.

Two ablations isolate the key ingredient. The first keeps our cluster sizes but assigns stages to clusters at random. This tests whether the measured map, rather than mere decomposition, drives gains. The second skips stage pruning. This tests how much of the benefit comes simply from not touching stages with no effect.

Beating the field means one of two outcomes at equal budget. The method could match the joint ceiling within confidence intervals while costing no more than LLMSelector plus screening. Alternatively, it could beat LLMSelector significantly on pipelines where screening flags coupling. It must also never fall below the zero-shot reference.

Why not just…?

Why not just optimize each stage independently, since interactions are known to be tiny? This is the real threat, and we treat it as a live hypothesis rather than a strawman. The 0.18–2.15% interaction share comes from two-agent feed-forward pipelines only (Prompt Optimization Is a Coin Flip). It says nothing about loops, shared state or deeper chains. If coordinate-wise optimization matches the joint ceiling on every pipeline we test, including the looped and branched ones, then coupling-aware decomposition is unnecessary. In that case, the useful contributions shrink to stage pruning and to evidence for when independence is safe. We will report that outcome as such.

Why not just run a full joint search with a cheap surrogate? AgentSquare's surrogate makes joint search affordable over four fixed slots. However, surrogate error compounds as the space grows, and joint search spends budget exploring combinations of stages that do not matter. Under equal budget, the comparison against our surrogate-based joint baseline shows directly whether decomposition reallocates calls more effectively as $N$ grows.

Why not just use TextResNet everywhere? TextResNet requires additive delta representations and a fixed topology. It also spends optimization effort on every boundary. If our coupling maps show entanglement is concentrated at a few boundaries, applying joint feedback routing only there should match its HotpotQA F1 at lower token cost. If its gains instead come from boundaries our screening marks as uncoupled, the screening is miscalibrated, and the calibration experiment will expose it.

Proposed Experiments

We use pipelines that span a range of expected coupling. At the low end are the two-agent feed-forward HotpotQA pipelines from the Coin Flip study. The five-stage HotpotQA pipeline from TextResNet adds depth. TableArithmetic and TableBias from LLMSelector contribute Locate→Solve pipelines, and its Self-Refine and Multi-Agent Debate pipelines contribute loops. HelpSteer2 provides strict JSON output, a format contract on which optimizers reportedly gained up to +6.8 points. To test parallel branches that later merge, we build DAG pipelines from WorFBench task graphs using the zjunlp/WorfBench code. We also add controlled variants that plant coupling. One makes the Solve stage depend on a delimiter convention chosen by the Locate stage. Another gives two stages shared scratch memory. Metrics are held-out accuracy or F1, total API calls and tokens including screening, and wins and losses against zero-shot across seeds.

Three checks decide the question. First, on enumerable pipelines, screened coupling must rank boundaries consistently with exhaustively measured interaction. If it does not, the method fails at its foundation. Second, on planted-coupling variants, coordinate-wise optimization should degrade while the decomposed search should not. If both behave the same, the planted coupling was not real or not exploitable. Third, on natural pipelines, we compare where coupling concentrates against the predicted boundary types. If the predictions hold, they give practitioners a rule for when cheap independent tuning is safe and when it is not.