Papers
Topics
Authors
Recent
Search
2000 character limit reached

Structural Merge: Principles & Applications

Updated 12 July 2026
  • Structural merge is a family of structure-aware merge disciplines that operates on explicit representations, ensuring domain-specific invariants are preserved.
  • Techniques span applications from approximate nearest-neighbor indexing and syntax-aware software integration to CRDT-based neural merging, each optimizing for navigability, parsability, or consistency.
  • Empirical studies demonstrate significant improvements in speed, accuracy, and conflict reduction compared to traditional merging methods across multiple disciplines.

Structural merge is a domain-dependent term for merge procedures that operate on an explicit structural representation rather than on raw text, naïve pairwise operators, or full reconstruction. In the literature, it denotes cross-graph edge construction for approximate nearest-neighbor indexes, syntax-aware or semistructured software integration, partition-based graph decompositions and merge-models, CRDT-compliant neural model merging, operadic and Hopf-algebraic realizations of linguistic Merge, and metric averages of merge trees in topological data analysis (Jing et al., 19 Feb 2026, Mori et al., 8 Jul 2026, Buffière et al., 27 Mar 2026, Gillespie, 16 May 2026, Marcolli et al., 21 Dec 2025).

1. Domain-dependent meanings and common invariants

The expression does not name a single algorithm. It names a methodological pattern: the merge step is constrained by a structured carrier and judged against explicit invariants internal to that carrier.

Research area Structured object Merge objective
AKNN indexing Proximity-graph sub-indexes Restore cross-graph navigability
Software integration AST/CST nodes, includes, macros, separator-delimited fragments Incorporate edits while controlling conflicts
Structural graph theory Partitions, resolved pairs, tree-ordered weakly sparse models Encode graphs by merge sequences or merge-models
Neural model merging Contribution sets, canonical orders, similarity-feature plans Enforce SEC or select merge plans
Linguistics, topology, data structures Rooted forests, function-space encodings, merge trees, ordered sets Formalize Merge, average trees, or merge interleaved structures

A recurring pattern is that structural merge makes the correctness criterion representation-specific. In AKNN graph indexing, the criterion is bounded-degree navigability with restored cross-graph traversals. In software merge, it is variously parsability and universality, AST/CST consistency, reduced spurious conflicts, or preservation of structured code elements. In merge-width and merge-models, it is first-order recoverability from a coarsening sequence or a tree-ordered weakly sparse representation. In distributed neural merging, it is Strong Eventual Consistency obtained by separating a CRDT state from a deterministic merge function. In linguistic formulations, it is root-grafting under algebraic constraints such as the Extension Condition (Jing et al., 19 Feb 2026, Cavalcanti et al., 2024, Dreier et al., 25 Feb 2025, Gillespie, 16 May 2026, Marcolli et al., 27 Nov 2025).

This suggests that structural merge is best understood as a family of structure-aware merge disciplines, not as a single computational primitive.

2. Structural merge in approximate nearest-neighbor indexing

In vector databases, structural merge arises when a large dataset is partitioned into multiple proximity-graph sub-indexes because memory is insufficient to build one complete graph at once. Searching the partitions separately scales query cost roughly by the number of partitions and discards cross-graph links; with 50 partitions, separated search runs at about $1/6$ the QPS of a complete index at comparable recall. The structural merge objective is therefore to add cross-graph edges E×E_\times so that a merged graph

V=Va∪Vb,E=Ea∪Eb∪E×V = V_a \cup V_b,\qquad E = E_a \cup E_b \cup E_\times

recovers single-index-like traversals without rebuilding from scratch (Jing et al., 19 Feb 2026).

The formal setting is approximate kk nearest-neighbor search over X⊂RDX \subset \mathbb{R}^D, with

Recall@K=∣AKNN(q)∩KNN(q)∣K.\text{Recall@K}=\frac{|\text{AKNN}(q)\cap \text{KNN}(q)|}{K}.

The paper focuses on two-index merging and on merge order selection for many partitions. Its reverse neighbor sliding merge (RNSM) is organized into neighbor expansion, reverse-neighbor-based pivot selection, and sliding merge. The source graph is first densified to size k+k^+, reverse kk-NN sets Rk(u)R_k(u) are built, pivots are chosen greedily by descending reverse degree ∣Rk(u)∣|R_k(u)|, and each follower performs a local search in the target graph initialized from its pivot’s result. Candidate sets are then pruned by RNG-style sparsification to preserve the degree bound E×E_\times0 and navigability.

