---
title: Binary Bounded-Weight Constrained Codes
url: https://www.emergentmind.com/topics/binary-bounded-weight-constrained-codes
type: topic
---

# Binary Bounded-Weight Constrained Codes

Binary bounded-weight constrained codes are binary code families in which admissible words satisfy prescribed Hamming-weight restrictions, often together with a minimum-distance requirement. The basic constraint may be one-sided, such as $\mathrm{wt}(x)\le W_{\max}$, two-sided, such as $W_{\min}\le \mathrm{wt}(x)\le W_{\max}$, or exact, as in constant-weight codes with $\mathrm{wt}(x)=w$; further variants impose the restriction locally on subblocks, sliding windows, rows and columns of arrays, or symbol-frequency surrogates. In the recent literature, the subject has bifurcated into two closely related agendas: explicit low-complexity constructions for operational regimes such as ultra-low weight, windowed energy delivery, and two-dimensional storage; and analytic methods, notably Fourier/Krawtchouk transforms, linear programming, and semidefinite programming, for estimating or bounding the maximal code size under weight and distance constraints [2401.16647] [2301.05098] [1009.3657].

## 1. Constraint models and taxonomy

At the global level, a binary bounded-weight constraint specifies an admissible subset of $\{0,1\}^n$ by restricting Hamming weight. The most common forms in the cited literature are upper-bounded weight $\mathrm{wt}(x)\le W_{\max}$, lower-bounded or heavy-weight constraints $\mathrm{wt}(x)\ge W$, and exact-weight constraints $\mathrm{wt}(x)=w$. Constant-weight codes are therefore a structured subclass of bounded-weight codes, and much of the classical notation is inherited from that setting, including $A(n,d,w)$ for the largest size of a binary constant-weight code of length $n$, minimum distance at least $d$, and weight $w$, and $B(N,D,W)$ for the largest size of a binary code with minimum distance at least $D$ and minimum codeword weight at least $W$ [1009.3657] [2603.00174].

The literature also distinguishes several local or semi-local variants. Subblock-constrained codes partition each codeword into equal-length subblocks and constrain each subblock separately; CSCCs impose a fixed weight in every subblock, whereas SECCs impose a lower threshold in every subblock [1701.04954]. Sliding-window constrained codes strengthen this further by requiring every contiguous window of length $L$ to have weight in a specified interval $[w_{\min},w_{\max}]$ [2009.09558]. Locally balanced constraints are a symmetric windowed specialization in which every length-$\ell$ window must have weight between $\ell/2-\delta$ and $\ell/2+\delta$, and the “strongly locally balanced” version requires this simultaneously for all even window lengths at least $\ell$ [2201.12238]. Two-dimensional variants enforce bounded weight on every row and every column, or on every contiguous subarray, and are formulated for $n\times n$ arrays in the cited ReRAM and holographic-storage work [2208.09138] [2509.01240].

A separate but related notion is bounded symbol weight. In the binary specialization of symbol-weight codes, the symbol weight is $\max\{w(x),n-w(x)\}$, so the constraint $\mathrm{sw}(x)\le r$ is equivalent to a symmetric two-sided interval $w(x)\in[n-r,r]$. This is not the same as the one-sided upper-bounded Hamming-weight condition $w(x)\le W$; the symbol-weight model excludes very low weights unless $r$ is large [1110.0911]. That distinction is frequently overlooked in informal discussions, but it is foundational for comparing binary symbol-weight codes with ordinary bounded-weight codes.

## 2. Rate regimes, asymptotics, and information-theoretic structure

The asymptotic behavior depends sharply on whether the constraint is upper-bounded, lower-bounded, or exact. For heavy-weight codes, the exponential growth rate of $B(N,D,W)$ exhibits a threshold at relative weight $w=W/N=1/2$: for $0\le w\le 1/2$, the asymptotic exponent satisfies $R_B(d,w)=R_A(d)$, whereas for $1/2<w\le 1$, it satisfies $R_B(d,w)=R_{cw}(d,w)$, where $R_A$ is the unconstrained binary-code exponent and $R_{cw}$ is the constant-weight exponent [1009.3657]. This formalizes the fact that a minimum-weight constraint below half the blocklength is asymptotically inactive, while a heavier constraint pushes the problem into the constant-weight regime.

Upper-bounded and exact-weight regimes can be very different. In the ultra-low-weight family of [2401.16647], the parameters are $n=2^\ell$ and $w=\ell=\log_2 n$, so the relative weight vanishes. The code dimension satisfies the information-theoretic upper bound
$$
k\le \left\lfloor \log_2 \binom{n}{w}\right\rfloor,
$$
and for $n=2^\ell$, $w=\ell$, Stirling yields
$$
k\le \ell^2-\ell\log_2\ell+O(\ell).
$$
The constructed family attains this up to two higher-order terms, yet its rate
$$
R=\frac{k_\ell}{n}\approx \frac{\ell^2-\ell\log_2\ell+\Theta(\ell)}{2^\ell}
$$
vanishes as $n$ grows [2401.16647]. This regime therefore prioritizes complexity and direct mapping rather than asymptotic rate.

