Relay or Direct Hop? Serial Mediation of Long-Distance Agreement in Language Models

When a language model writes "The books that I left at my friend's house last week are missing," the number feature of "books" has to reach the position where "are" is predicted, across a dozen intervening words. That information could travel by two routes. In the first, an attention head at the verb position looks straight back at the subject, which we call a direct hop. In the second, the feature is copied forward in stages through intermediate words that sit on the sentence's grammatical tree, such as the relative pronoun or the clause boundary, and each later stage reads from the one before it, which we call a relay. Psychologists use a tool built for exactly this kind of question. Chain (serial) mediation analysis asks how much of a cause's effect flows through an ordered sequence of intermediate variables $M_1 \to M_2 \to Y$, and how much bypasses them. We propose to apply that decomposition inside transformers, placing the intermediate variables at token positions chosen from the dependency tree. The goal is to measure, for each sentence, how much of the agreement signal travels by relay and how much by direct hop, and to test whether the breakdown of long-distance syntax with depth is a breakdown of the relay.

The question matters because two observations sit uneasily together. Behavioral benchmarks show that models handle simple agreement almost perfectly but degrade with intervening material and fail on unbounded dependencies. The neural-mediation work that has looked inside models has done so one component at a time, and it found that effects add up across components. That additivity is the signature of parallel, independent routes. It is not what a staged relay produces. If long-range syntax depends on relays and short-range coreference does not, the single-component view would systematically miss the mechanism that fails.

Core Claim

We hypothesize that the agreement or filler-gap signal reaching the prediction site splits into a direct effect and a serial indirect effect routed through tree-path positions. We further hypothesize that the serial share grows with syntactic embedding depth, not with linear distance alone, and that weakening of the serial path predicts which items a model gets wrong. Single-site interventions cannot test this, because they report where information is necessary without saying whether two sites act in series or in parallel. The serial indirect effect is the quantity that separates the two. The claim is falsifiable in an informative way. If the direct effect dominates at every depth and errors track its decay, the relay hypothesis is wrong, and "syntactic amnesia" would instead be a capacity failure of single attention hops.

Relation to Prior Work

Three papers motivate this work by applying counterfactual mediation to language models, each with one mediator at a time. Causal Mediation Analysis for Interpreting Large Language Models frames models as causal graphs and decomposes total effects into direct and indirect parts for single components. It includes subject-verb agreement across distances, and it flags long-range structure as a confounder of clean isolation. Investigating Gender Bias in Language Models Using Causal Mediation Analysis finds that 10 of 144 heads in GPT-2 small carry almost all of the indirect effect, and that individual head effects approximately sum to the total. We read that additivity as a property of short coreference templates. Our proposal predicts it will break down as depth grows, and the size of the interaction term is the evidence. Skill Path: Unveiling Language Skills from Circuit Graphs extracts linear chains of components for previous-token, induction and in-context skills, using mediation after pruning to remove background effects. It supplies the closest method, but its chains run over layers and components, not over syntactically defined positions, and it never touches syntax. We differ by indexing the candidate mediators with the dependency tree and by estimating a serial effect explicitly, rather than extracting a path and reporting overlap.

On the syntax side, BLiMP and Exploring Gaps in the APS provide the behavioral targets. The second also constrains us: it shows that difference-in-differences surprisal metrics pick up lexical frequency noise. We therefore score outcomes as direct logit differences on vetted minimal pairs. Enhancing the Transformer Decoder with Transition-based Syntax reports that scaling does not cure amnesia in decoders and fixes it architecturally with a head biased toward each token's syntactic parent. That fix amounts to bolting on a direct hop to the parent. Our analysis asks what vanilla models do instead. Probing for Labeled Dependency Trees shows that tree structure is linearly decodable around layer 6 in mBERT, but it cannot show that the model uses this information, and it fails on clausal relations. We use the probe as a competitor, not as evidence.

One analogy to the classical literature constrains rather than helps. Causal mediation analysis with one or multiple mediators: a comparative study shows that observational mediation estimators suffer under misspecification and poor overlap, and it recommends robust estimators. Inside a network we can intervene exactly, so identification is not the problem and those estimators are unnecessary. What carries over is the estimand: a sequential decomposition with explicit nested counterfactuals.

Research Program

Let $x$ be the clean sentence and $x'$ its minimal-pair counterpart with the subject's number flipped. Let $M_1$ be the residual-stream state at an early tree-path site, given as a (position, layer) pair, and $M_2$ a later site closer to the verb. Let $Y$ be the logit difference between the correct and incorrect verb form. The serial indirect effect is the change in $Y$ when $x'$ affects $M_1$, and $M_1$ is allowed to influence the output only through $M_2$:

$$\mathrm{SIE} = Y\big(x,\, M_1(x),\, M_2(x, M_1(x'))\big) - Y\big(x,\, M_1(x),\, M_2(x, M_1(x))\big).$$

This takes three forward passes. The first records $M_1$ on $x'$. The second runs $x$ with that value patched into $M_1$ and records the resulting $M_2$. The third runs $x$ clean and patches only $M_2$ with the recorded value. The total effect splits into a direct remainder, the parallel indirect effects through $M_1$ alone and $M_2$ alone, and the serial term. We report the serial share as SIE divided by the total effect. We extend this to chains of length $k$ along the tree path for deeper sentences.

Candidate mediator sites come from the dependency path between subject and verb, for example the subject noun, then the relative pronoun, then the embedded verb, then the main-clause re-entry point, then the pre-verb position. Each on-path site gets an off-path control site matched for linear position and layer. Because a search over all layer pairs multiplies the number of comparisons, we use half the items to choose layers and the other half to report effects.

We build controlled stimuli in which embedding depth (zero to three relative or complement clauses) is crossed with linear distance, which is adjusted by adding adjectives or prepositional phrases inside a fixed tree. This crossing separates "depth" from "length," which BLiMP's natural variation confounds. We also draw natural agreement instances from the English EWT treebank in Universal Dependencies v2, using its gold parses for the paths. The models are GPT-2 small through XL, which allows comparison with prior mediation work, and the Pythia suite. Pythia's 154 checkpoints per model, trained on identical data in identical order, let us ask whether relays emerge after direct hops during training, as stratification results in Skill Path would suggest.

Baselines

The naive reference point is behavioral accuracy plotted against linear distance and depth, with no internal analysis. If depth alone predicts item-level errors as well as our mediation quantities do, the internal decomposition adds nothing predictive. We report it on the same items. For context, BLiMP reports GPT-2 at 83.0% overall and above 99% on some agreement sets, with island effects only slightly above chance. On parasitic gaps, GPT-2 reaches 51.5% direct-preference accuracy and 87.9% under difference-in-differences (Exploring Gaps in the APS).

The strongest existing method is single-site mediation in the style of Causal Mediation Analysis for Interpreting Large Language Models and Investigating Gender Bias. It computes the indirect effect at every (position, layer) site independently and sums the top sites. We run it with the same counterfactual pairs, the same models, the same site grid and the same number of forward passes as our method. It also gets the same held-out layer selection, so neither method benefits from searching more. A second strong competitor is Skill Path's pruned linear chain (Skill Path), run with agreement minimal pairs as the counterfactual inputs.

The main metric is the area under the ROC curve for predicting, on held-out items, whether the model chooses the wrong verb form. Prediction is from the per-item quantities each method produces. We found no result on Lacuna for any method on item-level prediction of agreement failures, so this comparison has no published number. Beating the baseline means a significant AUROC gain over single-site sums and over depth alone, measured on held-out items and replicated across at least two model families.

Two further references complete the comparison. Attention weight from the verb position to the subject serves as a proxy for the direct hop. DEPPROBE-style tree-distance probes serve as a proxy for structural encoding. The key ablation keeps everything fixed but chooses mediator sites by linear position instead of tree path. If linear chains explain as much serial effect as tree-path chains, the "syntactic relay" reading collapses into a generic "information moves forward" story.

Why not just…?

Why not just patch each site separately and read off where the signal lives? Single-site patching is the real threat. If the summed single-site effects already predict failures, our extra passes are wasted. The gender-bias paper found approximate additivity, which suggests single sites may suffice for short coreference. Additivity is precisely what a relay violates: under a relay, two sites in series each look necessary, yet their effects overlap rather than add. The decisive test compares AUROC and measures the interaction gap, defined as the sum of single-site effects minus the total effect, as a function of depth. If the gap stays near zero at depth three, we concede the point.

Why not just look at attention from the verb to the subject? Attention weights are cheap, but the mediation-for-LLMs paper and Skill Path both argue that attention patterns mix causally active routes with background processing. More to the point, a relay predicts low verb-to-subject attention on exactly the deep items the model still gets right. We test this directly: if attention weight predicts errors as well as the serial share does, the relay framing is unnecessary.

Why not just probe for the tree? DEPPROBE shows that tree distance is decodable, but decodability does not imply use, and the probe is weakest on clausal relations, which are the ones our deep stimuli require. We include probe-derived tree distance as a predictor. The proposal survives only if the serial share adds predictive power beyond it.

Why not just fine-tune or add a parent-attention head? The transition-syntax decoder improved 18 of 20 challenge categories over a vanilla transformer and gained 0.7–1.1 BLEU on WMT (Enhancing the Transformer Decoder). That shows what to build, not why vanilla models fail. Our analysis does not compete with it on accuracy. If the relay hypothesis holds, it explains why a parent-attention head helps: the head replaces a fragile relay with a direct hop.

Decisive Checks

The first check is the depth-versus-length dissociation. On the crossed stimuli, the serial share should rise with depth when length is held fixed, and stay flat with length when depth is held fixed. The on-path versus off-path contrast should hold within each cell.

The second is a repair intervention on items the model gets wrong. We patch the relay site with its value from a correctly handled shallow sentence that shares the subject. This should restore the correct verb more often than patching the highest-scoring single site or the off-path control at matched norm. A null result here would mean the relay is real but not where failures arise.

The third is a transfer test. We take the relay sites identified on agreement and check whether they also carry the signal in filler-gap items from BLiMP and the parasitic-gap set. We also run the same analysis on particle-verb items from the challenge sets of Choshen and Abend. Shared sites would point to a general syntactic transport route rather than a mechanism specific to agreement.

The fourth comes from the Pythia checkpoints: we track whether the serial share appears later in training than the direct effect. Because the proposal reports its quantities as ratios of each model's own total effect, it avoids the cross-architecture scale problem raised in prior mediation work. We will still report prompt-paraphrase variance for every estimate.