The cost model is the number of distance computations. A naive search from the default entry has average cost E×E_\times1, while a sliding search started near the query is substantially cheaper. The dominating-pivot formulation is NP-hard by reduction to minimum dominating set, so the method uses a greedy structural heuristic. Empirically, the number of pivots is a small fraction of the source vertices, reported as E×E_\times2–E×E_\times3, which shifts the dominant term from E×E_\times4 to roughly E×E_\times5. The local sliding ratio rises from E×E_\times6 at E×E_\times7 to E×E_\times8 at E×E_\times9 on DEEP10M, which the paper interprets as evidence that reverse-neighbor hub selection maximizes reuse.

For many partitions, merge order selection (MOS) replaces naive V=Va∪Vb,E=Ea∪Eb∪E×V = V_a \cup V_b,\qquad E = E_a \cup E_b \cup E_\times0 pairwise merging with a sparse connected merge-order graph subject to a degree bound V=Va∪Vb,E=Ea∪Eb∪E×V = V_a \cup V_b,\qquad E = E_a \cup E_b \cup E_\times1 and a diameter bound V=Va∪Vb,E=Ea∪Eb∪E×V = V_a \cup V_b,\qquad E = E_a \cup E_b \cup E_\times2, typically V=Va∪Vb,E=Ea∪Eb∪E×V = V_a \cup V_b,\qquad E = E_a \cup E_b \cup E_\times3. For clustered partitions, costs are based on centroid distances; for random partitions, V=Va∪Vb,E=Ea∪Eb∪E×V = V_a \cup V_b,\qquad E = E_a \cup E_b \cup E_\times4. The greedy MOS algorithm runs in V=Va∪Vb,E=Ea∪Eb∪E×V = V_a \cup V_b,\qquad E = E_a \cup E_b \cup E_\times5 time and, with V=Va∪Vb,E=Ea∪Eb∪E×V = V_a \cup V_b,\qquad E = E_a \cup E_b \cup E_\times6 and small V=Va∪Vb,E=Ea∪Eb∪E×V = V_a \cup V_b,\qquad E = E_a \cup E_b \cup E_\times7, typically takes V=Va∪Vb,E=Ea∪Eb∪E×V = V_a \cup V_b,\qquad E = E_a \cup E_b \cup E_\times8–V=Va∪Vb,E=Ea∪Eb∪E×V = V_a \cup V_b,\qquad E = E_a \cup E_b \cup E_\times9 seconds.

The reported speedups are substantial. RNSM yields up to kk0 speedup over FGIM and up to kk1 over full reconstruction while maintaining the expected recall–QPS tradeoff. In multi-index merging, RNSM+MOS reaches up to kk2 over naive merge, kk3 over FGIM, and kk4 over rebuild on MARCO10M. It scales to DEEP100M with up to 50 partitions, and compared with overlapping shard construction from scratch it reduces total build time by up to kk5 while achieving comparable recall and QPS (Jing et al., 19 Feb 2026).

3. Structural merge in software integration

In software engineering, structural merge contrasts with line-based three-way merge by operating on program structure. One formalization requires that the output be parsable and universal. Parsability means syntactic validity in the target language. Universality is defined by a pushout condition on edit morphisms kk6 and kk7: the merge result kk8 must satisfy kk9, and every other commuting square must factor uniquely through X⊂RDX \subset \mathbb{R}^D0. The corresponding implementation, d3j, models edits as order-preserving partial inclusion maps over Java ASTs, checks four node-level universality conditions, and rejects merges that are unparsable or non-universal. On 43,774 Java file scenarios from 76 projects, d3j produced 39,541 conflict-free merges with 0 unparsable and 0 non-universal outputs; in the same experiment, Git’s merge had 40 non-universal conflict-free merges, JDime had 89 unparsable and 128 non-universal results, and Spork had 213 unparsable and 1,573 non-universal results (Mori et al., 8 Jul 2026).

A less formal but operationally important line of work is semistructured merge. Sesame uses language-specific syntactic separators rather than full parsing for lower-level structure. For Java, it inserts separator lines around {, }, (, ), and ;, calls diff3 on the transformed text, and then removes placeholder lines. This emulates statement- and block-level separation without building a full AST. On 9,510 Java file triples, merge conflicts drop from 2,413 with diff3 to 1,413 with Sesame, versus 1,632 with s3m; conflicting files drop from 1,090 to 657, versus 832 with s3m. The trade-off is the familiar one: Sesame sharply reduces added false positives but increases added false negatives, including 168 relative to diff3 and 48 relative to s3m (Cavalcanti et al., 2024).