Subblock and window models introduce an additional rate penalty relative to global constraints. For fixed subblock length and small relative distance, the asymptotic rate of CSCCs is strictly lower than that of ordinary constant-weight codes, and the asymptotic rate of SECCs is strictly lower than that of heavy-weight codes; for high subblock weight and low relative distance, SECCs strictly dominate CSCCs, in contrast to the equality of HWC and CWC rates in the global model for $\omega\ge 1/2$ [1701.04954]. By contrast, for two-dimensional upper-bounded row/column constraints with row and column limit $f(n)$, the 2D capacity equals the 1D capacity whenever $f(n)=\omega(\log n)$:
$$
C_{2D}(f)\equiv C_{1D}(f).
$$
That equality is constructive rather than merely existential [2509.01240].

## 3. Explicit low-complexity constructions

A notable recent development is the explicit family of binary constant-weight codes with extremely low encoding and decoding complexity in the regime $n=2^\ell$, $w=\ell$, $d=2$. The construction $C[\ell]$ encodes information in the cyclic gaps between successive ones. Its combinatorial dimension is $k_\ell=\sum_{i=1}^{\ell} f_\ell(i)$, with the explicit formula
$$
k_\ell=\ell^2-\ell\log_2\ell+(\log_2\ell-1)
$$
when $\ell$ is a power of two, and a corresponding piecewise formula involving $\mu=2^{\lceil\log_2\ell\rceil}-\ell$ otherwise. The encoder partitions the message into $\ell$ blocks of lengths $f_\ell(i)$, interprets each block as an integer gap, and places the ones by modular pointer arithmetic; the first placed one is the anchor. Encoding runs in $O(k_\ell)$ time with $O(\ell)$ memory, and decoding consists of parsing the support, forming cyclic gaps, locating the anchor, and converting gaps back into binary blocks. Apart from the linear pass needed to parse the input, decoding is poly-logarithmic in $n$, and neither procedure uses binomial coefficients [2401.16647].

The same work proves that the underlying sequence $f_\ell$ is anchor-decodable and maximal among anchor-decodable sequences, and derives a lower bound
$$
k_\ell\ge \ell^2-\ell\log_2\ell+\log_2\ell-0.279\ell-0.721.
$$
It also gives an alternate family $\hat C[\ell]$ with a different decoder and the same size for $3\le \ell\le 7$, together with modified families $C_t[\ell]$, $D_t[\ell]$, and $B_t[\ell]$ that vary weight or blocklength while retaining low complexity; for $t=2$, the derived $C_t[\ell]$ is optimal for all $\ell\ge 3$ [2401.16647].

A more general algorithmic theme appears in the on-the-fly enumerative framework of [2405.14570]. There, Cover-style ranking and unranking is extended to fixed-weight, bounded-weight, and mixed local/global constraints by computing completion counts dynamically rather than through closed combinatorial formulas. For pure bounded-weight constraints, the per-position counts are partial sums of binomial coefficients over the feasible remaining-weight interval; with local constraints, the counts are computed by dynamic programming over suffix automaton states and remaining weight. The stated complexity is $O(n\cdot W)$ for bounded-weight intervals of span $W$, and $O(n\cdot |S|\cdot W)$ when a finite automaton of size $|S|$ models local forbidden-pattern constraints [2405.14570].

Run-length-limited bounded-weight coding remains an important classical branch. For $dkr$ and $dklr$ constraints, recurrent and direct formulas are known for the number of constant-weight sequences, rational generating functions exist for the constant-weight counts, and Cover-style enumerative encoding and decoding can be implemented from these counts. For the companion constant-charge problem, the generating function provably does not admit a closed form and reduces to elliptic-integral structure [0902.4246].

## 4. Local weight regulation: subblocks, windows, and local balance

Subblock and sliding-window constraints are motivated by energy delivery, power regularity, and biochemical balance. In SECCs, a length-$n$ word is partitioned into $m$ subblocks of length $L$, and every subblock must satisfy $w_{\min}\le \mathrm{wt}(B_{(i,L)}(x))\le w_{\max}$; the total admissible set has cardinality
$$
|S(n,L,[w_{\min},w_{\max}])|=\left(\sum_{w=w_{\min}}^{w_{\max}}\binom{L}{w}\right)^m.
$$
For bounded SWCCs, the same interval must hold in every contiguous length-$L$ window [2009.09558]. Two linear-time construction methods are given there: a Knuth-type prefix-flipping encoder for bounded SECCs with $\Theta(1)$ redundancy per subblock, and a sequence-replacement encoder for bounded SWCCs that uses only one redundant bit for the entire codeword when $n\ge 16$, $L\ge 7$, $(1/c^2)\ln n\le L\le n$, and $L-2\ge (1/c^2)\ln(L-2)$, where $c=\min\{1/2-p_1,p_2-1/2\}$ [2009.09558]. The same paper also adds VT-based single-substitution correction while preserving the weight constraints.

