# Quantifying Sub-Optimality in Routing for Automated Market Makers

Crypto.world

> DEX aggregators use smart routers to split a trade across several AMM pools, and in principle this is a well-defined optimization problem: allocate a fixed input budget across pools to maximize…

**arXiv**: 2607.20762

**Published**: 2026-07-22

**Authors**: Weiye Xi, Ciamac C. Moallemi

## AI summary

## Overview

**Research area:** Decentralized finance market microstructure — specifically the execution quality of on-chain trade routing across automated market maker (AMM) pools (arXiv category q-fin.TR).

**Technical level:** Intermediate. The paper combines a formal optimization framework (concave output functions, KKT conditions, a bisection algorithm, and a mixed-integer gas-activation model) with a large descriptive empirical audit. Readers can follow the empirical findings without the math, but the benchmark construction requires comfort with convex optimization.

**Scope (1 sentence):** A large-scale measurement study of how far realized DEX trade routes fall short of provably optimal routes on Ethereum, decomposing that shortfall into mis-splitting, under-activation of pools, stale information, and sandwich attacks.

## What This Paper Is About

DEX aggregators use smart routers to split a trade across several AMM pools, and in principle this is a well-defined optimization problem: allocate a fixed input budget across pools to maximize output. In practice, nobody had measured how close real routers get to that optimum at scale. The authors build three reproducible optimal benchmarks, an exact and fast algorithm to compute them, and then compare 2.98 million real WETH–USDC swaps against those benchmarks to put a dollar figure on routing inefficiency and attribute it to specific causes.

## Key Contributions

1. **Three nested optimal-routing benchmarks.** A Support-Constrained Optimum (SCO) that optimizes the split only over the pools the trade actually used (isolating split quality); a Full-Venue Optimum (FVO) that optimizes over all available pools with no gas cost (valuing broader pool access); and a Gas-Aware Full-Venue Optimum (G-FVO) that adds a fixed per-pool activation gas cost (capturing the activation-versus-gas trade-off).
2. **An exact, scalable routing algorithm.** For the same-token-pair routing problem, the authors show the optimum is characterized by equalizing marginal price across active pools, and compute the common marginal price by bisection on a monotone aggregate function. Gas is handled as a fixed per-activation cost, turning the problem into a mixed-integer program that they solve exactly by enumerating active subsets and solving a concave inner allocation for each. Correctness and complexity are stated as theorems in the appendix.
3. **A controlled staleness experiment.** They vary the snapshot used for both optimization and evaluation from N = 0 (execution-time state, an oracle) through N = 10 blocks of lag, and separately re-evaluate realized routes against older planning-time snapshots, which separates timing mismatch from allocation inefficiency.
4. **A sandwich-attack attribution.** Using a within-block heuristic (a swap bracketed by opposite-direction swaps from the same counterparty cluster), they tag sandwiched transactions and re-measure suboptimality by router, linking losses to execution context (public mempool versus solver-mediated batch auction / private order flow).

## Main Findings

- **Realized routes leave meaningful value on the table.** Across 2.98 million WETH–USDC swaps on Ethereum mainnet (blocks 19,500,000 to 23,000,000, $120.42 billion in USDC-equivalent input), the average shortfall is 2.02 bps per trade, aggregating to about $24 million.
- **Under-activation dominates mis-splitting.** Dollar losses relative to the three benchmarks are $6.58 million (SCO), $21.39 million (FVO), and $24.20 million (G-FVO). The mean shortfall relative to SCO alone is 0.05467 bps, i.e., pure within-set inefficiency. The paper states the aggregate loss after per-pool gas is about $24.27 million and concludes that failing to activate additional pools, not bad splitting among the pools used, is the overwhelming driver.
- **Routes are highly concentrated.** On average fewer than one-third of the four pools are activated per transaction, and flow shares are extremely uneven (low entropy, HHI ≈ 1).
- **One block of staleness is expensive.** Moving from N = 0 to N = 1 raises mean shortfall by 1.28739 bps under FVO (about $15.5 million) and by 1.77525 bps under G-FVO (about $21.4 million). Further delays degrade performance with diminishing increments.
- **Timing mismatch explains part of the gap.** When realized routes are evaluated against benchmarks computed on earlier snapshots, measured suboptimality declines monotonically in N — evidence that some of the execution-time gap comes from planning on outdated state rather than from bad allocation.
- **A stale-but-implementable router still beats current routers.** Optimizing at the bottom of the previous block (ω¹) and evaluating at execution yields implied gains over realized routes of $0.77 million under FVO¹ and $0.66 million under G-FVO¹, aggregating over the labeled routers' trade amount.
- **Inefficiency is heterogeneous and heavy-tailed.** Small trades (under $1,000) incur disproportionately larger relative losses than large trades (over $10,000), and the 100–1K and 1K–10K USDC bins show the widest interquartile ranges; large trades are near-optimal in bps but contribute meaningfully to dollar losses. Mean markers sit well above medians and often above the upper quartile, indicating long right tails driven by a few extreme observations.
- **Sandwiching is concentrated in public flow.** Overall, 1.03×10⁴ of 3.36×10⁶ transactions (0.308%) are flagged sandwiched, representing $1.35×10⁹ of $1.21×10¹¹ (1.12%). By router, sandwiched share of dollar value is 6.12% for Universal Router, 7.93% for 1inch v4, 6.34% for Odos v2, 0.680% for 1inch v5, and 0.00458% for CoWSwap. Sandwiched transactions show pronounced upward shifts in both level and dispersion of suboptimality, with heavier right tails that persist under gas-aware evaluation.
- **Router-level ordering matches execution context.** In the non-sandwiched subset, CoWSwap has the lowest medians and tightest interquartile ranges, Universal Router and Odos v2 have higher baselines, and 1inch v4/v5 sit in between (v5 modestly tighter than v4); the ordering is preserved under sandwiching but with amplified gaps.
- **Router sensitivity to staleness differs.** Universal Router and Odos v2 mean curves steepen faster than CoWSwap's as N grows, consistent with public mempool submission versus solver-mediated batch auctions and private order flow.

