MCP
arXivarXiv
Preprint
Published: August 4, 2026
cs.DS

Quality Control Algorithms for Pattern Counting

Abstract
In recent work, Marcussen, Rubinfeld, and Sudan introduced the notion of quality control problems, which aim to capture the task of determining if a given input is truly random. Formally, their goal is to accept typical inputs from the specified distribution while rejecting every input whose value of a specified statistic is far from the distributional baseline. This captures the empirical practice of using specified statistics as a proxy for the quality of randomness. Empirical algorithms, however, have not exploited the asymmetry in the definition of quality control problems, which require soundness guarantees in the worst-case while only seeking average-case completeness. Their work abstracted a problem definition emphasizing this asymmetry and used it to give efficient quality control algorithms for assessing the randomness of graphs. In this work, we introduce and study quality control problems over sequences, where the goal is to distinguish a sequence of i.i.d. characters from sequences where some specified pattern appears too often (or too infrequently) as a subsequence. We consider this problem in both the finite-alphabet setting and for real-valued sequences. We refer to the former setting as the pattern counting problem. In the latter case, the natural notion of a pattern is to consider the relative ordering of the characters in the subsequence, and we refer to this as the permutation pattern counting problem. Algorithms to approximately count (permutation) patterns of length kk in a worst-case sequence of length nn can provably require exponential in kk queries into the sequence. In contrast, we show that by taking advantage of the asymmetry in the definition of quality control, we give algorithms that run in poly(k)(k) time to solve these problems. We also prove that any quality control algorithm (over some natural distributions) requires superlinear queries in kk.
0
AI overview
Reviews
Citation graph
References · 28
Structured
This preview uses generator v1; v2 is available

Overview

Addressing the quality control problem for pattern counting in sequence settings, this paper proposes a sublinear algorithmic framework based on exponentially robust pseudorandomness, obtaining polynomial-time feasible solutions for both permutation patterns and discrete subsequences, along with corresponding query complexity lower bounds.

Definition and Research Background of the Quality Control Problem for Sequence Pattern Counting

This study introduces and investigates quality control problems on sequences, whose core goal is to distinguish between two types of sequences: baseline sequences generated by independently and identically distributed characters, and anomalous sequences in which a specified pattern appears as a subsequence with too high or too low a frequency. The study covers two typical scenarios: pattern counting over finite alphabets, and permutation pattern counting over real-valued sequences where patterns are defined by the relative order of characters within a subsequence.

Prior quality-control-related frameworks were only defined and applied in graph settings; this work is a new exploration extending that framework to sequences. Although multiple steps of the algorithm and analysis are inspired by research in graph settings, each step requires tailored definitions and rigorous derivation for the sequence setting. In terms of performance, the original worst-case approximate sequence pattern counting problem has an exponential lower bound in the pattern length k, whereas the quality control version admits a polynomial upper bound in k; the performance gap between the two is clear-cut.

Core Research Contributions of Quality Control for Sequence Pattern Counting

For the continuous permutation pattern scenario, the paper proposes a quality control algorithm running in poly(k) time in the sublinear-time model, distinguishing two types of sequences: typical sequences sampled from the independent distribution p⊗np^{\otimes n}, and atypical sequences in which the number of copies of a target permutation pattern τ of length k deviates from typical statistics. For the discrete subsequence scenario, when distribution p is defined over the symbol set [m] with minimum probability pminp_{min}, the corresponding quality control algorithm requires only on the order of poly(mk/pmin)poly(mk/p_{min}) queries and time. This is the first validated scenario, proving that the quality control framework can transform a problem requiring exponential time in the worst case into one fully solvable in polynomial time.

To obtain the above low-complexity results, the paper introduces the concept of exponentially robust pseudorandomness, proving that samples of only poly(k) size fully preserve the counting properties of permutation patterns of length k, without needing to read subsequences of length min(n,exp(k))min(n, exp(k)) to verify whether the count share of a permutation pattern is close to 1, thereby directly avoiding the high overhead of the original verification route.

