arXiv:2611.00162cs.ITOct 2026

Manuscript Offprint

arXiv:2611.00162

Beyond Typical Strings: Sampling the Complexity Landscape

Abdurrahman Hadi Erturk, Joshua Sharkey, Nora S Martin, Kamal Dingle, Ard A Louis

Abdurrahman Hadi Erturk, Joshua Sharkey, Nora S. Martin, Kamal Dingle, and Ard A. Louis

Abstract—Uniform random sampling of strings is overwhelmingly dominated by high-complexity strings, leaving the much smaller set of low- and intermediate-complexity strings largely unexplored. Here, we adapt the nested neutral set estimator (NNSE), a Monte Carlo rare-event sampling method, to estimate the distribution P(K)P(K) of complexity values for binary strings of fixed length. NNSE allows us to explore the full complexity landscape, including exponentially rare low-complexity regions that are inaccessible to direct sampling, for string lengths up to several hundred. We apply the method to several widely used complexity measures: Lempel–Ziv 76 (LZ76), Lempel–Ziv 78 (LZ78), context tree weighting (CTW), the block decomposition method (BDM), and block entropy. We further introduce uniform complexity weighting (UCW), which gives equal weight to different complexity levels rather than to individual strings. This approach provides a dataset-independent framework for comparing complexity measures across their full range and reveals substantial differences between measures for low- and intermediate-complexity strings that are largely hidden by conventional uniform sampling. Using the NNSE to perform UCW sampling allows us to compare complexity measures across their full range in a dataset-independent way. This reveals differences in their behavior for low- and intermediate-complexity strings that are practically inaccessible to conventional uniform sampling.

Index Terms—Algorithmic information theory, block entropy, complexity measures, context tree weighting, data compression, Kolmogorov complexity, Lempel–Ziv complexity, Markov chain Monte Carlo, rare-event sampling.

I. INTRODUCTION

GIVEN a complexity measure K(x)K(x), estimated for example using code lengths from a compression algorithm, we consider the probability distribution P(K)P(K) that one obtains

The work of A. H. Erturk was supported by the Clarendon Fund, University of Oxford. The work of N. S. Martin was supported by the Spanish Ministry of Science and Innovation through the Centro de Excelencia Severo Ochoa (CEX2020-001049-S, MCIN/AEI/10.13039/501100011033), the EMBL partnership and the Generalitat de Catalunya through the CERCA programme, and also the Issachar Fund. Research for this publication has been partially carried out in the Barcelona Collaboratorium for Modelling and Predictive Biology. This research is part of Grant JDC2022-049526-I funded by MCIN/AEI/10.13039/501100011033 and by European Union NextGenerationEU/PRTR. The funders played no role in the study design, data collection and analysis, decision to publish, or preparation of the manuscript.

A. H. Erturk and A. A. Louis are with the Department of Theoretical Physics, University of Oxford, Oxford, OX1 3PU, UK (e-mails: abdurrahman.erturk@physics.ox.ac.uk, ard.louis@physics.ox.ac.uk). N. S. Martin and J. Sharkey were also at this institution during part of this work.

J. Sharkey is with the Institute for Gravitational Research, School of Physics and Astronomy, University of Glasgow, G12 8QQ, Glasgow, UK.

N. S. Martin is with CRG (Barcelona Collaboratorium for Modelling and Predictive Biology), Dr. Aiguader 88, Barcelona, 08003, Spain.

K. Dingle is with the Department of Mathematics and Natural Science, Gulf University for Science and Technology, Kuwait.

Ard A. Louis is the corresponding author

complexity K(x)K(x) upon picking a binary string xx at random from the whole set {0,1}n\{0,1\}^{n} of strings of length nn. For some measures, such as LZ78 [1], this distribution can be computed analytically [2]. In general, however, this distribution is not known.

Compression algorithms are typically applied to natural datasets such as text, images, or biological sequences, which are much lower in complexity than typical random strings of the same length. Many natural input-output maps are intrinsically biased towards producing low- to intermediate-complexity outputs [3]–[7]. Understanding how compression-based complexity measures behave in the low and intermediate complexity regime, which forms a tiny subset of sequence space, is therefore of considerable practical interest.

One expects that, for many compression-based measures, P(K)≤2KP(K) \leq 2^K [8]. That is, low-complexity strings are exponentially rare under uniform random sampling. As a result, comparisons of complexity measures have generally relied either on benchmark datasets, which introduce unknown source biases, or on uniform random sampling, which is dominated by high-complexity strings. There is a need for a method that allows one to compare these measures on low to intermediate complexity strings that is also dataset agnostic.

Here, we introduce a nested Monte Carlo rare-event method inspired by work [9] that estimates the sizes of neutral sets, defined as the sets of sequences mapping to the same RNA secondary structure. We adapt this nested neutral set estimator (NNSE) algorithm to binary strings and apply it to a series of complexity measures. The NNSE samples uniformly within each complexity level across the whole range of KK. This allows us to estimate the full distribution P(K)P(K), including tail regions inaccessible to direct sampling. It also provides a dataset-independent way to compare different complexity measures across the full range of KK, rather than only for the typical high-complexity strings that dominate uniform random sampling.

More generally, it allows us to compare two distinct ways to measure properties of strings. We call the first, where all strings are treated as equally likely, uniform string weighting (USW). The USW average of a function f(x)f(x) of string xx over all 2n2^n strings of length nn is:

EUSWf(x)=2−n∑{0,1}nf(x)(1)\mathbb{E}_{\mathrm{USW}}f(x)=2^{-n}\sum_{\{0,1\}^{n}}f(x) \tag{1}

Many calculations in information theory use USW. However, this is dominated by strings with high complexity.

An alternative way of sampling is uniform complexity weighting (UCW) which gives equal weight to each complexity. For example, a UCW average would be:

EUCWf(x)=1m∑K′=K1Km1NK′∑x∈{0,1}n;K(x)=K′f(x)(2)\mathbb{E}_{\mathrm{U C W}}f(x)=\frac{1}{m}\sum_{K^{\prime}=K_{1}}^{K_{m}}\frac{1}{N_{K^{\prime}}}\sum_{x\in\{0,1\}^{n};K(x)=K^{\prime}}f(x) \tag{2}

where K:{0,1}n→{K1,K2,…,Km}K : \{0,1\}^n \to \{K_1, K_2, \ldots, K_m\} where K1<K2<⋯<KmK_1 < K_2 < \cdots < K_m and NK′=∣{x∈{0,1}n:K(x)=K′}∣N_{K'} = |\{x \in \{0,1\}^n : K(x) = K'\}|. The NNSE allows us to calculate UCW properties of interest. These would normally only be accessible through exhaustive enumeration, which is typically limited to string lengths of n≈30−40n \approx 30-40, whereas our method extends this range to strings of length several hundred or longer.

The complexity distribution P(K)P(K) is of interest beyond the comparison of complexity measures. The connection between lossless compression and universal prediction is well established [10]: the code lengths assigned by a universal compressor define an implicit probability distribution, Q(x)∝2−K(x)Q(x) \propto 2^{-K(x)}, whose predictive performance depends on the distribution of KK. A related connection arises in security, where randomized guessing strategies based on universal compression achieve optimal guessing exponents for decentralized brute-force attacks [11]. Here, Q(x)Q(x) determines the order in which candidate passwords are guessed. These applications provide further motivation for efficient methods to estimate P(K)P(K), or equivalently to generate strings in the exponentially rare low-complexity regime where direct USW is ineffective.

References (31)