Multi-Intent Detection in User Provided Annotations for Programming by Examples Systems

Nischal Ashok Kumar, Nitin Gupta, Shanmukha Guttula, Hima PatelarXiv 2023

TL;DR

This paper introduces a deep learning framework to detect ambiguity in user-provided examples for Programming by Example (PBE) systems. By identifying five specific "ambiguity properties" before program synthesis begins, the system helps users refine their annotations, ensuring the generated program matches their true intent rather than just fitting a small, coincidental pattern.

What Problem Does This Paper Address?

Programming by Example (PBE) is a powerful paradigm—think Excel’s Flash Fill—where a user provides a few input-output pairs (e.g., John Doe $\rightarrow$ J.D.), and the system synthesizes a program to automate the task. However, PBE systems suffer from the intent gap. Because users typically provide very few examples, multiple valid programs can often satisfy them.

For instance, if a user provides ABCD_12 $\rightarrow$ 12, the system might learn to "extract the last two characters" or "extract everything after the underscore." If the next input is BDJ_535, these two programs will produce different results. Without a way to detect this ambiguity early, PBE systems often pick a "simple" program that fails on unseen data, leading to user frustration and incorrect data transformations in enterprise applications.

Methods

The authors propose a multi-tasking, attention-based deep neural network designed to flag ambiguity before synthesis.

1. Defining Ambiguity Properties

The researchers identified five generic properties that frequently cause multi-intent confusion in string transformation tasks:

  • Similar Length: All outputs have the same length, making it unclear if the rule is "fixed length" or "pattern-based."
  • Exact Position Placement: Outputs always start or end at the same index in the input.
  • Exact Match: All outputs are identical strings.
  • Similar in Token Type: All outputs belong to the same category (e.g., all are numeric).
  • Repeating Characters: The output string appears multiple times in the input, making the source location ambiguous.

2. Model Architecture

The framework uses a hard-parameter sharing paradigm for multi-task learning, as illustrated in Figure 3:

Figure 3: Proposed multi-tasking deep attention based NN architecture to detect multi-intent issues in I/O pairs.
  • Common Encoder: Uses character-level embeddings and LSTMs to encode the raw input-output strings.
  • Task-Specific Modules: Five parallel branches (one for each property) process the encodings. Each branch includes an Additive Attention mechanism to focus on relevant parts of the input, followed by a CNN to capture local dependencies between characters.
  • Multi-Task Loss: The model is trained using a weighted sum of Cross-Entropy losses across all five tasks.

Datasets

The authors generated a large-scale synthetic dataset to train and evaluate the model:

  • Scale: 100,002 individual I/O samples, grouped into 33,334 "examples" (sets of 3 I/O pairs) per ambiguity property.
  • Diversity: The dataset includes uppercase/lowercase English characters, digits, and special characters.
  • Generation: Examples were created using regex-based rules designed to trigger specific ambiguities while maintaining a realistic structure for string transformation tasks.

Key Insights and Ideas

  • Ambiguity as a Diagnostic: Instead of trying to guess the "best" program, the system acts as a diagnostic tool. It tells the user why their examples are insufficient (e.g., "Your examples all have 3-digit outputs; is that a rule or a coincidence?").
  • The Power of Attention and CNNs: The ablation studies revealed that the CNN layer is particularly critical. While LSTMs capture long-term sequence context, the CNNs are better at identifying the specific local character patterns (like delimiters or token types) that define the ambiguity properties.
  • Human-in-the-Loop PBE: The high-level workflow (Figure 1) emphasizes an iterative process. By flagging issues for end-user review, the system transforms PBE from a "black box" into a collaborative tool.
Figure 1: Overview of proposed multi-intents/ambiguity de- tection framework.

Key Results

  • High Accuracy: The "Main Model" (using LSTM + Attention + CNN) achieved near 100% accuracy across almost all ambiguity properties in the test set.
  • Ablation Performance: Removing the CNN layer caused performance to drop significantly (sometimes down to ~50% F1 score), proving its necessity for detecting structural ambiguities.
  • Real-World Impact: In case studies involving Microsoft Excel and the PROSE synthesis engine, the authors showed that their framework correctly identified ambiguities that led these commercial-grade systems to generate incorrect programs. Once the user added a clarifying example (prompted by the tool), the PBE systems successfully learned the correct intent.

Limitations and Future Work

  • Synthetic Data Bias: While the synthetic dataset is large, it may not capture all the "messiness" of real-world enterprise data (e.g., typos or highly irregular formatting).
  • Fixed Property List: The current model is limited to five properties. While the authors claim the framework is extensible, adding new properties requires generating new training data and retraining the task-specific heads.
  • Future Direction: The authors suggest moving toward active learning, where the system doesn't just flag ambiguity but automatically generates "distinguishing inputs" for the user to label, further streamlining the PBE process.

Summary updated

BibTeX
@misc{kumar2023multi,
  author = {Nischal Ashok Kumar and Nitin Gupta and Shanmukha Guttula and Hima Patel},
  title = {{Multi-Intent Detection in User Provided Annotations for Programming by Examples Systems}},
  year = {2023},
  eprint = {2307.03966},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2307.03966},
}
Figure