---
title: 'SWAP-Score: Permutation Optimality'
url: https://www.emergentmind.com/topics/swap-score
type: topic
---

# SWAP-Score: Permutation Optimality

to=arxiv_search.search  全民彩票 оЄjson
{"query":"id:2604.01938 OR id:2404.14192 OR id:2403.04161 OR id:1312.1706","max_results":10,"sort_by":"relevance"}
to=arxiv_search.search  微信的天天中彩票്ലjson
{"query":"2604.01938","max_results":5,"sort_by":"relevance"}
to=arxiv_search.search 凤凰大参考  天天中彩票可以json
{"query":"How to measure the optimality of word or gesture order with respect to the principle of swap distance minimization","max_results":5,"sort_by":"relevance"}
to=arxiv_search.search  老时时彩  大发快三是json
{"query":"SWAP-NAS: Sample-Wise Activation Patterns for Ultra-fast NAS","max_results":5,"sort_by":"relevance"}
SWAP-Score is a quantitative index of how “optimal” a given ordering of elements is with respect to the principle that variants should minimize the number of adjacent swaps needed to reach a reference order. In the formulation developed for word order and gesture order, its theoretical foundations rest on viewing all orderings as vertices of a permutohedron graph and defining cost as the average swap distance from that source [2604.01938]. Closely related work formalizes the underlying cost as average swap distance and studies its behavior under several null models [2404.14192]. The label “SWAP-Score” also appears in unrelated senses in sparse regression and in training-free neural architecture search, where it denotes a local loss-reduction gain and a count of unique sample-wise activation patterns, respectively [1312.1706; 2403.04161].

## 1. Permutohedron model and swap distance

Given a sequence of \(n\) distinct elements, there are \(N=n!\) possible permutations. The permutohedron of order \(n\) is the graph whose vertices are these permutations \(\pi\), and where two vertices \(\pi\) and \(\pi'\) are connected by an edge exactly when \(\pi'\) is obtained from \(\pi\) by swapping two adjacent elements [2604.01938].

The swap distance \(d(\pi,\sigma)\) between two permutations is the length of the shortest path between them in the permutohedron, that is, the minimum number of adjacent-element swaps needed to transform one into the other. If all permutations are indexed by \(i,j\in[1\ldots N]\), then
\[
d_{ij}=d(\pi_i,\pi_j)\in\{0,1,2,\ldots,d_{\max}\},
\]
with diameter
\[
d_{\max}=\frac{n(n-1)}{2}.
\]

For \(n=3\), the six permutations of \(S\), \(O\), and \(V\) form a hexagon. \(SOV\leftrightarrow SVO\) differ by swapping \(O,V\) and therefore have distance \(1\), whereas \(SOV\leftrightarrow VSO\) require two adjacent swaps and therefore have distance \(2\). Here \(d_{\max}=3\) [2604.01938].

This construction supplies the graph-theoretic substrate for treating order variation as a geometric distribution over permutations rather than as an unordered frequency table. A plausible implication is that optimality is not attached to a single order alone, but to the alignment between a probability distribution over orders and the topology of the permutohedron.

## 2. Formal derivation of the degree of optimality

Assume a probability distribution \(p=(p_1,\ldots,p_N)\) over the \(N\) orderings. The average swap distance of this distribution is
\[
(d)=\sum_{i=1}^N\sum_{j=1}^N p_i\,p_j\,d_{ij}.
\]
It measures expected cost if one randomly selects two orders according to \(p\) and then counts how many adjacent swaps separate them [2604.01938].

A raw \((d)\) is difficult to interpret because it depends on \(n\) and on the concentration of the probability mass. The normalization therefore uses two benchmarks. The first is a chance baseline obtained by shuffling the assignment of the \(p\)'s to the permutohedron vertices uniformly at random. If \((d)_r\) denotes the expected \((d)\) under this random-permutation null model, then
\[
(d)_r=(1-S)\cdot d_{\max},
\qquad
S=\sum_{i=1}^N p_i^2,
\]
where \(S\) is the Simpson index of \(p\), equivalent to probability-mass at distance zero [2604.01938].

The second benchmark is the minimum attainable cost over all assignments of the same multiset of probabilities \(\{T_1\ge T_2\ge\cdots\ge T_m>0,T_{m+1}=\cdots=T_N=0\}\):
\[
(d)_{\min}=\min_{\text{permutations }o}\sum_{i,j} p_{o(i)}\,p_{o(j)}\,d_{ij}.
\]
For \(n=3\), a closed-form expression is reported as
\[
(d)_{\min}=3\cdot5 -2[\,T_1(T_2+T_4)+T_2(T_4+T_6)+T_3(T_1+T_2)+T_4(T_6+T_5)+T_5(T_3+T_1)+T_6(T_5+T_3)\,].
\]
The SWAP-Score, or degree of optimality \(\mathfrak O\), is then
\[
\mathfrak O=\frac{(d)_r-(d)}{(d)_r-(d)_{\min}},
\qquad
0\le \mathfrak O\le 1.
\]

