Test, then Route: How Language Models Execute In-Context Conditional Rules Across Models and Languages

๐Ÿ“… 2026-08-04
๐Ÿ“ˆ Citations: 0
โœจ Influential: 0
๐Ÿ“„ PDF
๐Ÿค– AI Summary
This study investigates how language models implement conditional rules of the form โ€œif P(x) then A else B,โ€ specifically examining whether such behavior relies on dissociable โ€œtestโ€ and โ€œroutingโ€ modules. Through activation patching, residual stream analysis, and cross-lingual and cross-rule transfer experiments across multiple models and languages, the authors systematically probe the underlying mechanisms. They find that predicate truth values are locally encoded in intermediate residual layers, with test signals exhibiting high stability and strong transferability across predicate families. In contrast, routing directions are highly token-dependent and generally non-transferable across models, except in Gemma-3-4B, which demonstrates remarkable cross-lingual consistency (โ‰ˆ0.98). This work provides the first empirical evidence for the separability of the โ€œtestโ€ component in conditional reasoning and reveals that โ€œroutingโ€ does not operate as a universal abstract mechanism.
๐Ÿ“ Abstract
When a language model follows an in-context conditional rule such as "if P(x) then A else B," does it assemble a runtime circuit with one module that tests the predicate and another that routes the answer? We probe this with activation patching under a four-donor design whose two swapped-rule donors make the condition and the answer word disagree, so each layer reveals which of the two it carries. Across three open models from two families and six languages sharing one fixed item bank, a mid-stack residual band carries the predicate's truth value: patching it reroutes the answer with predicate-outcome flip near 1.0 and mapping flip near 0.0, meeting a strict pre-specified isolation criterion in 17 of 18 cells, and the same localization holds across five predicate families. The router shows the opposite profile. A learned subspace flips A and B near-perfectly within the trained pair yet transfers to a new pair at approximately 0 in every model, while in Gemma-3-4B (the only model probed cross-lingually) it transfers at approximately 0.98 to the same pair in other languages. Under every probe we ran, the router direction is token-bound and non-transferable (largely answer-readout in Gemma, pair-specific in Qwen) rather than an abstract routing module. Test is modular; under these probes, route is not.
Problem

Research questions and friction points this paper is trying to address.

in-context learning
conditional reasoning
modularity
language models
activation patching
Innovation

Methods, ideas, or system contributions that make the work stand out.

activation patching
modular reasoning
in-context learning
cross-lingual transfer
conditional rule execution
L
Luxshan Thavarasa
Independent Researcher, Colombo, Sri Lanka
S
Sivasuthan Sukumar
Department of Computer Science and Engineering, University of Moratuwa, Sri Lanka