## Methodology in Plain English

Start with the idealized question: given a fixed amount to trade and a snapshot of every candidate pool's state, how should the amount be divided to get the most output? The authors assume each pool's output rises with input but with diminishing returns (strict concavity), which makes the allocation problem well behaved. The rule for the optimum is intuitive: shift input between pools until each pool delivers the same marginal price, and don't use a pool whose marginal price is worse than that common level. Because total input demanded is a monotone function of this common marginal price, they can find it by bisection — repeatedly halving an interval until the allocation exactly exhausts the budget. This is the inner solver.

Gas complicates things because it is charged per pool used, not per unit traded, so whether to use a pool is an all-or-nothing decision. They model gas as a fixed cost incurred only when a pool is activated, enumerate every possible subset of active pools, solve the inner allocation for each subset, and take the best. The enumeration is exact rather than heuristic.

With benchmarks in hand, the audit is a comparison exercise. For every real transaction, they reconstruct the realized allocation across the four Uniswap pools considered (v2 at 30 bps; v3 at 1, 5, and 30 bps), compute what the SCO, FVO, and G-FVO benchmarks would have delivered at the same snapshot, and record the proportional shortfall in basis points. Dollars come from applying those gaps to trade notional.

The staleness experiment is a matched comparison: they optimize at a chosen snapshot and evaluate at that same snapshot, so the only thing that changes across N is information age — not the optimization routine and not the market state used for scoring. The complementary experiment scores the actual realized routes against optima computed at progressively older snapshots, which makes the timing component visible.

Sandwiching is detected mechanically: within a block, a swap is labeled sandwiched on a pool if it is bracketed by two opposite-direction swaps attributable to the same counterparty cluster; a transaction is labeled sandwiched if any of its four pools is flagged. Cleaned data excludes counterflow trades (both directions on the same pair) and trades under $100 on the USDC side.

## Why This Matters

**Impact on research.** The paper supplies a reusable, reproducible measurement protocol for router quality. Prior work documented that routing was suboptimal; this work separates the shortfall into components (split quality, pool access, gas, timing, adversarial ordering) and provides algorithms with correctness guarantees rather than heuristics, giving future empirical and theoretical work a common yardstick and a way to A/B test design choices under identical market states.

**Real-world applications:**

- **Router and aggregator design:** set activation thresholds, venue whitelists, and timing rules using the SCO/FVO/G-FVO gap as an objective, rather than intuition.
- **Execution scheduling:** quantify the value of planning on the freshest implementable on-chain state versus older snapshots, and budget for latency reduction accordingly.
- **MEV mitigation:** measure how much of an execution shortfall is attributable to sandwiching and evaluate whether private order flow or batch auctions reduce it for a given flow segment.
- **Protocol and venue analysis:** assess whether adding a pool or fee tier to the candidate set is worth the gas it costs to activate.

**Industry relevance.** The dollar magnitudes are large enough to matter commercially — tens of millions in forgone output on a single pair over the sample — and the cross-router heterogeneity gives a direct, if indirect, read on the value of private order flow and solver-mediated execution. The disclosure notes the second author advises Paradigm and Uniswap Labs, and that the work was supported by a grant from the Columbia Center for Digital Finance and Technologies.

## Future Directions

1. **Multi-hop routing.** The current framework restricts attention to pools for the same token pair; extending benchmarks to routes through intermediate tokens requires resolving which intermediate tokens belong in the universe.
2. **Richer gas models.** Gas is modeled as a fixed per-activation cost; the authors note that concentrated-liquidity designs such as Uniswap v3 have gas that grows with ticks crossed, which their abstraction ignores.
3. **More venues and chains, plus cross-domain execution.** Broadening beyond four Uniswap L1 pools and single-chain execution is named as a natural next step.
4. **Causal separation of sandwiching from volatility.** The sandwich results are associational; the authors flag distinguishing causal adversarial impact from confounding transient volatility, and stress-testing robustness to newer AMM features such as hooks, as open problems.

## Target Audience

Quantitative researchers and graduate students in market microstructure and decentralized finance who want a rigorous, benchmark-based measurement framework; AMM and aggregator protocol designers and routing engineers who need concrete targets for pool activation and latency; market-making and execution desks trading on-chain; and MEV/order-flow researchers interested in how execution context (public mempool versus private order flow) maps to measurable execution shortfall. Readers seeking a purely conceptual introduction to DEX mechanics will find the empirical sections accessible but should expect optimization formalism in the methodology.

## Authors’ abstract

We provide a large-scale empirical audit of DEX routing using 2.98 million WETH-USDC swaps on Ethereum. Comparing realized routes with optimized benchmarks, we measure an average shortfall of 2.02 bps per trade or \$24 million. To attribute losses, we introduce three reproducible optimal benchmarks: a Support-Constrained Optimum (SCO) that evaluates split quality conditional on the pools actually used; a Full-Venue Optimum (FVO) that considers all available pools to quantify…

[The full abstract on arXiv](https://arxiv.org/abs/2607.20762)

[Read the original paper](https://arxiv.org/abs/2607.20762)

---

Canonical: https://crypto.world/paper/quantifying-sub-optimality-in-routing-for-automated-market-makers-2607.20762