A fully AST-based Java implementation is Spork, which combines Spoon parsing, GumTree matching, a 3DM-based merge over ordered trees, and high-fidelity formatting preservation by reusing original source regions. It separates structural PCS triples from content tuples, records hard inconsistencies as conflicts, and applies localized fallbacks for cases such as delete/delete or insert/delete list conflicts. In 1,740 real-world file merges from 119 projects, Spork reports 227 conflict hunks, compared with 376 for JDime and 245 for AutoMergePTM; its median line diff to the developer-committed merge is 65, versus 308.5 and 314.5, and its median runtime is 1.17 seconds, with maximum 11.9 seconds and no timeouts (Larsén et al., 2022).

Generic structured merge pursues similar objectives without language-specific merge engines. LastMerge uses Tree Sitter CSTs, a thin configuration interface for unordered nodes and identifier extraction, and matching/merging strategies derived from language-specific tools. In a replay of 5,229 Java merge scenarios, the study reports no evidence that generic structured merge significantly impacts merge accuracy relative to language-specific baselines. The disagreement rate is 7.53% between LastMerge and jDime and 12.22% between Mergiraf and Spork. LastMerge reports 15% fewer false positives than jDime, while Mergiraf misses 42% fewer false negatives than Spork. Runtime is comparable to state-of-the-art language-specific implementations, and LastMerge integrates 80.2% of scenarios in under 3 seconds (Duarte et al., 25 Jul 2025).

Another use of the term appears in conflict-resolution learning for C++. The Microsoft Edge study defines structural merge conflicts as conflicts involving structured constructs, especially includes and macros. It introduces a DSL of guarded concatenation and removal over Main/Fork fragments and learns conflict-resolution programs by example with Microsoft PROSE. On eight weeks of data, the learned strategies resolve 11.44% of total C++ conflicts, corresponding to approximately 41% of 1–2 line C++ conflicts, at 93.2% accuracy; on a later four-week validation set, accuracy is 91.17% (Pan et al., 2021).

A contrasting data-driven approach is DeepMerge, which deliberately abandons AST structure in favor of edit structure. It models X⊂RDX \subset \mathbb{R}^D1 with an edit-aware alignment of the two diffs against the base and a pointer-network decoder that copies lines from the conflicting sides. On 8,719 non-trivial JavaScript conflict tuples, DeepMerge achieves 36.50% top-1 exact-match accuracy overall and 78.40% for conflicts with up to 3 lines, while the semistructured baseline resolves about 3.7%–4% correctly. In this sense, structural merge in software is not exhausted by full AST algorithms; semistructured, pattern-based, and edit-structured variants coexist, with different safety and accuracy trade-offs (Dinella et al., 2021).

4. Structural merge in graph theory, logic, and graph algorithms

In structural graph theory, structural merge is the viewpoint behind merge-width. A graph is coarsened by a construction sequence or merge sequence consisting of partitions X⊂RDX \subset \mathbb{R}^D2 and resolved pairs X⊂RDX \subset \mathbb{R}^D3. At each stage, unresolved pairs between any two parts are homogeneous: all are edges or all are non-edges. The radius-X⊂RDX \subset \mathbb{R}^D4 width counts how many parts are reached from a vertex by paths of at most X⊂RDX \subset \mathbb{R}^D5 resolved edges, and the radius-X⊂RDX \subset \mathbb{R}^D6 merge-width X⊂RDX \subset \mathbb{R}^D7 is the minimum such width over all merge sequences. Bounded merge-width unifies bounded expansion and bounded twin-width, is closed under first-order transductions, and yields fixed-parameter tractability of first-order model checking when a witnessing construction sequence is given. The paper proves, for a sentence of quantifier rank X⊂RDX \subset \mathbb{R}^D8, an algorithm running in time X⊂RDX \subset \mathbb{R}^D9 on graphs with radius-Recall@K=∣AKNN(q)∩KNN(q)∣K.\text{Recall@K}=\frac{|\text{AKNN}(q)\cap \text{KNN}(q)|}{K}.0 width Recall@K=∣AKNN(q)∩KNN(q)∣K.\text{Recall@K}=\frac{|\text{AKNN}(q)\cap \text{KNN}(q)|}{K}.1, where Recall@K=∣AKNN(q)∩KNN(q)∣K.\text{Recall@K}=\frac{|\text{AKNN}(q)\cap \text{KNN}(q)|}{K}.2. It also establishes Recall@K=∣AKNN(q)∩KNN(q)∣K.\text{Recall@K}=\frac{|\text{AKNN}(q)\cap \text{KNN}(q)|}{K}.3 when Recall@K=∣AKNN(q)∩KNN(q)∣K.\text{Recall@K}=\frac{|\text{AKNN}(q)\cap \text{KNN}(q)|}{K}.4, Recall@K=∣AKNN(q)∩KNN(q)∣K.\text{Recall@K}=\frac{|\text{AKNN}(q)\cap \text{KNN}(q)|}{K}.5 when Recall@K=∣AKNN(q)∩KNN(q)∣K.\text{Recall@K}=\frac{|\text{AKNN}(q)\cap \text{KNN}(q)|}{K}.6, and bounded Recall@K=∣AKNN(q)∩KNN(q)∣K.\text{Recall@K}=\frac{|\text{AKNN}(q)\cap \text{KNN}(q)|}{K}.7 if and only if clique-width is bounded (Dreier et al., 25 Feb 2025).