Interpretatively, \(\mathfrak O=1\) means \((d)=(d)_{\min}\), so the arrangement is globally optimal; \(\mathfrak O=0\) means \((d)=(d)_r\), so the observed cost is what one would expect by chance; and \(\mathfrak O<0\) indicates worse-than-chance ordering [2604.01938].

## 3. Reduction to the Quadratic Assignment Problem

The optimization problem for \((d)_{\min}\) can be written in matrix terms. Let \(W\) be the \(N\times N\) matrix with entries \(W_{ij}=p_i\,p_j\), and let \(D\) be the permutohedron distance matrix \(D_{ij}=d_{ij}\). Then
\[
(d)=\operatorname{trace}(W\cdot P D P^T),
\]
where \(P\) is a permutation matrix. Finding \((d)_{\min}\) is therefore a Koopmans–Beckmann quadratic assignment problem:
\[
\min_{\pi\in S_N}\sum_{i,j=1}^N W_{ij}\,D_{\pi(i)\pi(j)}.
\]
Since general QAP is NP-hard, exact solution is infeasible for large \(n\) [2604.01938].

The computational regimes stated for this formulation are threefold. Brute-force enumeration is only possible up to \(n\approx5\). Beyond that, one must turn to specialized QAP solvers such as QAPLIB or to integer-programming formulations, or else to approximation or heuristics such as greedy local improvements [2604.01938].

For \(n=3\), the paper gives an efficient simplification. The two globally optimal assignments arrange probabilities in breadth-first traversal of the permutohedron, assigning \(T_1\) to one vertex, \(T_2\) to an adjacent vertex, \(T_3\) to the other neighbour, \(T_4\) to a distance-\(2\) vertex, \(T_5\) to the other distance-\(2\) vertex, and \(T_6\) to the antipode [2604.01938]. This suggests that, in the smallest nontrivial case, global optimality is tightly coupled to the local metric structure of the graph.

## 4. Worked example and empirical gesture results

A concrete example is given for English gestures in reversible events. The reported relative frequencies for the six orders are
\[
SVO=0.47,\quad SOV=0.26,\quad OSV=0.21,\quad VSO=0.04,\quad VOS=0.01,\quad OVS=0.01.
\]
Using these values, the paper reports \((d)=0.41\), \(S\approx0.37\), \((d)_r=(1-0.37)\cdot1.5\approx0.94\), \((d)_{\min}\approx0.67\), and finally
\[
\mathfrak O=\frac{0.94-0.41}{0.94-0.67}\approx0.78
\]
[2604.01938].

The broader empirical application concerns a dataset of unconventional gestures across four languages—English, Russian, Irish, and Tagalog—and two verb-reversibility conditions. The reported results are that, in every sub-case, \(\mathfrak O\ge0.77\), so the distributions are at least \(77\%\) optimal; half of the eight conditions attain \(\mathfrak O=1\), that is, perfect global optimality; Wilcoxon tests confirm \((d)<(d)_r\) with \(p<.01\); and a Poisson-binomial test gives \(p\approx3\times10^{-4}\) for the number of perfect cases [2604.01938].

Moreover, all eight empirical probability arrangements are contiguous on the permutohedron, meaning that the non-zero orders form a single path. The paper characterizes this as a structural epiphenomenon of swap-distance minimization and reports \(p<.001\) against chance [2604.01938]. A plausible implication is that swap-distance minimization constrains not only aggregate cost but also the support geometry of the observed distribution.

## 5. Relation to average swap distance and entropy minimization

Ferrer-i-Cancho et al. formalize the underlying quantity as average swap distance,
\[
\overline d=\sum_{i=1}^N\sum_{j=1}^N d_{ij}\,p_i\,p_j,
\]
or equivalently \(\overline d=\sum_{d=0}^{d_{\max}} d\,P(d)\), where \(P(d)\) is the probability mass at distance \(d\) [2404.14192]. In that treatment, \(0\le\overline d\), with equality precisely when all mass is on a single permutation. For \(n\le6\), and conjecturally for all \(n\),
\[
\overline d\le \frac12\,d_{\max},
\]
and equality holds, for instance, when \(p\) is uniform or when \(p\) puts mass \(1/2\) on two permutations at maximal distance \(d_{\max}\) [2404.14192].

