---
title: 'Reverse-LOCO: Inversion in LOCO Codes & PEFT'
url: https://www.emergentmind.com/topics/reverse-loco
type: topic
---

# Reverse-LOCO: Inversion in LOCO Codes & PEFT

Reverse-LOCO denotes an inverse or reverse-order operation within the broader LOCO family, but its technical meaning is context dependent. In binary lexicographically-ordered constrained codes, the 2019 LOCO paper does not introduce “Reverse-LOCO” as a separate code construction; instead, reverse indexing appears through the map $g_{\mathrm{rev}}(c)=N(m,x)-1-g(c)$, which is used to identify complementary codewords in the lexicographically ordered codebook. In DNA LOCO codes, Reverse-LOCO is the sequence-to-index decoder for admissible $4$-ary codewords. In Low-rank Compositional Orthogonal fine-tuning, Reverse-LOCO is the exact or approximate inverse of a low-rank orthogonal adapter constructed from Cayley transforms and compositional rotation chains [1902.10898] [2311.08325] [2605.15916].

## 1. Scope of the term

The term is used in multiple ways across the literature, and the distinctions are operational rather than merely terminological. In constrained coding, Reverse-LOCO refers to reversing an enumeration or decoding a lexicographically ordered admissible sequence. In orthogonal PEFT, it refers to inverting a learned transformation.

| Context | Forward object | Reverse-LOCO operation |
|---|---|---|
| Binary LOCO codes | Lexicographically ordered codebook $\mathcal{C}_{m,x}$ | Reindexing by $N(m,x)-1-g(c)$ |
| DNA LOCO codes | Admissible sequence in $\mathcal{D}_{m,\ell}$ | Sequence-to-index demapping $g(\mathbf{c})$ |
| LoCO fine-tuning | Orthogonal adapter $R$ or chain $\prod_{k=1}^{K} R_k$ | Exact or approximate inverse $R^{-1}$ |

A recurrent misconception is to treat Reverse-LOCO as a single, universally defined construction. The cited papers support a narrower formulation: the name denotes a reverse map relative to a forward LOCO mechanism, but the object being reversed differs across line coding, DNA constrained coding, and orthogonal fine-tuning [1902.10898] [2311.08325] [2605.15916].

## 2. Reverse indexing in binary LOCO codes

Binary LOCO codes are fixed-length, binary constrained codes for bipolar non-return-to-zero signaling. A code with parameters $m \ge 1$ and $x \ge 1$ is denoted by $\mathcal{C}_{m,x}$, and its codewords are all binary sequences of length $m$ that avoid the forbidden-pattern set
$$
\mathcal{T}_x=\{010,101,0110,1001,\ldots,01^x0,10^x1\}.
$$
The codebook is ordered lexicographically with $0<1$ and decreasing bit significance from left to right. This lexicographic structure is not incidental: it is the mechanism that enables enumerative encoding and decoding [1902.10898].

The cardinality $N(m,x)=|\mathcal{C}_{m,x}|$ satisfies the base case $N(m,x)=2$ for $m \le 1$ and the recurrence
$$
N(m,x)=N(m-1,x)+N(m-x-1,x), \quad m \ge 2.
$$
For $x=1$, this becomes the Fibonacci recurrence. The asymptotic capacity equals that of $(d,\infty)$ run-length-limited codes with $d=x$, since the paper shows
$$
N_{\mathrm{RLL}}(m-1,d)=\frac{1}{2}N(m,x), \quad d=x.
$$
The lexicographic index of a codeword $c=[c_{m-1}\ldots c_0]$, with $a_i=1$ if $c_i=1$ and $a_i=0$ if $c_i=0$, is
$$
g(c)=\frac{1}{2}\left[a_{m-1}N(m,x)+\sum_{i=0}^{m-2} a_i N(i-x+1,x)\right].
$$