Merge-models turn this decomposition viewpoint into a representation theorem. A merge-model is a tree-ordered Recall@K=∣AKNN(q)∩KNN(q)∣K.\text{Recall@K}=\frac{|\text{AKNN}(q)\cap \text{KNN}(q)|}{K}.8-structure with a tree order Recall@K=∣AKNN(q)∩KNN(q)∣K.\text{Recall@K}=\frac{|\text{AKNN}(q)\cap \text{KNN}(q)|}{K}.9, polarity relations k+k^+0, non-crossing constraints, exclusivity of polarities, and full coverage at leaves. For every pair of leaves k+k^+1, there is a unique maximal pair k+k^+2 carrying an k+k^+3-label, and a fixed first-order interpretation k+k^+4 recovers the original binary structure by reading whether k+k^+5 holds at k+k^+6. A merge-model can be built from a merge sequence, and the corresponding ranked model width equals the merge-sequence radius-k+k^+7 width. The main transfer theorem states that any binary relational structure k+k^+8 has a compact merge-model k+k^+9 with

kk0

Twin-models arise as special cases, and classes of bounded twin-width are exactly those admitting loopless merge-models of bounded radius-kk1 merge-width and bounded biclique number, for some sufficiently large constant kk2 (Buffière et al., 27 Mar 2026).

The same structural apparatus supports approximation algorithms. For graphs of bounded radius-2 merge-width, there is a constant-factor LP-based approximation for Maximum Distance-2 Independent Set and, via earlier results on neighborhood complexity, for Minimum Dominating Set. The paper gives a greedy rounding with factor

kk3

for Max Dist-2 Independent Set, where kk4 bounds kk5, kk6 bounds kk7, and kk8 is the duality order, and combines it with an kk9 LP gap for Min Dominating Set to obtain a bounded domination-to-2-independence ratio

Rk(u)R_k(u)0

The bound is tight with respect to the radius parameter: the ratio can be unbounded on classes of bounded radius-1 merge-width (Dumas, 30 Jun 2026).

5. Structural merge in neural model merging

One neural use of structural merge is explicitly algebraic. The CRDTMergeState architecture argues that raw neural merge operators do not satisfy the commutativity, associativity, and idempotency required of state-based CRDT merges. The paper proves this structurally for normalization-based merges and exhibits failures for weight averaging, SLERP, TIES, DARE, Fisher-weighted merging, and evolutionary schemes. On controlled Rk(u)R_k(u)1 tensors, 21 of 26 strategies pass commutativity, 14 of 26 pass idempotency, only 1 of 26 passes associativity, and 0 satisfy all three axioms. The proposed remedy is a two-layer design: Layer 1 is an OR-Set CRDT over contributions with state Rk(u)R_k(u)2, visible set

Rk(u)R_k(u)3

and merge given by union on Rk(u)R_k(u)4 and Rk(u)R_k(u)5, componentwise max on Rk(u)R_k(u)6, and recomputation of the Merkle root Rk(u)R_k(u)7. Layer 2 applies a deterministic pure function to the canonically hash-sorted visible set: Rk(u)R_k(u)8 This yields Strong Eventual Consistency even when the inner strategy Rk(u)R_k(u)9 is itself non-associative. Empirically, the wrapper makes 26 of 26 strategies pass CRDT properties, with 104/104 controlled tests, 43,368 layer-level checks on production-scale models up to 7.24B parameters, convergence on 100 nodes across 20 orderings, and CRDT overhead below 0.5 ms (Gillespie, 16 May 2026).