The final algorithm for a permutation of length n is very simple, with core steps as follows: first sample a random subsequence of length N=poly(k)N=poly(k) from the original permutation, then represent the permutation σ corresponding to this subsequence as a two-dimensional point set {(i,σ(i))}i∈[N]⊆[N]×[N]\{(i, \sigma(i))\}_{i\in[N]} \subseteq [N] \times [N], then partition the [N]×[N][N] \times [N] space into a coarse grid of (N/m)×(N/m)(N/m) \times (N/m), where each grid cell is an m×mm \times m square, and the quality control decision is completed based on this binning result.

Algorithm Construction Logic Based on Exponentially Robust Pseudorandomness

To address the two core obstacles in quality control for sequence pattern counting, the paper designs two mutually cooperating core components. The first component is exponentially robust pseudorandomness, a mechanism that verifies the global count of a target pattern using only random subsequences of polynomial size in k, directly keeping query complexity polynomial. The design of this concept draws on existing pseudorandomness research and extends the applicability boundary of such methods.

The second core component is permutation mixingness, a proxy statistic computable in O(N) time that characterizes pattern counting features on subsequences, avoiding explicit enumeration and counting of all patterns and reducing the overall runtime overhead of the algorithm at the computational-path level.

Combining the two core components yields the complete quality control decision algorithm for sequence pattern counting: first sample an index subsequence of polynomial size in k and construct the corresponding induced permutation, then test whether that permutation satisfies the (m, β)-mixingness condition, outputting an accept decision only when it does. Completeness of the algorithm is guaranteed directly, because the restriction of a random permutation to a random index set is still a random permutation, hence satisfying the mixingness requirement with high probability; for reliability, if the count of the target pattern in the original sequence deviates from 1 by a sufficiently large margin, the argument via exponentially robust pseudorandomness shows that there must exist some subsequence length such that the sampled subpattern count deviates from the expected value under independent and identically distributed sampling, whereas the mixingness requirement demands all such counts match expectations; thus the sampled subsequence cannot satisfy the mixingness condition, and the tester outputs reject. You can refer to the algorithm flow diagram below to fully trace the three-step execution logic from input to final decision.

Fig. 1: Quality control algorithm for permutation pattern counting based on exponentially robust pseudorandomness

This algorithm, constructed from exponentially robust pseudorandomness and permutation mixingness, ultimately completes the specified sequence pattern counting quality control task using only on the order of poly(k/p_min) queries and time, where p_min is the minimum probability over all patterns.

Theoretical Validation Results of Algorithm Upper Bounds and Complexity Lower Bounds

For a permutation pattern τ of length k, in the setting of sequences generated by non-atomic real-valued distributions, the paper proves that the quality control algorithm's query and time complexity is only polynomial in k, entirely independent of the total input sequence length n, requiring only on the order of O(k8ε−5log⁡(1/ε))O(k^8 \varepsilon^{-5} \log(1/\varepsilon)) queries and time to complete the decision. You can refer to the diagram that follows to understand the correspondence between the block design of multi-level decreasing point sequences and the derivation of this polynomial upper bound.

Fig. 2: Schematic construction of the worst-case approximation lower bound instance for counting increasing sequences of length k, showing the construction steps of sequence blocking and value reduction

The paper also gives query complexity lower bound conclusions for both scenarios: for any permutation pattern of length k, all quality control algorithms satisfying the correctness requirement require at least Ω(k1.5−δ)\Omega(k^{1.5-\delta}) queries, while for the specific case of the increasing permutation pattern of length k, the query complexity lower bound can be further tightened to Ω(k2−δ)\Omega(k^{2-\delta}), where δ is any constant in the open interval (0,1).

Parameter Boundaries of Current Results and Open Problems

The current research has achieved the core goal of deriving fully polynomial bounds for the sequence pattern counting quality control problem, but core parameter dependencies remain unclear: for both the permutation pattern and subsequence scenarios, the precise correspondence of algorithm complexity with respect to the parameters (k, ε, m, p_min) has not been pinpointed; this is currently the main open problem in this direction.

In addition, the permutation mixingness concept proposed in the paper has potential broader applicability in research on pseudorandom permutations and sequences; exploring practical application scenarios for this concept is a research direction worth attention going forward.

Rating
No ratings yet
Rate
Community rating
—
/ 5
No ratings yet
Rating
—
Soundness
—
Presentation
—
Contribution
—
Confidence
—
Discussion
Top
Newest
Questions
Replication
Author
No comments yet — be the first