Within this framework, Reverse-LOCO is not a new constraint family. It is the reverse enumeration
$$
g_{\mathrm{rev}}(c)=N(m,x)-1-g(c).
$$
Because this operation leaves $\mathcal{C}_{m,x}$ and $\mathcal{T}_x$ unchanged, it does not alter the constraint set, the recurrence for $N(m,x)$, or the capacity. The paper’s own discussion states that reversing order does not affect ISI mitigation, ICI alleviation, self-clocking properties, or the essential encoder/decoder structure. A plausible implication is that Reverse-LOCO in the binary setting is best understood as a reindexing of the same constrained object rather than a distinct code [1902.10898].

## 3. Complement symmetry, balancing, and self-clocked variants

The main structural reason reverse indexing matters in binary LOCO codes is complement symmetry. The paper proves that for any codeword $c^0 \in \mathcal{C}_{m,x}$ that starts with $0$, the codeword with index $N(m,x)-1-g(c^0)$ is its bitwise complement $c^1$. Under NRZ signaling, the disparity $p(c)$ is the difference between the number of $1$’s and $0$’s in $c$, and complementary codewords satisfy
$$
p(c^0)=-p(c^1).
$$
Thus the reverse index is already embedded in the balancing construction [1902.10898].

Balanced LOCO codes pair each message with two complementary codewords and select between them according to the running disparity $p_r$, choosing the codeword whose disparity sign opposes the sign of $p_r$. Self-clocked balanced LOCO codes, denoted CB-LOCO, remove the all-$0$’s and all-$1$’s codewords to enforce at least one transition per codeword. Their cardinality is
$$
N^{cb}(m,x)=N(m,x)-2,
$$
and at most half of these correspond to distinct messages because each message is represented by two complementary codewords.

The rate formulas make the balancing penalty explicit. For the self-clocked unbalanced code,
$$
R_{\mathrm{LOCO}}^c=\frac{\lfloor \log_2(N(m,x)-2)\rfloor}{m+x},
$$
whereas for the self-clocked balanced code,
$$
R_{\mathrm{LOCO}}^{cb}=\frac{\lfloor \log_2(N(m,x)-2)\rfloor-1}{m+x}.
$$
The difference is exactly
$$
R_{\mathrm{LOCO}}^c-R_{\mathrm{LOCO}}^{cb}=\frac{1}{m+x}.
$$
The paper emphasizes that this one-bit minimum penalty is the minimal possible rate penalty for the two-codeword-per-message approach, and that the loss vanishes as $m$ grows.

The worked example with $x=1$ and $m=6$ makes the reverse relation concrete. Since $N(6,1)=26$, the codeword $011001$ has index $g(c)=9$, so its reverse index is $26-1-9=16$, which corresponds to $100110$, its complement. This suggests that in binary LOCO usage, Reverse-LOCO is less a separate decoding rule than a symmetry operator that underpins DC-free signaling and minimal-cost balancing [1902.10898].

## 4. Reverse-LOCO decoding in DNA LOCO codes

DNA LOCO codes transpose the lexicographically ordered constrained-coding idea to the alphabet $\{A,T,G,C\}$. For run parameter $\ell \ge 1$, the admissible set is
$$
\mathcal{D}_{m,\ell}=\left\{\mathbf{c}=c_{m-1}\cdots c_0 \in \{A,T,G,C\}^m : \mathbf{c} \text{ contains no } \mathbf{\Lambda}^{\ell+1}\right\},
$$
where the forbidden patterns are runs of identical symbols of length exceeding $\ell$. Lexicographic order is defined by $A<T<G<C$. In this paper, Reverse-LOCO is explicitly the inverse mapping from an admissible sequence to its lexicographic index [2311.08325].

