Table of Contents
Fetching ...

Pattern Masking for Dictionary Matching

Panagiotis Charalampopoulos, Huiping Chen, Peter Christen, Grigorios Loukides, Nadia Pisanti, Solon P. Pissis, Jakub Radoszewski

TL;DR

This work studies Pattern Masking for Dictionary Matching (PMDM), where given a dictionary of $d$ strings of length $\ell$, a query $q$, and a target $z$, one seeks the smallest set of masked positions $K$ so that $q_K$ matches at least $z$ dictionary strings. It establishes NP-hardness for PMDM-Size via a $k$-Clique reduction, develops exact algorithms for constant $k$ (and for multi-query variants) using a hypergraph framing (Heaviest $k$-PMDM and its generalization), and introduces a spectrum of data-structure approaches that trade space for query time. An approximation via a reduction to the Minimum Union problem yields a polynomial-time $O(d^{1/4+\epsilon})$-approximation, with bidirectional reductions strengthening the connection between PMDM and MU. A practical greedy heuristic (GR$\tau$-PMDM) combines these ideas and shows strong performance on real and synthetic data, achieving near-optimal solutions with scalable runtimes, including very large dictionaries. The results offer privacy-utility guarantees for record linkage and effective query term dropping in search systems while providing concrete algorithmic and structural tools for large-scale PMDM deployment.

Abstract

In the Pattern Masking for Dictionary Matching (PMDM) problem, we are given a dictionary $\mathcal{D}$ of $d$ strings, each of length $\ell$, a query string $q$ of length $\ell$, and a positive integer $z$, and we are asked to compute a smallest set $K\subseteq\{1,\ldots,\ell\}$, so that if $q[i]$, for all $i\in K$, is replaced by a wildcard, then $q$ matches at least $z$ strings from $\mathcal{D}$. The PMDM problem lies at the heart of two important applications featured in large-scale real-world systems: record linkage of databases that contain sensitive information, and query term dropping. In both applications, solving PMDM allows for providing data utility guarantees as opposed to existing approaches. We first show, through a reduction from the well-known $k$-Clique problem, that a decision version of the PMDM problem is NP-complete, even for strings over a binary alphabet. We present a data structure for PMDM that answers queries over $\mathcal{D}$ in time $\mathcal{O}(2^{\ell/2}(2^{\ell/2}+τ)\ell)$ and requires space $\mathcal{O}(2^{\ell}d^2/τ^2+2^{\ell/2}d)$, for any parameter $τ\in[1,d]$. We also approach the problem from a more practical perspective. We show an $\mathcal{O}((d\ell)^{k/3}+d\ell)$-time and $\mathcal{O}(d\ell)$-space algorithm for PMDM if $k=|K|=\mathcal{O}(1)$. We generalize our exact algorithm to mask multiple query strings simultaneously. We complement our results by showing a two-way polynomial-time reduction between PMDM and the Minimum Union problem [Chlamtáč et al., SODA 2017]. This gives a polynomial-time $\mathcal{O}(d^{1/4+ε})$-approximation algorithm for PMDM, which is tight under plausible complexity conjectures.

Pattern Masking for Dictionary Matching

TL;DR

This work studies Pattern Masking for Dictionary Matching (PMDM), where given a dictionary of strings of length , a query , and a target , one seeks the smallest set of masked positions so that matches at least dictionary strings. It establishes NP-hardness for PMDM-Size via a -Clique reduction, develops exact algorithms for constant (and for multi-query variants) using a hypergraph framing (Heaviest -PMDM and its generalization), and introduces a spectrum of data-structure approaches that trade space for query time. An approximation via a reduction to the Minimum Union problem yields a polynomial-time -approximation, with bidirectional reductions strengthening the connection between PMDM and MU. A practical greedy heuristic (GR-PMDM) combines these ideas and shows strong performance on real and synthetic data, achieving near-optimal solutions with scalable runtimes, including very large dictionaries. The results offer privacy-utility guarantees for record linkage and effective query term dropping in search systems while providing concrete algorithmic and structural tools for large-scale PMDM deployment.

Abstract

In the Pattern Masking for Dictionary Matching (PMDM) problem, we are given a dictionary of strings, each of length , a query string of length , and a positive integer , and we are asked to compute a smallest set , so that if , for all , is replaced by a wildcard, then matches at least strings from . The PMDM problem lies at the heart of two important applications featured in large-scale real-world systems: record linkage of databases that contain sensitive information, and query term dropping. In both applications, solving PMDM allows for providing data utility guarantees as opposed to existing approaches. We first show, through a reduction from the well-known -Clique problem, that a decision version of the PMDM problem is NP-complete, even for strings over a binary alphabet. We present a data structure for PMDM that answers queries over in time and requires space , for any parameter . We also approach the problem from a more practical perspective. We show an -time and -space algorithm for PMDM if . We generalize our exact algorithm to mask multiple query strings simultaneously. We complement our results by showing a two-way polynomial-time reduction between PMDM and the Minimum Union problem [Chlamtáč et al., SODA 2017]. This gives a polynomial-time -approximation algorithm for PMDM, which is tight under plausible complexity conjectures.

Paper Structure

This paper contains 30 sections, 18 theorems, 8 equations, 7 figures, 2 tables.

Key Result

Theorem 1

Any instance of the $k$-Clique problem for a graph with $n$ nodes and $m$ edges can be reduced in $\mathcal{O}(nm)$ time to a $k$-PMDM instance with $\ell=n$, $d=m$ and $\Sigma=\{\mathtt{a},\mathtt{b}\}$.

Figures (7)

  • Figure 1: An example of the reduction from $k$-Clique to $k$-PMDM. The solution for both is $\{1,2,3\}$ as shown. Note that, for $k=4$, the instance of $4$-PMDM would need $z=6$ matches; neither this many matches can be found in $\mathcal{D}$ nor a $4$-clique can be found in the graph.
  • Figure 2: An example of the reduction from Heaviest $k$-PMDM to Heaviest $k$-Section. The solutions are at the bottom. Each edge has its weight in brackets and the total weight is $d=6$.
  • Figure 3: Let $\tau=3$. If both $q'_L$ and $q'_R$ are $3$-frequent (we check this using the counts of DS Simple), then we read the count for $q'_Lq'_R$ from the compacted trie of DS Split. If $q'_L$ is $3$-infrequent, then we apply Small-$\ell$ on $q_R$ and on the dictionary consisting of at most $\tau=3$ strings from $\mathcal{D}_R$ corresponding to the right halves of strings in $\mathcal{D}_L$ that match $q'_L$.
  • Figure 4: AvgRE (in logscale) vs. $z$ computed for (a) FS and (b) FCi; (c) AvgSS vs. $z$ for FS.
  • Figure 5: AvgSS vs. $z$ for (a) FCi. (b) FCiCo (BF did not produce results for any $z$ within 48 hours), and (c) FSCiCo (BF and BA did not produce results for any $z$ within 48 hours. The results of GR for $z>100$ are omitted because AvgSS $>40$ which is close to $\ell=45$).
  • ...and 2 more figures

Theorems & Definitions (34)

  • Theorem 1
  • proof
  • Corollary 1
  • Corollary 2
  • Remark 1
  • Theorem 2
  • proof
  • Theorem 3
  • Lemma 1
  • proof
  • ...and 24 more