A different neural meaning emphasizes structure-aware selection rather than CRDT semantics. SimMerge computes functional signals from a small unlabeled probe set—KL divergence of next-token distributions and activation cosine similarities—and structural signals—weight cosine similarity, weight ∣Rk(u)∣|R_k(u)|0 distance, parameter norms, and attention-pattern cosine similarities. These features are used to predict the best pairwise merge operator among linear interpolation, SLERP, and TIES, and to score multiway merge orders without running expensive merge-and-evaluate loops. On 7B pairwise merges, SimMerge closes 65.0% of the expert–auxiliary gap macro-averaged across domains, compared with 41.8% for the best fixed operator. For multiway 7B merges, its selected 3-way order improves GapClosed over random order by +47% on Code, +16% on Math, +11% on Multilingual, and +21% on RAG. The same selector transfers to 111B merges without retraining, where degradation versus the expert is ∣Rk(u)∣|R_k(u)|1, compared with ∣Rk(u)∣|R_k(u)|2 for Linear, ∣Rk(u)∣|R_k(u)|3 for SLERP, and ∣Rk(u)∣|R_k(u)|4 for TIES (Bolton et al., 14 Jan 2026).

The two neural usages are therefore distinct. In CRDT-based work, structural merge refers to the state layer that guarantees convergence independently of the tensor operator. In SimMerge, it refers to structure-aware prediction of operators, subsets, and merge order.

6. Algebraic, topological, and data-structural formulations

In formal syntax, structural merge is literalized as an algebraic realization of Merge. One construction maps lexical items to functions and defines a faithful representation of syntactic objects in the same function space through the thermodynamic semiring addition

∣Rk(u)∣|R_k(u)|5

With second Rényi entropy, the addition is commutative and non-associative, and the embedding satisfies

∣Rk(u)∣|R_k(u)|6

The same paper interprets syntactic trees as an algebra over an operad and treats Merge on workspaces through a coproduct and Hopf-algebraic dynamics (Marcolli et al., 17 Jul 2025). A related line formalizes the Extension Condition as root-only growth: grafting is a Hochschild 1-cocycle, while non-root insertions are derivations but not 1-cocycles, so EC is presented as an intrinsic algebraic constraint rather than an auxiliary stipulation. Sideward Merge is then analyzed as a structurally legal but suboptimal operation under Resource Restriction and Minimal Search cost functions (Marcolli et al., 27 Nov 2025). The workspace dynamics itself is studied as a Hopf algebra Markov chain,

∣Rk(u)∣|R_k(u)|7

with Internal Merge forming an ergodic subsystem with uniform stationary distribution on each partition class, while Sideward Merge pushes mass toward disconnected workspaces unless the dynamics is weighted by an additional entropy-based economy criterion (Marcolli et al., 21 Dec 2025).

In topological data analysis, structural merge means something else again: a structural average of labeled merge trees. A labeled merge tree ∣Rk(u)∣|R_k(u)|8 induces a symmetric matrix ∣Rk(u)∣|R_k(u)|9 with

E×E_\times00

and the interleaving distance between labeled merge trees is the E×E_\times01 distance between their induced matrices. The structural average is defined as a 1-center in this metric space. For trees in full label agreement, the average induced matrix is computed elementwise from the extrema of the input matrices and then converted back into a merge tree via a complete-graph filtration. For partial or absent label agreement, the paper uses minimum-weight matching heuristics based on intrinsic tree distance, Euclidean distance, or a linear combination of both. It further defines vertex and edge consistency measures and geodesics obtained by linear interpolation of induced matrices (Yan et al., 2019).

In classical data structures, structural merge denotes reorganization of the maintained structure rather than element-by-element reinsertion. Mergeable dictionaries support predecessor search, split, and merge on a collection of disjoint ordered sets, and the key result is that arbitrarily interleaved sets can be merged in E×E_\times02 amortized time, even in the presence of split, by using weighted biased skip lists whose local weights are tied to adjacent gaps (Iacono et al., 2010). Mergeable trees study a related but distinct operation: merging two upward paths in a rooted heap-ordered forest. In the general case, a merge can change many arcs yet is supported in E×E_\times03 amortized time, while the no-cut case admits E×E_\times04 time per operation, and the no-cut/no-parent case also has an E×E_\times05 solution via standard dynamic trees as a black box (0711.1682).

Taken together, these literatures suggest a stable high-level characterization. Structural merge replaces flat combination by a merge defined over a representation that makes invariants explicit: graph navigability, AST or CST well-formedness, pushout universality, first-order recoverability, CRDT convergence, root-grafting, metric centrality, or balanced dynamic-tree structure. The term is therefore unified less by a common implementation than by a common commitment: the merge is correct only relative to an articulated structure, and the structure determines both what can be merged and what must be preserved.

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Structural Merge.