The cardinality $N(m)=|\mathcal{D}_{m,\ell}|$ satisfies
$$
N(m)=3N(m-1)+3N(m-2)+\dots+3N(m-\ell), \quad m \ge \ell,
$$
with $N(0)\triangleq \frac{4}{3}$ and $N(m)=4^m$ for $1 \le m \le \ell$. The decoder computes the index
$$
g(\mathbf{c})=\sum_{i=0}^{m-1} g_i(c_i),
$$
and the general encoding-decoding rule is
$$
g(\mathbf{c})=\frac{3}{4}\sum_{i=0}^{m-1}\sum_{j=1}^{\ell}\sum_{k=1}^{j}(\mathsf{a}_{i,k}+\mathsf{t}_{i,k}+\mathsf{g}_{i,k})\,N(i+j-\ell),
$$
with the coefficient conditions specified by the local prefix/run pattern. The algorithm runs in $O(m)$ iterations, while arithmetic on up to $2m$-bit numbers yields an implementation complexity $O(m^2)$. The storage overhead for precomputed values is
$$
\sum_{i=0}^{m-1}\left\lceil \log_2\left(\frac{3}{4}N(i)\right)\right\rceil = O(m^2).
$$

The paper gives a concrete decoding example for $\ell=3$ and $m=4$. With $N(-2)=N(-1)=0$, $N(0)=4/3$, $N(1)=4$, $N(2)=16$, $N(3)=64$, and $N(4)=252$, the Reverse-LOCO decoder maps $\mathbf{c}=\mathrm{ATGC}$ to index $26$. The recovered binary message length, without bridging bits, is $\lfloor \log_2(N(4))\rfloor=7$.

Complement symmetry again plays a central role. If $\bar{\mathbf{c}}$ is defined by the mapping $A \leftrightarrow C$ and $T \leftrightarrow G$, then for odd $m$ the paper shows
$$
g(\bar{\mathbf{c}})+g(\mathbf{c})=N(m)-1,
$$
and the disparity
$$
p(\mathbf{c})=|G|+|C|-|A|-|T|
$$
changes sign under complement. This enables GC-balancing by selecting either $\mathbf{c}$ or $\bar{\mathbf{c}}$ per message, with a minimum $1$ bit penalty that vanishes asymptotically.

Bridging determines how Reverse-LOCO interacts with error detection and extra bits:

| Scheme | Bridge structure | Stated property |
|---|---|---|
| I | 1-symbol bridge | Encodes 1 bit; no per-codeword detection |
| II-A | 3-symbol bridge with checksum | Single substitution detection per codeword |
| II-B | 3-symbol bridge, 1 extra bit | Balancing-friendly; single substitution detection |
| III | 5-symbol bridge, triple checksum | Single substitution detection; lower miss probability |

Because Reverse-LOCO decodes the codeword index and, when applicable, the bridge bits while skipping the bridge in the stream, it is part of a complete constrained-coding and error-detection stack rather than an isolated demapper [2311.08325].

## 5. Reverse-LOCO as inversion of low-rank orthogonal adapters

In the 2026 LoCO fine-tuning paper, Reverse-LOCO is an exact or approximate inverse for a parameter-efficient orthogonal transformation. LoCO constructs a skew-symmetric generator from low-rank matrices $U,V \in \mathbb{R}^{d \times r}$,
$$
A=UV^\top - VU^\top,
$$
and defines
$$
X=[U \mid -V], \qquad Y=[V \mid U],
$$
so that $A=XY^\top$. The forward orthogonal map is the Cayley transform
$$
R=(I-A)^{-1}(I+A)\in SO(d),
$$
which can be written in low-rank form as
$$
R=I+2X(I-Y^\top X)^{-1}Y^\top.
$$
Multiple such rotations are composed into a chain
$$
R=\prod_{k=1}^{K} R_k,
$$
and a first-order parallel approximation replaces the sequential product by a sum of low-rank updates [2605.15916].