The asymptotic theory of subblock constraints shows that local regularity has a measurable coding cost. For fixed $L$ and small relative distance, CSCCs have strictly lower asymptotic rate than constant-weight codes, and SECCs have strictly lower asymptotic rate than heavy-weight codes. The paper also corrects an earlier asymptotic CSCC statement: for fixed $m$ and $L\to\infty$,
$$
\lim_{L\to\infty}\frac{1}{mL}\log C(m,L,\delta mL,\omega L)=\alpha(\delta,\omega),
$$
so the subblock penalty vanishes when the subblock length itself diverges [1701.04954].

Locally balanced constraints form a symmetric sliding-window model. A binary word is $(\ell,\delta)$-locally balanced if every consecutive window of length $\ell$ has weight between $\ell/2-\delta$ and $\ell/2+\delta$, and it is strongly $(\ell,\delta)$-locally balanced if the same holds for every even window length at least $\ell$. For strong $(4,1)$ balance, the problem is equivalent to bounding the running-digital-sum span by $3$, which yields a Dyck-path interpretation and capacity $\mathbb{C}(\ge 4,1)\approx 0.694$ bits/symbol. The paper gives two explicit encoders in this regime: an enumerative bounded-Dyck-path encoder with rate approaching $0.694$, and a six-state machine encoder with asymptotic rate $2/3$ and constant memory [2201.12238]. For fixed-window balance, a graph-based encoder built from a dense subgraph of the relevant de Bruijn graph attains reported rates such as $11/13$ for $(\ell,\delta)=(4,1)$ and $14/15$ for $(6,2)$ [2201.12238].

A common misconception is that local window constraints are merely cosmetic refinements of global constant-weight constraints. The cited results show the opposite: local balance, subblock composition, and sliding-window regulation change both capacity and construction methodology, often replacing simple layer counting by finite-type graphs, replacement systems, or bounded-RDS automata [1701.04954] [2201.12238].

## 5. Two-dimensional bounded-weight constraints

Two-dimensional bounded-weight coding generalizes the one-dimensional problem from vectors to arrays. In the row-column formulation, every row and every column must satisfy a prescribed weight condition; in the subarray formulation, every contiguous $m\times m$ subarray must satisfy the corresponding weight or near-balance bound. For $p$-bounded RC constraints, a row or column of length $n$ must have weight at most $pn$; for $\epsilon$-balanced RC constraints, its weight must lie in $[(1/2-\epsilon)n,(1/2+\epsilon)n]$ [2208.09138].

Two construction paradigms dominate the current literature. The first is divide-and-conquer balancing by swaps. For RC $p$-bounded codes with $p<1/2$, one can encode rows independently and then recursively rebalance columns by swap operations, recording the swap indices in auxiliary rows; the resulting redundancy is at most $n\lambda(n,p)+O(n\log n)$, and encoding and decoding are linear-time in the array size. For $\epsilon$-balanced RC constraints, a related divide-and-conquer construction has redundancy $\Theta(n)$ [2208.09138]. The second paradigm is sequence replacement. For $p>1/2$, an SRT-plus-antipodal-matching encoder achieves redundancy at most $n+3$ bits; for sufficiently large $n$, RC $\epsilon$-balanced codes can be encoded with only one redundant bit, under the conditions $n^2\ge 8/\epsilon^2\ln n$ and $n\epsilon\ge 2$ [2208.09138].

The universal 1D-to-2D framework of [2509.01240] systematizes these ideas for the upper-bounded row/column model. Given any 1D encoder $\phi$ producing length-$n$ words of weight at most $f(n)$, the construction uses the first $m=n-c$ rows for 1D codewords, where
$$
c=\left\lceil\frac{n}{f(n)}\right\rceil\lceil \log n+6\rceil,
$$
then applies recursive swap-and-flip balancing to the columns, and stores the balancing metadata in the last $c$ rows with sparse placement. Its rate is
$$
r_{\mathrm{Enc},f}(n)=r_\phi+\frac{\mathrm{Re}_\phi(\log n+6)}{n f(n)}-\frac{\log n+6}{f(n)},
$$
so if $f(n)=\omega(\log n)$ and the 1D family is capacity-approaching, then the 2D family is also capacity-approaching and satisfies $C_{2D}(f)=C_{1D}(f)$ [2509.01240].