That paper studies three null hypotheses. Under the die-rolling null hypothesis,
\[
\overline d_{dr}=\frac{F-1}{F}\,\frac{d_{\max}}{2}.
\]
Under the Polya-urn null hypothesis, no closed form is given and \(\overline d_{Pu}\) is estimated by Monte Carlo. Under random permutation of the empirical \(p\)-vector,
\[
\overline d_{rp}=S\,\frac{N}{2(N-1)}\,d_{\max},
\]
where \(S=\sum_i p_i^2\) is Simpson’s index [2404.14192].

The same work compares swap-distance minimization with entropy minimization, where block entropy is
\[
H=-\sum_{i=1}^N p_i\log p_i.
\]
It reports strong evidence of entropy minimization and swap distance minimization with respect to a die rolling experiment, strong evidence for both forces with respect to a Polya urn process for \(n=4\) but weaker evidence for \(n=3\), and evidence of swap distance minimization when word order frequencies are shuffled, indicating that swap distance minimization effects are beyond pressure to minimize word order entropy [2404.14192]. The bridge between the two perspectives is the Simpson index, which links quadratic diversity to the Rényi entropies through \(R_2=-\log S\).

## 6. Extensions, limitations, and scope conditions

The framework generalizes conceptually to \(n>3\) by redefining the permutohedron in higher dimensions, but this incurs the full QAP hardness for computing \((d)_{\min}\). Approximate heuristics or problem-specific bounds are therefore required in larger cases [2604.01938].

Tied probabilities \(p_i=p_j\) slightly complicate ranking and formulas for \((d)_{\min}\) but do not invalidate the approach. At the same time, the SWAP-Score is strictly comparative: it tells us how close an observed distribution is to the best possible under the swap-distance principle, but it does not identify why human or gestural systems approximate that optimum [2604.01938].

The stated domain of extension goes beyond linguistic word order and gestures to any permutation-based phenomenon where cost is measured in adjacent exchanges, including dependency-distance minimization and biological sequence rearrangements [2604.01938]. This suggests that the framework is best understood as a general optimization template for distributions over permutations rather than as a language-specific statistic.

## 7. Other uses of the label in arXiv literature

In sparse regression, Vats and Baraniuk use the label for a different object. There, with response \(y\in\mathbb R^n\), design matrix \(X\in\mathbb R^{n\times p}\), current support \(S\subset\{1,\ldots,p\}\), and residual loss \(L(S)=\|\Pi_{(S)}^\perp y\|_2^2\), a swap removes \(i\in S\) and inserts \(j\notin S\), producing \(S^{(i\to j)}=(S\setminus\{i\})\cup\{j\}\). The SWAP-Score is the gain
\[
G(i,j\mid S)=L(S)-L(S^{(i\to j)})=-\Delta(i,j\mid S),
\]
and the algorithm selects the pair maximizing \(G\). The global objective is \(\min_{S:|S|=k}L(S)\), the score is computed efficiently via rank-one updates of orthogonal projectors, and recovery guarantees are given under restricted eigenvalues and a generalized coherence parameter \(\gamma_d\) [1312.1706].

In training-free neural architecture search, the label denotes a zero-cost proxy based on Sample-Wise Activation Patterns. For a ReLU network \(\mathcal N\) with fixed random parameters \(\theta\), mini-batch size \(S\), and \(V\) scalar pre-activations, one forms binary vectors \(q^{(v)}\in\{0,1\}^S\) by thresholding each pre-activation across the batch, collects the set \(\widehat{\mathbb A}_{\mathcal N,\theta}=\{q^{(1)},\ldots,q^{(V)}\}\), and defines
\[
\Psi_{\mathcal N,\theta}=\bigl|\widehat{\mathbb A}_{\mathcal N,\theta}\bigr|.
\]
A regularised version multiplies \(\Psi\) by \(f(\Theta)=\exp(-(\Theta-\mu)^2/\sigma)\), where \(\Theta\) is the number of parameters. The paper reports Spearman’s rank correlation coefficient of \(0.90\) between regularised SWAP-Score and CIFAR-100 validation accuracies on NAS-Bench-201 networks, and states that SWAP-NAS achieves competitive performance on CIFAR-10 and ImageNet in approximately \(6\) minutes and \(9\) minutes of GPU time respectively [2403.04161].

These usages are mathematically unrelated. In one case SWAP-Score is a degree of optimality on a permutohedron; in another it is a local improvement criterion for support swaps; in a third it is the cardinality of a set of activation patterns. This suggests that, in technical writing, the term is not self-identifying and must be interpreted through the paper-specific formal definition.

Source: https://www.emergentmind.com/topics/swap-score