FlashProfile: Interactive Synthesis of Syntactic Profiles

Saswat Padhi, Prateek Jain, Daniel Perelman, Oleksandr Polozov, Sumit Gulwani, Todd D. Millstein

Abstract

We address the problem of learning a syntactic profile for a collection of strings, i.e. a set of regex-like patterns that succinctly describe the syntactic variations in the strings. Real-world datasets, typically curated from multiple sources, often contain data in various syntactic formats. Thus, any data processing task is preceded by the critical step of data format identification. However, manual inspection of data to identify the different formats is infeasible in standard big-data scenarios. Prior techniques are restricted to a small set of pre-defined patterns (e.g. digits, letters, words, etc.), and provide no control over granularity of profiles. We define syntactic profiling as a problem of clustering strings based on syntactic similarity, followed by identifying patterns that succinctly describe each cluster. We present a technique for synthesizing such profiles over a given language of patterns, that also allows for interactive refinement by requesting a desired number of clusters. Using a state-of-the-art inductive synthesis framework, PROSE, we have implemented our technique as FlashProfile. Across 153 tasks over 75 large real datasets, we observe a median profiling time of only ~0.7s. Furthermore, we show that access to syntactic profiles may allow for more accurate synthesis of programs, i.e. using fewer examples, in programming-by-example (PBE) workflows such as FlashFill.

Introduction

Data scientists spend up to 80% of their time on data wrangling—the process of cleaning and reformatting datasets for analysis. A critical bottleneck in this workflow is syntactic profiling: understanding the structural patterns and variations within a dataset. For instance, a column of dates might contain multiple formats (e.g., YYYY-MM-DD vs MM/DD/YY) or unexpected outliers. Existing profiling tools often suffer from rigidity, relying on fixed pattern sets, and a lack of user control over the granularity of the generated summaries.

FlashProfile addresses these challenges by framing syntactic profiling as an interactive search problem. It automatically generates succinct, regex-like summaries for large string collections, allowing users to explore data variations at different levels of detail.

Methodology

FlashProfile treats profiling as a clustering problem followed by pattern synthesis. The core of the system is a novel syntactic dissimilarity measure. Unlike standard edit distances, this metric is based on the complexity of a shared synthesized pattern. If two strings can be described by a simple, low-cost pattern (e.g., Digit x4), they are considered syntactically close.

The FlashProfile architecture integrates a Pattern Learner with Hierarchical Clustering to generate profiles from datasets.

Key Components

  • Inductive Synthesis (PROSE): Built on Microsoft’s PROSE framework, FlashProfile uses deductive reasoning to search a Domain-Specific Language (DSL) of patterns efficiently.
  • Hierarchical Clustering: The system constructs a dendrogram based on syntactic distance. This allows users to interactively "cut" the tree to obtain the specific number of clusters or level of detail they require.
  • BigProfile Algorithm: To scale to massive datasets, FlashProfile uses a "Sample-Profile-Filter" cycle, profiling subsets and filtering similar strings until the entire dataset is characterized.
  • Extensible DSL: The framework allows users to define custom "atoms" (e.g., specific product ID formats), which the system then incorporates into higher-level profiles.
A hierarchy generated for a 'Year' dataset, showing how the system suggests and refines patterns at different granularities.

Evaluation and Results

The researchers evaluated FlashProfile using 75 real-world datasets across 153 profiling tasks and 163 Flash Fill benchmarks.

  • Efficiency: FlashProfile is highly performant, with a median profiling time of just 0.7 seconds. Over 77% of tasks were completed in under 2 seconds, supporting real-time interactive use.
  • Quality: The system achieved a 96.21% F1-score in description quality, significantly outperforming industry tools like Microsoft SSDT and Ataccama One, which often produced overly general patterns or failed on complex datasets.
  • PBE Integration: When used to assist Programming-by-Example (PBE) systems like Flash Fill, syntactic profiles enabled the system to solve 86% of tasks using the minimum possible number of user-provided examples by identifying the most representative rows for labeling.

Discussion and Limitations

FlashProfile demonstrates the power of using program synthesis for unsupervised learning by treating the dataset itself as a specification. The "Pattern Cost = Distance" approach naturally groups strings that appear structurally similar to a regex engine.

However, some limitations remain. The costs for different pattern atoms are currently assigned manually, and future work could involve learning these costs automatically from large corpora. Additionally, while the system excels at syntactic patterns, it does not inherently capture semantic meaning (e.g., distinguishing between different types of fruit) without user-provided semantic atoms. Finally, extremely long strings can occasionally lead to synthesis timeouts.

Conclusion

FlashProfile provides a robust, extensible, and high-performance framework for syntactic profiling. By combining hierarchical clustering with inductive synthesis, it offers data scientists a powerful tool for understanding and cleaning complex datasets interactively.

Summary updated

Abstract

We address the problem of learning a syntactic profile for a collection of strings, i.e. a set of regex-like patterns that succinctly describe the syntactic variations in the strings. Real-world datasets, typically curated from multiple sources, often contain data in various syntactic formats. Thus, any data processing task is preceded by the critical step of data format identification. However, manual inspection of data to identify the different formats is infeasible in standard big-data scenarios. Prior techniques are restricted to a small set of pre-defined patterns (e.g. digits, letters, words, etc.), and provide no control over granularity of profiles. We define syntactic profiling as a problem of clustering strings based on syntactic similarity, followed by identifying patterns that succinctly describe each cluster. We present a technique for synthesizing such profiles over a given language of patterns, that also allows for interactive refinement by requesting a desired number of clusters. Using a state-of-the-art inductive synthesis framework, PROSE, we have implemented our technique as FlashProfile. Across $153$ tasks over $75$ large real datasets, we observe a median profiling time of only $\sim\,0.7\,$s. Furthermore, we show that access to syntactic profiles may allow for more accurate synthesis of programs, i.e. using fewer examples, in programming-by-example (PBE) workflows such as FlashFill.
BibTeX
@inproceedings{padhi2018flashprofile,
  author = {Saswat Padhi and Prateek Jain and Daniel Perelman and Oleksandr Polozov and Sumit Gulwani and Todd D. Millstein},
  title = {{FlashProfile: Interactive Synthesis of Syntactic Profiles}},
  booktitle = {Proc. ACM Program. Lang},
  year = {2018},
  url = {https://openreview.net/forum?id=qxNmnyA6SD1},
}
Figure