Search-Based Regular Expression Inference on a GPU

05/29/2023
by   Mojtaba Valizadeh, et al.
0

Regular expression inference (REI) is a supervised machine learning and program synthesis problem that takes a cost metric for regular expressions, and positive and negative examples of strings as input. It outputs a regular expression that is precise (i.e., accepts all positive and rejects all negative examples), and minimal w.r.t. to the cost metric. We present a novel algorithm for REI over arbitrary alphabets that is enumerative and trades off time for space. Our main algorithmic idea is to implement the search space of regular expressions succinctly as a contiguous matrix of bitvectors. Collectively, the bitvectors represent, as characteristic sequences, all sub-languages of the infix-closure of the union of positive and negative examples. Mathematically, this is a semiring of (a variant of) formal power series. Infix-closure enables bottom-up compositional construction of larger from smaller regular expressions using the operations of our semiring. This minimises data movement and data-dependent branching, hence maximises data-parallelism. In addition, the infix-closure remains unchanged during the search, hence search can be staged: first pre-compute various expensive operations, and then run the compute intensive search process. We provide two C++ implementations, one for general purpose CPUs and one for Nvidia GPUs (using CUDA). We benchmark both on Google Colab Pro: the GPU implementation is on average over 1000x faster than the CPU implementation on the hardest benchmarks.

READ FULL TEXT

page 8

page 10

research
05/22/2018

Bayesian Inference of Regular Expressions from Human-Generated Example Strings

In programming by example, users "write" programs by generating a small ...
research
08/15/2023

The Regular Expression Inference Challenge

We propose regular expression inference (REI) as a challenge for code/la...
research
10/23/2020

Automatic Repair of Vulnerable Regular Expressions

A regular expression is called vulnerable if there exist input strings o...
research
05/17/2023

Data Extraction via Semantic Regular Expression Synthesis

Many data extraction tasks of practical relevance require not only synta...
research
05/20/2022

Neuro-Symbolic Regex Synthesis Framework via Neural Example Splitting

Due to the practical importance of regular expressions (regexes, for sho...
research
12/28/2020

FOREST: An Interactive Multi-tree Synthesizer for Regular Expressions

Form validators based on regular expressions are often used on digital f...
research
08/13/2023

The Usability of Pragmatic Communication in Regular Expression Synthesis

Programming-by-example (PBE) systems aim to alleviate the burden of prog...

Please sign up or login with your details

Forgot password? Click here to reset