Reverse-LOCO is the inverse of this adapter. For a single component,
$$
R^{-1}=I-2X(I+Y^\top X)^{-1}Y^\top.
$$
For a chain,
$$
R^{-1}=\prod_{k=K}^{1} R_k^{-1}.
$$
If the first-order approximation $\tilde{R}=I+\sum_{k=1}^{K}\Delta_k$ is used, then for small $\left\|\sum \Delta_k\right\|$ the inverse is approximated by
$$
\tilde{R}^{-1}\approx I-\sum_{k=1}^{K}\Delta_k,
$$
and the orthogonality deviation satisfies
$$
\|I-\tilde{R}^\top \tilde{R}\|_F \le K(K-1)\gamma^2
$$
when each component obeys $\|\Delta_k\|_F \le \gamma$. The same paper also defines temperature control
$$
R(t)=(I-tA)^{-1}(I+tA),
$$
with
$$
R(t)^{-1}=R(-t),
$$
so Reverse-LOCO at inference can be implemented by evaluating the adapter with negative temperature.

This is a stronger notion of reversal than in constrained coding. In the PEFT setting, Reverse-LOCO is an operator inverse, not merely a reverse traversal of an ordering. If a layer is adapted as $y=W_0Rx$, baseline behavior can be recovered by applying $R^{-1}$ to the features before the frozen weight. The paper explicitly presents this as reversible PEFT that can turn adaptations on or off post-training without reloading checkpoints [2605.15916].

## 6. Complexity, performance, and practical significance

Across the three literatures, Reverse-LOCO preserves the low-complexity design philosophy of the forward method, but the relevant complexity terms differ. In binary LOCO codes, encoding is mainly comparisons and subtractions, decoding is additions, the values $N(i,x)$ are precomputed and stored, and multiplying by $\frac{1}{2}$ is a $1$-bit right shift in binary. Reverse lexicographic enumeration does not materially change this structure; it introduces at most a single subtraction $N(m,x)-1-g(c)$ in index mapping. The same paper reports that moderate-length C-LOCO codes achieve up to $10\%$ rate gain over practical FSM-based constrained codes for the same purpose, and that using a LOCO code to encode only the parity bits of an LDPC code yields about $20\%$ channel density gain in MR systems [1902.10898].

In DNA LOCO codes, Reverse-LOCO decoding runs in $O(m)$ iterations with implementation complexity $O(m^2)$ and storage $O(m^2)$ for the precomputed cardinalities. The paper contrasts this with lookup-table approaches that scale like $O(4^m \cdot m)$, and states that the same decoder hardware can be reprogrammed to switch $\ell$, $m$, or bridging scheme by changing the stored cardinalities and comparison thresholds. D-LOCO is also described as capacity-achieving, intrinsically balanced, and able to support single substitution error detection under Schemes II-A, II-B, and III. For $\ell=3$, the normalized asymptotic capacity is $C^{(3)}=\log_4(\beta_{\max})=0.9912$ with largest root $\beta_{\max}=3.9514$ [2311.08325].

In LoCO fine-tuning, the exact per-component forward pass has dominant cost $O(bdr+br^2)$ per component, plus $O(r^3)$ setup amortized across the batch; the exact chain multiplies this by $K$, whereas the first-order parallel approximation has critical-path span $O(bdr+br^2+r^3)$. The parameter count is $2Kdr$ per rotated linear module. Empirically, the paper reports that LoCO $(n=1,r=4,0.663\mathrm{M}\ \text{params})$ achieves mean GLUE score $87.75$, that LoCO $(n=1,r=16,0.12\%\ \text{params})$ attains GSM8K $50.19$ and MATH $8.40$, and that it provides competitive image quality and better CLIP-Image alignment on diffusion tasks such as Mask and Deblur. Reverse-LOCO inherits the same input-centric low-rank structure because inversion is reduced to solves in $2r \times 2r$ systems rather than $d \times d$ inversions [2605.15916].

Taken together, these results show that Reverse-LOCO is not a single algorithmic primitive but a family resemblance across LOCO-derived methods. In binary LOCO, it is reverse indexing over a fixed constrained codebook; in D-LOCO, it is the arithmetic sequence-to-index decoder; in LoCO PEFT, it is exact or approximate inversion of a composed orthogonal map. What remains invariant is the reliance on structured enumeration or low-rank algebra to make reversal practical without changing the fundamental forward object.

Source: https://www.emergentmind.com/topics/reverse-loco