These 2D models are tied in the cited papers to ReRAM crossbar arrays, sneak-path mitigation, and holographic storage, where controlling row/column or local subarray activity is part of the physical design problem rather than an abstract combinatorial constraint [2208.09138] [2509.01240].

## 6. Counting, upper bounds, and optimization methods

Exact counting and upper bounding in bounded-weight settings increasingly rely on harmonic-analysis and optimization techniques. For constrained subcodes of linear codes, the central identity is
$$
\sum_{x\in L} f(x)=|L|\sum_{u\in L^\perp}\widehat f(u),
$$
where $\widehat f$ is the Walsh–Hadamard transform. When $f$ depends only on Hamming weight, the transform reduces to a Krawtchouk expansion, and the exact number of codewords of a linear code $L$ whose weights lie in a window $[W_{\min},W_{\max}]$ can be computed from the dual weight distribution $A_t^\perp$ via
$$
N(L;[W_{\min},W_{\max}])=
|L|\sum_{t=0}^n A_t^\perp
\left(
2^{-n}\sum_{w=W_{\min}}^{W_{\max}} K_t(w)\binom{n}{w}
\right).
$$
The same paper extends Delsarte’s LP to constrained codes and shows that, after symmetrization under the full symmetric group, the bounded-weight LP has only $O(n)$ variables and constraints; it also reports that the resulting LP upper bounds beat generalized sphere packing numerically for several constrained families [2301.05098].

For heavy-weight codes, semidefinite programming yields both asymptotic structure and finite-length bounds. The asymptotic exponent transition at relative weight $1/2$ has already been noted. Non-asymptotically, the SDP method gives analytic bounds improving classical Elias/Johnson-type estimates and exact values in several cases, including $B(16,4,12)=141$, $B(16,6,10)=113$, $B(24,8,12)=3336$, and $B(24,8,8)=4095$ [1009.3657]. In the constant-weight layer, improved Delsarte LP bounds arise from additional linear constraints based on doubly-constant-weight codes and parity counting over $2$-row $k$-column submatrices; this yields twenty three new upper bounds on $A(n,d,w)$ for $n\le 28$, including $A(27,12,12)\le 139$ and $A(27,8,13)\le 11897$ [1108.5104].

The binary symbol-weight model adds a further analytic wrinkle. Because the underlying constrained space is not ball-homogeneous, sphere-packing arguments do not transfer directly, and the paper on symbol-weight codes emphasizes this nonuniformity as a barrier to Hamming-type bounds tailored to symbol-weight spaces [1110.0911].

## 7. Specialized families, applications, and current directions

Several recent works show how bounded-weight ideas interact with application-specific combinatorics. Constant-weight binary $B_2$-sequences, motivated by polymer-based storage, require that the coordinate-wise real sums of all distinct unordered pairs of codewords be distinct. In the constant-weight regime $\omega=\alpha n$, entropy arguments give the upper bound
$$
R_\alpha \le \frac{1}{2} H_{\mathrm{bin}}(\alpha),
$$
while Sidon-sequence constructions yield
$$
R_\alpha \ge \frac{\alpha}{2}\log_2(1/\alpha)
$$
when $n/\omega$ is an integer [2303.12990]. The bounded-weight aspect there is operational: fixed small weight controls synthesis cost and readout uniformity.

Algebraic explicit constructions remain central. Reed–Solomon-based graph embeddings give constant-weight codes with parameters such as
$$
A(q^2,2q+2-2r,q)\ge q^r+q,
$$
and the same paper reports explicit improvements including $A(64,10,8)\ge 4108$ and $A(64,12,8)\ge 522$; algebraic-geometric extensions produce many additional families [1505.06524]. At the opposite methodological extreme, automated combinatorial search has become competitive. The recent search-based work on constant-weight codes establishes improved lower bounds on $A(n,d,w)$ for $24$ parameter triples with $18\le n\le 35$ and $6\le d\le 18$, using a bit-swap tabu search and a randomized greedy method based on distance histograms. Among the reported improvements are $A(28,8,10)\ge 2028$, and two exact determinations, $A(31,16,13)=17$ and $A(31,16,14)=24$ [2603.00174].

Taken together, these results suggest a mature but still rapidly diversifying field. Global bounded-weight constraints, constant-weight layers, subblock and window constraints, local balance, run-length restrictions, symbol-weight models, and two-dimensional row/column formulations are no longer treated as isolated niches. Instead, they are linked by common analytical machinery—association schemes, Krawtchouk transforms, SDP/LP relaxations, and enumerative coding—and by a shared design objective: to trade off admissible weight profiles, minimum distance, and implementation complexity in regimes dictated by storage, communication, and biochemical constraints [2301.05098] [2405.14570].

Source: https://www.emergentmind.com/topics/binary-bounded-weight-constrained-codes